6762{
6764 {
6765 return true;
6766 }
6767};
6768
6770{
6771
6772};
6773
6774
6775
6777{
6781
6783
6786
6787
6788
6789
6790
6799
6805
6810
6815
6836 protected bool m_IsResultOfSplit
6837
6839
6844
6845
6846
6848
6852
6853
6854
6856
6859
6860
6861
6867
6868
6876
6879
6880
6882
6883
6885
6886
6891
6892
6897
6899
6900
6902
6903
6905 {
6910
6911 if (!
g_Game.IsDedicatedServer())
6912 {
6914 {
6916
6918 {
6920 }
6921 }
6922
6925 }
6926
6927 m_OldLocation = null;
6928
6930 {
6932 }
6933
6934 if (ConfigIsExisting("headSelectionsToHide"))
6935 {
6938 }
6939
6941 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6942 {
6944 }
6945
6947
6948 m_IsResultOfSplit = false;
6949
6951 }
6952
6954 {
6955 super.InitItemVariables();
6956
6962 m_Count = ConfigGetInt(
"count");
6963
6966
6971
6974
6979
6991
6995
6996
6999 if (ConfigIsExisting("canBeSplit"))
7000 {
7003 }
7004
7006 if (ConfigIsExisting("itemBehaviour"))
7008
7009
7012 RegisterNetSyncVariableInt("m_VarLiquidType");
7013 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7014
7015 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7016 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7017 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7018
7019 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7020 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7021 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7022 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7023
7024 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7025 RegisterNetSyncVariableBool("m_IsTakeable");
7026 RegisterNetSyncVariableBool("m_IsHologram");
7027
7030 {
7033 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7034 }
7035
7037
7039 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7041
7043 }
7044
7046 {
7048 }
7049
7051 {
7054 {
7059 }
7060 }
7061
7062 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7063 {
7065 {
7068 }
7069
7071 }
7072
7074 {
7080 }
7081
7083
7085 {
7087
7088 if (!action)
7089 {
7090 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7091 return;
7092 }
7093
7095 if (!ai)
7096 {
7098 return;
7099 }
7100
7102 if (!action_array)
7103 {
7104 action_array = new array<ActionBase_Basic>;
7106 }
7107 if (LogManager.IsActionLogEnable())
7108 {
7109 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7110 }
7111
7112 if (action_array.Find(action) != -1)
7113 {
7114 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7115 }
7116 else
7117 {
7118 action_array.Insert(action);
7119 }
7120 }
7121
7123 {
7124 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7125 ActionBase action = player.GetActionManager().GetAction(actionName);
7128
7129 if (action_array)
7130 {
7131 action_array.RemoveItem(action);
7132 }
7133 }
7134
7135
7136
7138 {
7139 ActionOverrideData overrideData = new ActionOverrideData();
7143
7145 if (!actionMap)
7146 {
7149 }
7150
7151 actionMap.Insert(this.
Type(), overrideData);
7152
7153 }
7154
7156
7158
7159
7161 {
7164
7167
7168 string config_to_search = "CfgVehicles";
7169 string muzzle_owner_config;
7170
7172 {
7173 if (IsInherited(Weapon))
7174 config_to_search = "CfgWeapons";
7175
7176 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7177
7178 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7179
7180 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7181
7182 if (config_OnFire_subclass_count > 0)
7183 {
7184 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7185
7186 for (int i = 0; i < config_OnFire_subclass_count; i++)
7187 {
7188 string particle_class = "";
7189 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7190 string config_OnFire_entry = config_OnFire_class + particle_class;
7191 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7192 WPOF_array.Insert(WPOF);
7193 }
7194
7195
7197 }
7198 }
7199
7201 {
7202 config_to_search = "CfgWeapons";
7203 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7204
7205 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7206
7207 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7208
7209 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7210 {
7211 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7212
7213 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7214 {
7215 string particle_class2 = "";
7216 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7217 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7218 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7219 WPOBE_array.Insert(WPOBE);
7220 }
7221
7222
7224 }
7225 }
7226 }
7227
7228
7230 {
7233
7235 {
7236 string config_to_search = "CfgVehicles";
7237
7238 if (IsInherited(Weapon))
7239 config_to_search = "CfgWeapons";
7240
7241 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7242 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7243
7244 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7245 {
7246
7248
7250 {
7252 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7254 return;
7255 }
7256
7259
7260
7261
7262 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7263 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7264
7265 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7266 {
7267 string particle_class = "";
7268 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7269 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7270 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7271
7272 if (entry_type == CT_CLASS)
7273 {
7274 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7275 WPOOH_array.Insert(WPOF);
7276 }
7277 }
7278
7279
7281 }
7282 }
7283 }
7284
7286 {
7288 }
7289
7291 {
7293 {
7295
7298
7301
7302 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7303 }
7304 }
7305
7307 {
7309 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7310
7312 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7313
7315 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7316
7318 {
7320 }
7321 }
7322
7324 {
7326 }
7327
7329 {
7332 else
7334
7336 {
7339 }
7340 else
7341 {
7344
7347 }
7348
7350 }
7351
7353 {
7355 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7356 }
7357
7359 {
7361 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7363 }
7364
7366 {
7368 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7369 }
7370
7372 {
7375
7376 OverheatingParticle OP = new OverheatingParticle();
7381
7383 }
7384
7386 {
7389
7390 return -1;
7391 }
7392
7394 {
7396 {
7399
7400 for (int i = count; i > 0; --i)
7401 {
7402 int id = i - 1;
7405
7408
7409 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7410 {
7411 if (p)
7412 {
7415 }
7416 }
7417 }
7418 }
7419 }
7420
7422 {
7424 {
7426 {
7427 int id = i - 1;
7429
7430 if (OP)
7431 {
7433
7434 if (p)
7435 {
7437 }
7438
7439 delete OP;
7440 }
7441 }
7442
7445 }
7446 }
7447
7450 {
7451 return 0.0;
7452 }
7453
7454
7456 {
7457 return 250;
7458 }
7459
7461 {
7462 return 0;
7463 }
7464
7467 {
7469 return true;
7470
7471 return false;
7472 }
7473
7476 {
7479
7481 {
7483 }
7484 else
7485 {
7486
7488 }
7489
7491 }
7492
7499 {
7500 return -1;
7501 }
7502
7503
7504
7505
7507 {
7509 {
7510 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7511 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7512
7513 if (r_index >= 0)
7514 {
7515 InventoryLocation r_il = new InventoryLocation;
7516 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7517
7518 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7521 {
7522 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7523 }
7525 {
7526 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7527 }
7528
7529 }
7530
7531 player.GetHumanInventory().ClearUserReservedLocation(this);
7532 }
7533
7536 }
7537
7538
7539
7540
7542 {
7543 return ItemBase.m_DebugActionsMask;
7544 }
7545
7547 {
7548 return ItemBase.m_DebugActionsMask & mask;
7549 }
7550
7552 {
7553 ItemBase.m_DebugActionsMask = mask;
7554 }
7555
7557 {
7558 ItemBase.m_DebugActionsMask |= mask;
7559 }
7560
7562 {
7563 ItemBase.m_DebugActionsMask &= ~mask;
7564 }
7565
7567 {
7569 {
7571 }
7572 else
7573 {
7575 }
7576 }
7577
7578
7580 {
7581 if (GetEconomyProfile())
7582 {
7583 float q_max = GetEconomyProfile().GetQuantityMax();
7584 if (q_max > 0)
7585 {
7586 float q_min = GetEconomyProfile().GetQuantityMin();
7587 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7588
7590 {
7591 ComponentEnergyManager comp = GetCompEM();
7593 {
7595 }
7596 }
7598 {
7600
7601 }
7602
7603 }
7604 }
7605 }
7606
7609 {
7610 EntityAI parent = GetHierarchyParent();
7611
7612 if (parent)
7613 {
7614 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7615 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7616 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7617 }
7618 }
7619
7622 {
7623 EntityAI parent = GetHierarchyParent();
7624
7625 if (parent)
7626 {
7627 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7628 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7629 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7630 }
7631 }
7632
7634 {
7635
7636
7637
7638
7640
7642 {
7643 if (ScriptInputUserData.CanStoreInputUserData())
7644 {
7645 ScriptInputUserData ctx = new ScriptInputUserData;
7651 ctx.
Write(use_stack_max);
7654
7656 {
7657 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7658 }
7659 }
7660 }
7661 else if (!
g_Game.IsMultiplayer())
7662 {
7664 }
7665 }
7666
7668 {
7670 }
7671
7673 {
7675 }
7676
7678 {
7680 }
7681
7683 {
7684
7685 return false;
7686 }
7687
7689 {
7690 return false;
7691 }
7692
7696 {
7697 return false;
7698 }
7699
7701 {
7702 return "";
7703 }
7704
7706
7708 {
7709 return false;
7710 }
7711
7713 {
7714 return true;
7715 }
7716
7717
7718
7720 {
7721 return true;
7722 }
7723
7725 {
7726 return true;
7727 }
7728
7730 {
7731 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7733 }
7734
7736 {
7738 }
7739
7741 {
7743 if (!is_being_placed)
7745 SetSynchDirty();
7746 }
7747
7748
7750
7752 {
7754 }
7755
7757 {
7759 }
7760
7762 {
7763 return 1;
7764 }
7765
7767 {
7768 return false;
7769 }
7770
7772 {
7774 SetSynchDirty();
7775 }
7776
7777
7778
7779
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
7812 {
7813 super.OnMovedInsideCargo(container);
7814
7815 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7816 }
7817
7818 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7819 {
7820 super.EEItemLocationChanged(oldLoc, newLoc);
7821
7822 PlayerBase newPlayer = null;
7823 PlayerBase oldPlayer = null;
7824
7825 if (newLoc.GetParent())
7826 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7827
7828 if (oldLoc.GetParent())
7829 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7830
7832 {
7833 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7834
7835 if (rIndex >= 0)
7836 {
7837 InventoryLocation rIl = new InventoryLocation;
7838 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7839
7840 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7843 {
7844 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7845 }
7847 {
7849 }
7850
7851 }
7852 }
7853
7855 {
7856 if (newPlayer)
7857 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7858
7859 if (newPlayer == oldPlayer)
7860 {
7861 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7862 {
7864 {
7865 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7866 {
7867 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7868 }
7869 }
7870 else
7871 {
7872 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7873 }
7874 }
7875
7876 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7877 {
7878 int type = oldLoc.GetType();
7880 {
7881 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7882 }
7884 {
7885 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7886 }
7887 }
7888 if (!m_OldLocation)
7889 {
7890 m_OldLocation = new InventoryLocation;
7891 }
7892 m_OldLocation.Copy(oldLoc);
7893 }
7894 else
7895 {
7896 if (m_OldLocation)
7897 {
7898 m_OldLocation.Reset();
7899 }
7900 }
7901
7902 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7903 }
7904 else
7905 {
7906 if (newPlayer)
7907 {
7908 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7909 if (resIndex >= 0)
7910 {
7911 InventoryLocation il = new InventoryLocation;
7912 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7914 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7917 {
7918 il.
GetParent().GetOnReleaseLock().Invoke(it);
7919 }
7921 {
7923 }
7924
7925 }
7926 }
7928 {
7929
7931 }
7932
7933 if (m_OldLocation)
7934 {
7935 m_OldLocation.Reset();
7936 }
7937 }
7938
7940 {
7941 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7942 }
7943
7945 {
7946 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7947 }
7948 }
7949
7950 override void EOnContact(IEntity other, Contact extra)
7951 {
7953 {
7954 int liquidType = -1;
7956 if (impactSpeed > 0.0)
7957 {
7959 #ifndef SERVER
7961 #else
7963 SetSynchDirty();
7964 #endif
7966 }
7967 }
7968
7969 #ifdef SERVER
7970 if (GetCompEM() && GetCompEM().IsPlugged())
7971 {
7972 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7973 GetCompEM().UnplugThis();
7974 }
7975 #endif
7976 }
7977
7979
7981 {
7983 }
7984
7986 {
7987
7988 }
7989
7991 {
7992 super.OnItemLocationChanged(old_owner, new_owner);
7993
7994 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7995 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7996
7997 if (!relatedPlayer && playerNew)
7998 relatedPlayer = playerNew;
7999
8000 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8001 {
8003 if (actionMgr)
8004 {
8005 ActionBase currentAction = actionMgr.GetRunningAction();
8006 if (currentAction)
8008 }
8009 }
8010
8011 Man ownerPlayerOld = null;
8012 Man ownerPlayerNew = null;
8013
8014 if (old_owner)
8015 {
8016 if (old_owner.
IsMan())
8017 {
8018 ownerPlayerOld = Man.Cast(old_owner);
8019 }
8020 else
8021 {
8022 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8023 }
8024 }
8025 else
8026 {
8028 {
8030
8031 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8032 {
8033 GetCompEM().UnplugThis();
8034 }
8035 }
8036 }
8037
8038 if (new_owner)
8039 {
8040 if (new_owner.
IsMan())
8041 {
8042 ownerPlayerNew = Man.Cast(new_owner);
8043 }
8044 else
8045 {
8046 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8047 }
8048 }
8049
8050 if (ownerPlayerOld != ownerPlayerNew)
8051 {
8052 if (ownerPlayerOld)
8053 {
8054 array<EntityAI> subItemsExit = new array<EntityAI>;
8056 for (int i = 0; i < subItemsExit.Count(); i++)
8057 {
8060 }
8061 }
8062
8063 if (ownerPlayerNew)
8064 {
8065 array<EntityAI> subItemsEnter = new array<EntityAI>;
8067 for (int j = 0; j < subItemsEnter.Count(); j++)
8068 {
8071 }
8072 }
8073 }
8074 else if (ownerPlayerNew != null)
8075 {
8076 PlayerBase nplayer;
8077 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8078 {
8079 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8081 for (int k = 0; k < subItemsUpdate.Count(); k++)
8082 {
8084 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8085 }
8086 }
8087 }
8088
8089 if (old_owner)
8090 old_owner.OnChildItemRemoved(this);
8091 if (new_owner)
8092 new_owner.OnChildItemReceived(this);
8093 }
8094
8095
8097 {
8098 super.EEDelete(parent);
8099 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8100 if (player)
8101 {
8103
8104 if (player.IsAlive())
8105 {
8106 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8107 if (r_index >= 0)
8108 {
8109 InventoryLocation r_il = new InventoryLocation;
8110 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8111
8112 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8115 {
8116 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8117 }
8119 {
8120 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8121 }
8122
8123 }
8124
8125 player.RemoveQuickBarEntityShortcut(this);
8126 }
8127 }
8128 }
8129
8131 {
8132 super.EEKilled(killer);
8133
8136 {
8137 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8138 {
8139 if (IsMagazine())
8140 {
8141 if (Magazine.Cast(this).GetAmmoCount() > 0)
8142 {
8144 }
8145 }
8146 else
8147 {
8149 }
8150 }
8151 }
8152 }
8153
8155 {
8156 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8157
8158 super.OnWasAttached(parent, slot_id);
8159
8162
8165 }
8166
8168 {
8169 super.OnWasDetached(parent, slot_id);
8170
8173
8176 }
8177
8179 {
8180 int idx;
8183
8184 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8185 if (inventory_slots.Count() < 1)
8186 {
8187 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8188 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8189 }
8190 else
8191 {
8192 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8193 }
8194
8195 idx = inventory_slots.Find(slot);
8196 if (idx < 0)
8197 return "";
8198
8199 return attach_types.Get(idx);
8200 }
8201
8203 {
8204 int idx = -1;
8205 string slot;
8206
8209
8210 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8211 if (inventory_slots.Count() < 1)
8212 {
8213 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8214 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8215 }
8216 else
8217 {
8218 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8219 if (detach_types.Count() < 1)
8220 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8221 }
8222
8223 for (int i = 0; i < inventory_slots.Count(); i++)
8224 {
8225 slot = inventory_slots.Get(i);
8226 }
8227
8228 if (slot != "")
8229 {
8230 if (detach_types.Count() == 1)
8231 idx = 0;
8232 else
8233 idx = inventory_slots.Find(slot);
8234 }
8235 if (idx < 0)
8236 return "";
8237
8238 return detach_types.Get(idx);
8239 }
8240
8242 {
8243
8245
8246
8247 float min_time = 1;
8248 float max_time = 3;
8249 float delay = Math.RandomFloat(min_time, max_time);
8250
8251 explode_timer.Run(delay, this, "DoAmmoExplosion");
8252 }
8253
8255 {
8256 Magazine magazine = Magazine.Cast(this);
8257 int pop_sounds_count = 6;
8258 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8259
8260
8261 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8262 string sound_name = pop_sounds[ sound_idx ];
8263 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8264
8265
8266 magazine.ServerAddAmmoCount(-1);
8267
8268
8269 float min_temp_to_explode = 100;
8270
8271 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8272 {
8274 }
8275 }
8276
8277
8278 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8279 {
8280 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8281
8282 const int CHANCE_DAMAGE_CARGO = 4;
8283 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8284 const int CHANCE_DAMAGE_NOTHING = 2;
8285
8287 {
8288 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8289 int chances;
8290 int rnd;
8291
8292 if (GetInventory().GetCargo())
8293 {
8294 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8295 rnd = Math.RandomInt(0,chances);
8296
8297 if (rnd < CHANCE_DAMAGE_CARGO)
8298 {
8300 }
8301 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8302 {
8304 }
8305 }
8306 else
8307 {
8308 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8309 rnd = Math.RandomInt(0,chances);
8310
8311 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8312 {
8314 }
8315 }
8316 }
8317 }
8318
8320 {
8321 CargoBase cargo = GetInventory().GetCargo();
8322 if (cargo)
8323 {
8325 if (item_count > 0)
8326 {
8327 int random_pick = Math.RandomInt(0, item_count);
8329 if (!item.IsExplosive())
8330 {
8331 item.AddHealth("","",damage);
8332 return true;
8333 }
8334 }
8335 }
8336 return false;
8337 }
8338
8340 {
8341 GameInventory inventory = GetInventory();
8343 if (attachment_count > 0)
8344 {
8345 int random_pick = Math.RandomInt(0, attachment_count);
8347 if (!attachment.IsExplosive())
8348 {
8349 attachment.AddHealth("","",damage);
8350 return true;
8351 }
8352 }
8353 return false;
8354 }
8355
8357 {
8359 }
8360
8362 {
8364 return GetInventory().CanRemoveEntity();
8365
8366 return false;
8367 }
8368
8370 {
8371
8373 return false;
8374
8375
8377 return false;
8378
8379
8380
8382 if (delta == 0)
8383 return false;
8384
8385
8386 return true;
8387 }
8388
8390 {
8392 {
8393 if (ScriptInputUserData.CanStoreInputUserData())
8394 {
8395 ScriptInputUserData ctx = new ScriptInputUserData;
8400 ctx.
Write(destination_entity);
8404 }
8405 }
8406 else if (!
g_Game.IsMultiplayer())
8407 {
8409 }
8410 }
8411
8413 {
8414 float split_quantity_new;
8418 InventoryLocation loc = new InventoryLocation;
8419
8420 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8421 {
8423 split_quantity_new = stack_max;
8424 else
8426
8428 {
8429 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8430 if (new_item)
8431 {
8432 new_item.SetResultOfSplit(true);
8433 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8435 new_item.
SetQuantity(split_quantity_new,
false,
true);
8436 }
8437 }
8438 }
8439 else if (destination_entity && slot_id == -1)
8440 {
8441 if (quantity > stack_max)
8442 split_quantity_new = stack_max;
8443 else
8444 split_quantity_new = quantity;
8445
8447 {
8448 GameInventory destinationInventory = destination_entity.GetInventory();
8450 {
8453 }
8454
8455 if (new_item)
8456 {
8457 new_item.SetResultOfSplit(true);
8458 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8460 new_item.
SetQuantity(split_quantity_new,
false,
true);
8461 }
8462 }
8463 }
8464 else
8465 {
8466 if (stack_max != 0)
8467 {
8469 {
8471 }
8472
8473 if (split_quantity_new == 0)
8474 {
8475 if (!
g_Game.IsMultiplayer())
8476 player.PhysicalPredictiveDropItem(this);
8477 else
8478 player.ServerDropEntity(this);
8479 return;
8480 }
8481
8483 {
8485
8486 if (new_item)
8487 {
8488 new_item.SetResultOfSplit(true);
8489 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8492 new_item.PlaceOnSurface();
8493 }
8494 }
8495 }
8496 }
8497 }
8498
8500 {
8501 float split_quantity_new;
8505 InventoryLocation loc = new InventoryLocation;
8506
8507 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8508 {
8510 split_quantity_new = stack_max;
8511 else
8513
8515 {
8516 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8517 if (new_item)
8518 {
8519 new_item.SetResultOfSplit(true);
8520 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8522 new_item.
SetQuantity(split_quantity_new,
false,
true);
8523 }
8524 }
8525 }
8526 else if (destination_entity && slot_id == -1)
8527 {
8528 if (quantity > stack_max)
8529 split_quantity_new = stack_max;
8530 else
8531 split_quantity_new = quantity;
8532
8534 {
8535 GameInventory destinationInventory = destination_entity.GetInventory();
8537 {
8540 }
8541
8542 if (new_item)
8543 {
8544 new_item.SetResultOfSplit(true);
8545 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8547 new_item.
SetQuantity(split_quantity_new,
false,
true);
8548 }
8549 }
8550 }
8551 else
8552 {
8553 if (stack_max != 0)
8554 {
8556 {
8558 }
8559
8561 {
8563
8564 if (new_item)
8565 {
8566 new_item.SetResultOfSplit(true);
8567 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8570 new_item.PlaceOnSurface();
8571 }
8572 }
8573 }
8574 }
8575 }
8576
8578 {
8580 {
8581 if (ScriptInputUserData.CanStoreInputUserData())
8582 {
8583 ScriptInputUserData ctx = new ScriptInputUserData;
8588 dst.WriteToContext(ctx);
8590 }
8591 }
8592 else if (!
g_Game.IsMultiplayer())
8593 {
8595 }
8596 }
8597
8599 {
8601 {
8602 if (ScriptInputUserData.CanStoreInputUserData())
8603 {
8604 ScriptInputUserData ctx = new ScriptInputUserData;
8609 ctx.
Write(destination_entity);
8615 }
8616 }
8617 else if (!
g_Game.IsMultiplayer())
8618 {
8620 }
8621 }
8622
8624 {
8626 }
8627
8629 {
8631 float split_quantity_new;
8633 if (dst.IsValid())
8634 {
8635 int slot_id = dst.GetSlot();
8637
8638 if (quantity > stack_max)
8639 split_quantity_new = stack_max;
8640 else
8641 split_quantity_new = quantity;
8642
8644 {
8646
8647 if (new_item)
8648 {
8649 new_item.SetResultOfSplit(true);
8650 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8652 new_item.
SetQuantity(split_quantity_new,
false,
true);
8653 }
8654
8655 return new_item;
8656 }
8657 }
8658
8659 return null;
8660 }
8661
8663 {
8665 float split_quantity_new;
8667 if (destination_entity)
8668 {
8670 if (quantity > stackable)
8671 split_quantity_new = stackable;
8672 else
8673 split_quantity_new = quantity;
8674
8676 {
8677 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8678 if (new_item)
8679 {
8680 new_item.SetResultOfSplit(true);
8681 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8683 new_item.
SetQuantity(split_quantity_new,
false,
true);
8684 }
8685 }
8686 }
8687 }
8688
8690 {
8692 {
8693 if (ScriptInputUserData.CanStoreInputUserData())
8694 {
8695 ScriptInputUserData ctx = new ScriptInputUserData;
8700 ItemBase destination_entity =
this;
8701 ctx.
Write(destination_entity);
8705 }
8706 }
8707 else if (!
g_Game.IsMultiplayer())
8708 {
8710 }
8711 }
8712
8714 {
8716 float split_quantity_new;
8718 if (player)
8719 {
8721 if (quantity > stackable)
8722 split_quantity_new = stackable;
8723 else
8724 split_quantity_new = quantity;
8725
8727 {
8728 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8729 new_item =
ItemBase.Cast(in_hands);
8730 if (new_item)
8731 {
8732 new_item.SetResultOfSplit(true);
8733 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8735 new_item.SetQuantity(split_quantity_new, false, true);
8736 }
8737 }
8738 }
8739 }
8740
8742 {
8744 float split_quantity_new = Math.Floor(quantity * 0.5);
8745
8747 return;
8748
8750
8751 if (new_item)
8752 {
8753 if (new_item.GetQuantityMax() < split_quantity_new)
8754 {
8755 split_quantity_new = new_item.GetQuantityMax();
8756 }
8757
8758 new_item.SetResultOfSplit(true);
8759 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8760
8762 {
8765 }
8766 else
8767 {
8769 new_item.
SetQuantity(split_quantity_new,
false,
true);
8770 }
8771 }
8772 }
8773
8775 {
8777 float split_quantity_new = Math.Floor(quantity / 2);
8778
8780 return;
8781
8782 InventoryLocation invloc = new InventoryLocation;
8784
8786 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8787
8788 if (new_item)
8789 {
8790 if (new_item.GetQuantityMax() < split_quantity_new)
8791 {
8792 split_quantity_new = new_item.GetQuantityMax();
8793 }
8795 {
8798 }
8799 else if (split_quantity_new > 1)
8800 {
8802 new_item.
SetQuantity(split_quantity_new,
false,
true);
8803 }
8804 }
8805 }
8806
8809 {
8810 SetWeightDirty();
8812
8813 if (parent)
8814 parent.OnAttachmentQuantityChangedEx(this, delta);
8815
8817 {
8819 {
8821 }
8823 {
8824 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8826 }
8827 }
8828 }
8829
8832 {
8833
8834 }
8835
8838 {
8840 }
8841
8843 {
8844 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8845
8847 {
8848 if (newLevel == GameConstants.STATE_RUINED)
8849 {
8851 EntityAI parent = GetHierarchyParent();
8852 if (parent && parent.IsFireplace())
8853 {
8854 CargoBase cargo = GetInventory().GetCargo();
8855 if (cargo)
8856 {
8858 {
8860 }
8861 }
8862 }
8863 }
8864
8866 {
8867
8869 return;
8870 }
8871
8872 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8873 {
8875 }
8876 }
8877 }
8878
8879
8881 {
8882 super.OnRightClick();
8883
8885 {
8887 {
8888 if (ScriptInputUserData.CanStoreInputUserData())
8889 {
8890 EntityAI root = GetHierarchyRoot();
8891 Man playerOwner = GetHierarchyRootPlayer();
8892 InventoryLocation dst = new InventoryLocation;
8893
8894
8895 if (!playerOwner && root && root == this)
8896 {
8898 }
8899 else
8900 {
8901
8902 GetInventory().GetCurrentInventoryLocation(dst);
8904 {
8905 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8907 {
8909 }
8910 else
8911 {
8913
8914
8915 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8916 {
8918 }
8919 else
8920 {
8921 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8922 }
8923 }
8924 }
8925 }
8926
8927 ScriptInputUserData ctx = new ScriptInputUserData;
8935 }
8936 }
8937 else if (!
g_Game.IsMultiplayer())
8938 {
8940 }
8941 }
8942 }
8943
8945 {
8946 if (root)
8947 {
8948 vector m4[4];
8949 root.GetTransform(m4);
8950 dst.SetGround(this, m4);
8951 }
8952 else
8953 {
8954 GetInventory().GetCurrentInventoryLocation(dst);
8955 }
8956 }
8957
8958 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8959 {
8960
8961 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8962 return false;
8963
8964 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8965 return false;
8966
8967
8969 return false;
8970
8971
8972 Magazine mag = Magazine.Cast(this);
8973 if (mag)
8974 {
8975 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8976 return false;
8977
8978 if (stack_max_limit)
8979 {
8980 Magazine other_mag = Magazine.Cast(other_item);
8981 if (other_item)
8982 {
8983 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8984 return false;
8985 }
8986
8987 }
8988 }
8989 else
8990 {
8991
8993 return false;
8994
8996 return false;
8997 }
8998
8999 PlayerBase player = null;
9000 if (CastTo(player, GetHierarchyRootPlayer()))
9001 {
9002 if (player.GetInventory().HasAttachment(this))
9003 return false;
9004
9005 if (player.IsItemsToDelete())
9006 return false;
9007 }
9008
9009 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9010 return false;
9011
9012 int slotID;
9014 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9015 return false;
9016
9017 return true;
9018 }
9019
9021 {
9023 }
9024
9026 {
9027 return m_IsResultOfSplit;
9028 }
9029
9031 {
9032 m_IsResultOfSplit = value;
9033 }
9034
9036 {
9038 }
9039
9041 {
9042 float other_item_quantity = other_item.GetQuantity();
9043 float this_free_space;
9044
9046
9048
9049 if (other_item_quantity > this_free_space)
9050 {
9051 return this_free_space;
9052 }
9053 else
9054 {
9055 return other_item_quantity;
9056 }
9057 }
9058
9060 {
9062 }
9063
9065 {
9067 return;
9068
9069 if (!IsMagazine() && other_item)
9070 {
9072 if (quantity_used != 0)
9073 {
9074 float hp1 = GetHealth01("","");
9075 float hp2 = other_item.GetHealth01("","");
9076 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9077 hpResult = hpResult / (
GetQuantity() + quantity_used);
9078
9079 hpResult *= GetMaxHealth();
9080 Math.Round(hpResult);
9081 SetHealth("", "Health", hpResult);
9082
9084 other_item.AddQuantity(-quantity_used);
9085 }
9086 }
9088 }
9089
9091 {
9092 #ifdef SERVER
9093 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9094 GetHierarchyParent().IncreaseLifetimeUp();
9095 #endif
9096 };
9097
9099 {
9100 PlayerBase p = PlayerBase.Cast(player);
9101
9102 array<int> recipesIds = p.m_Recipes;
9103 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9104 if (moduleRecipesManager)
9105 {
9106 EntityAI itemInHands = player.GetEntityInHands();
9107 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9108 }
9109
9110 for (int i = 0;i < recipesIds.Count(); i++)
9111 {
9112 int key = recipesIds.Get(i);
9113 string recipeName = moduleRecipesManager.GetRecipeName(key);
9115 }
9116 }
9117
9118
9119 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9120 {
9121 super.GetDebugActions(outputList);
9122
9123
9129
9130
9135
9140
9141
9145
9146
9148 {
9152 }
9153
9156
9157
9161
9163
9164 InventoryLocation loc = new InventoryLocation();
9165 GetInventory().GetCurrentInventoryLocation(loc);
9167 {
9168 if (Gizmo_IsSupported())
9171 }
9172
9174 }
9175
9176
9177
9178
9180 {
9181 super.OnAction(action_id, player, ctx);
9182
9184 {
9185 switch (action_id)
9186 {
9190 return true;
9194 return true;
9195 }
9196 }
9197
9199 {
9200 switch (action_id)
9201 {
9203 Delete();
9204 return true;
9205 }
9206 }
9207
9208 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9209 {
9210 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9211 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9212 PlayerBase p = PlayerBase.Cast(player);
9213 if (
EActions.RECIPES_RANGE_START < 1000)
9214 {
9215 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9216 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9217 }
9218 }
9219 #ifndef SERVER
9220 else if (action_id ==
EActions.WATCH_PLAYER)
9221 {
9222 PluginDeveloper.SetDeveloperItemClientEx(player);
9223 }
9224 #endif
9226 {
9227 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9228 {
9229 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9230 OnDebugButtonPressServer(id + 1);
9231 }
9232
9233 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9234 {
9235 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9237 }
9238
9239 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9240 {
9241 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9243 }
9244
9245 else if (action_id ==
EActions.ADD_QUANTITY)
9246 {
9247 if (IsMagazine())
9248 {
9249 Magazine mag = Magazine.Cast(this);
9250 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9251 }
9252 else
9253 {
9255 }
9256
9257 if (m_EM)
9258 {
9259 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9260 }
9261
9262 }
9263
9264 else if (action_id ==
EActions.REMOVE_QUANTITY)
9265 {
9266 if (IsMagazine())
9267 {
9268 Magazine mag2 = Magazine.Cast(this);
9269 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9270 }
9271 else
9272 {
9274 }
9275 if (m_EM)
9276 {
9277 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9278 }
9279
9280 }
9281
9282 else if (action_id ==
EActions.SET_QUANTITY_0)
9283 {
9285
9286 if (m_EM)
9287 {
9288 m_EM.SetEnergy(0);
9289 }
9290 }
9291
9292 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9293 {
9295
9296 if (m_EM)
9297 {
9298 m_EM.SetEnergy(m_EM.GetEnergyMax());
9299 }
9300 }
9301
9302 else if (action_id ==
EActions.ADD_HEALTH)
9303 {
9304 AddHealth("","",GetMaxHealth("","Health")/5);
9305 }
9306 else if (action_id ==
EActions.REMOVE_HEALTH)
9307 {
9308 AddHealth("","",-GetMaxHealth("","Health")/5);
9309 }
9310 else if (action_id ==
EActions.DESTROY_HEALTH)
9311 {
9312 SetHealth01("","",0);
9313 }
9314 else if (action_id ==
EActions.WATCH_ITEM)
9315 {
9317 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9318 #ifdef DEVELOPER
9319 SetDebugDeveloper_item(this);
9320 #endif
9321 }
9322
9323 else if (action_id ==
EActions.ADD_TEMPERATURE)
9324 {
9325 AddTemperature(20);
9326
9327 }
9328
9329 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9330 {
9331 AddTemperature(-20);
9332
9333 }
9334
9335 else if (action_id ==
EActions.FLIP_FROZEN)
9336 {
9337 SetFrozen(!GetIsFrozen());
9338
9339 }
9340
9341 else if (action_id ==
EActions.ADD_WETNESS)
9342 {
9344
9345 }
9346
9347 else if (action_id ==
EActions.REMOVE_WETNESS)
9348 {
9350
9351 }
9352
9353 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9354 {
9357
9358
9359 }
9360
9361 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9362 {
9365 }
9366
9367 else if (action_id ==
EActions.MAKE_SPECIAL)
9368 {
9369 auto debugParams = DebugSpawnParams.WithPlayer(player);
9370 OnDebugSpawnEx(debugParams);
9371 }
9372
9373 }
9374
9375
9376 return false;
9377 }
9378
9379
9380
9381
9385
9388
9389
9390
9392 {
9393 return false;
9394 }
9395
9396
9398 {
9399 return true;
9400 }
9401
9402
9404 {
9405 return true;
9406 }
9407
9408
9409
9411 {
9412 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9413 return g_Game.ConfigIsExisting(config_path);
9414 }
9415
9418 {
9419 return null;
9420 }
9421
9423 {
9424 return false;
9425 }
9426
9428 {
9429 return false;
9430 }
9431
9435
9436
9438 {
9439 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9440 return module_repairing.CanRepair(this, item_repair_kit);
9441 }
9442
9443
9444 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9445 {
9446 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9447 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9448 }
9449
9450
9452 {
9453
9454
9455
9456
9457
9458
9459
9460
9461 return 1;
9462 }
9463
9464
9465
9467 {
9469 }
9470
9471
9472
9474 {
9476 }
9477
9478
9487 {
9488 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9489
9490 if (player)
9491 {
9492 player.MessageStatus(text);
9493 }
9494 }
9495
9496
9505 {
9506 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9507
9508 if (player)
9509 {
9510 player.MessageAction(text);
9511 }
9512 }
9513
9514
9523 {
9524 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9525
9526 if (player)
9527 {
9528 player.MessageFriendly(text);
9529 }
9530 }
9531
9532
9541 {
9542 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9543
9544 if (player)
9545 {
9546 player.MessageImportant(text);
9547 }
9548 }
9549
9551 {
9552 return true;
9553 }
9554
9555
9556 override bool KindOf(
string tag)
9557 {
9558 bool found = false;
9559 string item_name = this.
GetType();
9561 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9562
9563 int array_size = item_tag_array.Count();
9564 for (int i = 0; i < array_size; i++)
9565 {
9566 if (item_tag_array.Get(i) == tag)
9567 {
9568 found = true;
9569 break;
9570 }
9571 }
9572 return found;
9573 }
9574
9575
9577 {
9578
9579 super.OnRPC(sender, rpc_type,ctx);
9580
9581
9582 switch (rpc_type)
9583 {
9584 #ifndef SERVER
9585 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9586 Param2<bool, string> p = new Param2<bool, string>(false, "");
9587
9589 return;
9590
9591 bool play = p.param1;
9592 string soundSet = p.param2;
9593
9594 if (play)
9595 {
9597 {
9599 {
9601 }
9602 }
9603 else
9604 {
9606 }
9607 }
9608 else
9609 {
9611 }
9612
9613 break;
9614 #endif
9615
9616 }
9617
9619 {
9621 }
9622 }
9623
9624
9625
9626
9628 {
9629 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9630 return plugin.GetID(
name);
9631 }
9632
9634 {
9635 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9636 return plugin.GetName(id);
9637 }
9638
9641 {
9642
9643
9644 int varFlags;
9645 if (!ctx.
Read(varFlags))
9646 return;
9647
9648 if (varFlags & ItemVariableFlags.FLOAT)
9649 {
9651 }
9652 }
9653
9655 {
9656
9657 super.SerializeNumericalVars(floats_out);
9658
9659
9660
9662 {
9664 }
9665
9667 {
9669 }
9670
9672 {
9674 }
9675
9677 {
9682 }
9683
9685 {
9687 }
9688 }
9689
9691 {
9692
9693 super.DeSerializeNumericalVars(floats);
9694
9695
9696 int index = 0;
9697 int mask = Math.Round(floats.Get(index));
9698
9699 index++;
9700
9702 {
9704 {
9706 }
9707 else
9708 {
9709 float quantity = floats.Get(index);
9711 }
9712 index++;
9713 }
9714
9716 {
9717 float wet = floats.Get(index);
9719 index++;
9720 }
9721
9723 {
9724 int liquidtype = Math.Round(floats.Get(index));
9726 index++;
9727 }
9728
9730 {
9732 index++;
9734 index++;
9736 index++;
9738 index++;
9739 }
9740
9742 {
9743 int cleanness = Math.Round(floats.Get(index));
9745 index++;
9746 }
9747 }
9748
9750 {
9751 super.WriteVarsToCTX(ctx);
9752
9753
9755 {
9757 }
9758
9760 {
9762 }
9763
9765 {
9767 }
9768
9770 {
9771 int r,g,b,a;
9777 }
9778
9780 {
9782 }
9783 }
9784
9786 {
9787 if (!super.ReadVarsFromCTX(ctx,version))
9788 return false;
9789
9790 int intValue;
9791 float value;
9792
9793 if (version < 140)
9794 {
9795 if (!ctx.
Read(intValue))
9796 return false;
9797
9798 m_VariablesMask = intValue;
9799 }
9800
9802 {
9803 if (!ctx.
Read(value))
9804 return false;
9805
9807 {
9809 }
9810 else
9811 {
9813 }
9814 }
9815
9816 if (version < 140)
9817 {
9819 {
9820 if (!ctx.
Read(value))
9821 return false;
9822 SetTemperatureDirect(value);
9823 }
9824 }
9825
9827 {
9828 if (!ctx.
Read(value))
9829 return false;
9831 }
9832
9834 {
9835 if (!ctx.
Read(intValue))
9836 return false;
9838 }
9839
9841 {
9842 int r,g,b,a;
9844 return false;
9846 return false;
9848 return false;
9850 return false;
9851
9853 }
9854
9856 {
9857 if (!ctx.
Read(intValue))
9858 return false;
9860 }
9861
9862 if (version >= 138 && version < 140)
9863 {
9865 {
9866 if (!ctx.
Read(intValue))
9867 return false;
9868 SetFrozen(intValue);
9869 }
9870 }
9871
9872 return true;
9873 }
9874
9875
9877 {
9880 {
9882 }
9883
9884 if (!super.OnStoreLoad(ctx, version))
9885 {
9887 return false;
9888 }
9889
9890 if (version >= 114)
9891 {
9892 bool hasQuickBarIndexSaved;
9893
9894 if (!ctx.
Read(hasQuickBarIndexSaved))
9895 {
9897 return false;
9898 }
9899
9900 if (hasQuickBarIndexSaved)
9901 {
9902 int itmQBIndex;
9903
9904
9905 if (!ctx.
Read(itmQBIndex))
9906 {
9908 return false;
9909 }
9910
9911 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9912 if (itmQBIndex != -1 && parentPlayer)
9913 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9914 }
9915 }
9916 else
9917 {
9918
9919 PlayerBase player;
9920 int itemQBIndex;
9921 if (version ==
int.
MAX)
9922 {
9923 if (!ctx.
Read(itemQBIndex))
9924 {
9926 return false;
9927 }
9928 }
9929 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9930 {
9931
9932 if (!ctx.
Read(itemQBIndex))
9933 {
9935 return false;
9936 }
9937 if (itemQBIndex != -1 && player)
9938 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9939 }
9940 }
9941
9942 if (version < 140)
9943 {
9944
9945 if (!LoadVariables(ctx, version))
9946 {
9948 return false;
9949 }
9950 }
9951
9952
9954 {
9956 return false;
9957 }
9958 if (version >= 132)
9959 {
9961 if (raib)
9962 {
9964 {
9966 return false;
9967 }
9968 }
9969 }
9970
9972 return true;
9973 }
9974
9975
9976
9978 {
9979 super.OnStoreSave(ctx);
9980
9981 PlayerBase player;
9982 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9983 {
9985
9986 int itemQBIndex = -1;
9987 itemQBIndex = player.FindQuickBarEntityIndex(this);
9988 ctx.
Write(itemQBIndex);
9989 }
9990 else
9991 {
9993 }
9994
9996
9998 if (raib)
9999 {
10001 }
10002 }
10003
10004
10006 {
10007 super.AfterStoreLoad();
10008
10010 {
10012 }
10013
10015 {
10018 }
10019 }
10020
10022 {
10023 super.EEOnAfterLoad();
10024
10026 {
10028 }
10029
10032 }
10033
10035 {
10036 return false;
10037 }
10038
10039
10040
10042 {
10044 {
10045 #ifdef PLATFORM_CONSOLE
10046
10048 {
10050 if (menu)
10051 {
10053 }
10054 }
10055 #endif
10056 }
10057
10059 {
10062 }
10063
10065 {
10066 SetWeightDirty();
10068 }
10070 {
10073 }
10074
10076 {
10079
10082 }
10084 {
10088 }
10089
10090 super.OnVariablesSynchronized();
10091 }
10092
10093
10094
10096 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10097 {
10098 if (!IsServerCheck(allow_client))
10099 return false;
10100
10102 return false;
10103
10106
10107 if (value <= (min + 0.001))
10108 value = min;
10109
10110 if (value == min)
10111 {
10112 if (destroy_config)
10113 {
10114 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10115 if (dstr)
10116 {
10118 this.Delete();
10119 return true;
10120 }
10121 }
10122 else if (destroy_forced)
10123 {
10125 this.Delete();
10126 return true;
10127 }
10128
10130 }
10131
10134
10136 {
10137 EntityAI parent = GetHierarchyRoot();
10138 InventoryLocation iLoc = new InventoryLocation();
10139 GetInventory().GetCurrentInventoryLocation(iLoc);
10141 {
10142 int iLocSlot = iLoc.
GetSlot();
10144 {
10146 }
10148 {
10150 }
10151 }
10152 }
10153
10155 {
10157
10158 if (delta)
10160 }
10161
10163
10164 return false;
10165 }
10166
10167
10169 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10170 {
10172 }
10173
10175 {
10178 }
10179
10181 {
10184 }
10185
10187 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10188 {
10189 float value_clamped = Math.Clamp(value, 0, 1);
10191 SetQuantity(result, destroy_config, destroy_forced);
10192 }
10193
10194
10197 {
10199 }
10200
10202 {
10204 }
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10216 {
10217 int slot = -1;
10218 GameInventory inventory = GetInventory();
10219 if (inventory)
10220 {
10221 InventoryLocation il = new InventoryLocation;
10224 }
10225
10227 }
10228
10230 {
10231 float quantity_max = 0;
10232
10234 {
10235 if (attSlotID != -1)
10236 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10237
10238 if (quantity_max <= 0)
10240 }
10241
10242 if (quantity_max <= 0)
10244
10245 return quantity_max;
10246 }
10247
10249 {
10251 }
10252
10254 {
10256 }
10257
10258
10260 {
10262 }
10263
10265 {
10267 }
10268
10270 {
10272 }
10273
10274
10276 {
10277
10278 float weightEx = GetWeightEx();
10279 float special = GetInventoryAndCargoWeight();
10280 return weightEx - special;
10281 }
10282
10283
10285 {
10287 }
10288
10290 {
10292 {
10293 #ifdef DEVELOPER
10294 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10295 {
10296 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10298 }
10299 #endif
10300
10301 return GetQuantity() * GetConfigWeightModified();
10302 }
10303 else if (HasEnergyManager())
10304 {
10305 #ifdef DEVELOPER
10306 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10307 {
10308 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10309 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10310 }
10311 #endif
10312 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10313 }
10314 else
10315 {
10316 #ifdef DEVELOPER
10317 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10318 {
10319 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10320 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10321 }
10322 #endif
10323 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10324 }
10325 }
10326
10329 {
10330 int item_count = 0;
10332
10333 GameInventory inventory = GetInventory();
10334 CargoBase cargo = inventory.
GetCargo();
10335 if (cargo != NULL)
10336 {
10338 }
10339
10341 for (int i = 0; i < nAttachments; ++i)
10342 {
10344 if (item)
10345 item_count += item.GetNumberOfItems();
10346 }
10347 return item_count;
10348 }
10349
10352 {
10353 float weight = 0;
10354 float wetness = 1;
10355 if (include_wetness)
10358 {
10359 weight = wetness * m_ConfigWeight;
10360 }
10362 {
10363 weight = 1;
10364 }
10365 return weight;
10366 }
10367
10368
10369
10371 {
10372 GameInventory inventory = GetInventory();
10373 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10374 {
10375 array<EntityAI> items = new array<EntityAI>;
10377 for (int i = 0; i < items.Count(); ++i)
10378 {
10380 if (item)
10381 {
10382 g_Game.ObjectDelete(item);
10383 }
10384 }
10385 }
10386 }
10387
10388
10389
10390
10392 {
10393 float energy = 0;
10394 if (HasEnergyManager())
10395 {
10396 energy = GetCompEM().GetEnergy();
10397 }
10398 return energy;
10399 }
10400
10401
10403 {
10404 super.OnEnergyConsumed();
10405
10407 }
10408
10410 {
10411 super.OnEnergyAdded();
10412
10414 }
10415
10416
10418 {
10419 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10420 {
10422 {
10423 float energy_0to1 = GetCompEM().GetEnergy0To1();
10425 }
10426 }
10427 }
10428
10429
10431 {
10432 return ConfigGetFloat("heatIsolation");
10433 }
10434
10436 {
10438 }
10439
10441 {
10442 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10443 if (
g_Game.ConfigIsExisting(paramPath))
10444 return g_Game.ConfigGetFloat(paramPath);
10445
10446 return 0.0;
10447 }
10448
10450 {
10451 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10452 if (
g_Game.ConfigIsExisting(paramPath))
10453 return g_Game.ConfigGetFloat(paramPath);
10454
10455 return 0.0;
10456 }
10457
10458 override void SetWet(
float value,
bool allow_client =
false)
10459 {
10460 if (!IsServerCheck(allow_client))
10461 return;
10462
10465
10467
10468 m_VarWet = Math.Clamp(value, min, max);
10469
10471 {
10474 }
10475 }
10476
10477 override void AddWet(
float value)
10478 {
10480 }
10481
10483 {
10485 }
10486
10488 {
10490 }
10491
10493 {
10495 }
10496
10498 {
10500 }
10501
10503 {
10505 }
10506
10507 override void OnWetChanged(
float newVal,
float oldVal)
10508 {
10511 if (newLevel != oldLevel)
10512 {
10514 }
10515 }
10516
10518 {
10519 SetWeightDirty();
10520 }
10521
10523 {
10524 return GetWetLevelInternal(
m_VarWet);
10525 }
10526
10527
10528
10530 {
10532 }
10533
10535 {
10537 }
10538
10540 {
10542 }
10543
10545 {
10547 }
10548
10549
10550
10552 {
10553 if (ConfigIsExisting("itemModelLength"))
10554 {
10555 return ConfigGetFloat("itemModelLength");
10556 }
10557 return 0;
10558 }
10559
10561 {
10562 if (ConfigIsExisting("itemAttachOffset"))
10563 {
10564 return ConfigGetFloat("itemAttachOffset");
10565 }
10566 return 0;
10567 }
10568
10569 override void SetCleanness(
int value,
bool allow_client =
false)
10570 {
10571 if (!IsServerCheck(allow_client))
10572 return;
10573
10575
10577
10580 }
10581
10583 {
10585 }
10586
10588 {
10589 return true;
10590 }
10591
10592
10593
10594
10596 {
10598 }
10599
10601 {
10603 }
10604
10605
10606
10607
10608 override void SetColor(
int r,
int g,
int b,
int a)
10609 {
10615 }
10617 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10618 {
10623 }
10624
10626 {
10628 }
10629
10632 {
10633 int r,g,b,a;
10635 r = r/255;
10636 g = g/255;
10637 b = b/255;
10638 a = a/255;
10639 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10640 }
10641
10642
10643
10644 override void SetLiquidType(
int value,
bool allow_client =
false)
10645 {
10646 if (!IsServerCheck(allow_client))
10647 return;
10648
10653 }
10654
10656 {
10657 return ConfigGetInt("varLiquidTypeInit");
10658 }
10659
10661 {
10663 }
10664
10666 {
10668 SetFrozen(false);
10669 }
10670
10673 {
10674 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10675 }
10676
10677
10680 {
10681 PlayerBase nplayer;
10682 if (PlayerBase.CastTo(nplayer, player))
10683 {
10685 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10686 }
10687 }
10688
10689
10692 {
10693 PlayerBase nplayer;
10694 if (PlayerBase.CastTo(nplayer,player))
10695 {
10696 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10697 }
10698
10699 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10700
10701 if (HasEnergyManager())
10702 {
10703 GetCompEM().UpdatePlugState();
10704 }
10705 }
10706
10707
10709 {
10710 super.OnPlacementStarted(player);
10711
10713 }
10714
10715 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10716 {
10718 {
10719 m_AdminLog.OnPlacementComplete(player,
this);
10720 }
10721
10722 super.OnPlacementComplete(player, position, orientation);
10723 }
10724
10725
10726
10727
10728
10730 {
10732 {
10733 return true;
10734 }
10735 else
10736 {
10737 return false;
10738 }
10739 }
10740
10741
10743 {
10745 {
10747 }
10748 }
10749
10750
10752 {
10754 }
10755
10757 {
10759 }
10760
10761 override void InsertAgent(
int agent,
float count = 1)
10762 {
10763 if (count < 1)
10764 return;
10765
10767 }
10768
10771 {
10773 }
10774
10775
10777 {
10779 }
10780
10781
10782
10783
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
10823 {
10825 return false;
10826 return true;
10827 }
10828
10830 {
10831
10833 }
10834
10835
10838 {
10839 super.CheckForRoofLimited(timeTresholdMS);
10840
10841 float time =
g_Game.GetTime();
10842 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10843 {
10844 m_PreviousRoofTestTime = time;
10845 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10846 }
10847 }
10848
10849
10851 {
10853 {
10854 return 0;
10855 }
10856
10857 if (GetInventory().GetAttachmentSlotsCount() != 0)
10858 {
10859 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10860 if (filter)
10861 return filter.GetProtectionLevel(type, false, system);
10862 else
10863 return 0;
10864 }
10865
10866 string subclassPath, entryName;
10867
10868 switch (type)
10869 {
10871 entryName = "biological";
10872 break;
10874 entryName = "chemical";
10875 break;
10876 default:
10877 entryName = "biological";
10878 break;
10879 }
10880
10881 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10882
10883 return g_Game.ConfigGetFloat(subclassPath + entryName);
10884 }
10885
10886
10887
10890 {
10891 if (!IsMagazine())
10893
10895 }
10896
10897
10898
10899
10900
10905 {
10906 return true;
10907 }
10908
10910 {
10912 }
10913
10914
10915
10916
10917
10919 {
10920 if (parent)
10921 {
10922 if (parent.IsInherited(DayZInfected))
10923 return true;
10924
10925 if (!parent.IsRuined())
10926 return true;
10927 }
10928
10929 return true;
10930 }
10931
10933 {
10934 if (!super.CanPutAsAttachment(parent))
10935 {
10936 return false;
10937 }
10938
10939 if (!IsRuined() && !parent.IsRuined())
10940 {
10941 return true;
10942 }
10943
10944 return false;
10945 }
10946
10948 {
10949
10950
10951
10952
10953 return super.CanReceiveItemIntoCargo(item);
10954 }
10955
10957 {
10958
10959
10960
10961
10962 GameInventory attachmentInv = attachment.GetInventory();
10964 {
10965 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10966 return false;
10967 }
10968
10969 InventoryLocation loc = new InventoryLocation();
10970 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10971 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10972 return false;
10973
10974 return super.CanReceiveAttachment(attachment, slotId);
10975 }
10976
10978 {
10979 if (!super.CanReleaseAttachment(attachment))
10980 return false;
10981
10982 return GetInventory().AreChildrenAccessible();
10983 }
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11006 {
11007 int id = muzzle_owner.GetMuzzleID();
11008 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11009
11010 if (WPOF_array)
11011 {
11012 for (int i = 0; i < WPOF_array.Count(); i++)
11013 {
11014 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11015
11016 if (WPOF)
11017 {
11018 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11019 }
11020 }
11021 }
11022 }
11023
11024
11026 {
11027 int id = muzzle_owner.GetMuzzleID();
11029
11030 if (WPOBE_array)
11031 {
11032 for (int i = 0; i < WPOBE_array.Count(); i++)
11033 {
11034 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11035
11036 if (WPOBE)
11037 {
11038 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11039 }
11040 }
11041 }
11042 }
11043
11044
11046 {
11047 int id = muzzle_owner.GetMuzzleID();
11048 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11049
11050 if (WPOOH_array)
11051 {
11052 for (int i = 0; i < WPOOH_array.Count(); i++)
11053 {
11054 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11055
11056 if (WPOOH)
11057 {
11058 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11059 }
11060 }
11061 }
11062 }
11063
11064
11066 {
11067 int id = muzzle_owner.GetMuzzleID();
11068 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11069
11070 if (WPOOH_array)
11071 {
11072 for (int i = 0; i < WPOOH_array.Count(); i++)
11073 {
11074 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11075
11076 if (WPOOH)
11077 {
11078 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11079 }
11080 }
11081 }
11082 }
11083
11084
11086 {
11087 int id = muzzle_owner.GetMuzzleID();
11088 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11089
11090 if (WPOOH_array)
11091 {
11092 for (int i = 0; i < WPOOH_array.Count(); i++)
11093 {
11094 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11095
11096 if (WPOOH)
11097 {
11098 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11099 }
11100 }
11101 }
11102 }
11103
11104
11105
11107 {
11109 {
11110 return true;
11111 }
11112
11113 return false;
11114 }
11115
11117 {
11119 {
11120 return true;
11121 }
11122
11123 return false;
11124 }
11125
11127 {
11129 {
11130 return true;
11131 }
11132
11133 return false;
11134 }
11135
11137 {
11138 return false;
11139 }
11140
11143 {
11144 return UATimeSpent.DEFAULT_DEPLOY;
11145 }
11146
11147
11148
11149
11151 {
11153 SetSynchDirty();
11154 }
11155
11157 {
11159 }
11160
11161
11163 {
11164 return false;
11165 }
11166
11169 {
11170 string att_type = "None";
11171
11172 if (ConfigIsExisting("soundAttType"))
11173 {
11174 att_type = ConfigGetString("soundAttType");
11175 }
11176
11178 }
11179
11181 {
11183 }
11184
11185
11186
11187
11188
11194
11196 {
11199
11201 }
11202
11203
11205 {
11207 return;
11208
11210
11213
11216
11217 SoundParameters params = new SoundParameters();
11221 }
11222
11223
11225 {
11227 {
11230
11231 SetSynchDirty();
11232
11235 }
11236 }
11237
11239 {
11241 }
11242
11243
11245 {
11247 return;
11248
11250 SetSynchDirty();
11251
11254 }
11255
11257 {
11260 }
11261
11263 {
11265 }
11266
11267 void OnApply(PlayerBase player);
11268
11270 {
11271 return 1.0;
11272 };
11273
11275 {
11277 }
11278
11280 {
11282 }
11283
11285
11287 {
11288 SetDynamicPhysicsLifeTime(0.01);
11290 }
11291
11293 {
11294 array<string> zone_names = new array<string>;
11295 GetDamageZones(zone_names);
11296 for (int i = 0; i < zone_names.Count(); i++)
11297 {
11298 SetHealthMax(zone_names.Get(i),"Health");
11299 }
11300 SetHealthMax("","Health");
11301 }
11302
11305 {
11306 float global_health = GetHealth01("","Health");
11307 array<string> zones = new array<string>;
11308 GetDamageZones(zones);
11309
11310 for (int i = 0; i < zones.Count(); i++)
11311 {
11312 SetHealth01(zones.Get(i),"Health",global_health);
11313 }
11314 }
11315
11318 {
11319 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11320 }
11321
11323 {
11324 if (!hasRootAsPlayer)
11325 {
11326 if (refParentIB)
11327 {
11328
11329 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11330 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11331
11332 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11333 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11334
11337 }
11338 else
11339 {
11340
11343 }
11344 }
11345 }
11346
11348 {
11350 {
11351 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11352 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11353 {
11354 float heatPermCoef = 1.0;
11356 while (ent)
11357 {
11358 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11359 ent = ent.GetHierarchyParent();
11360 }
11361
11362 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11363 }
11364 }
11365 }
11366
11368 {
11369
11370 EntityAI parent = GetHierarchyParent();
11371 if (!parent)
11372 {
11373 hasParent = false;
11374 hasRootAsPlayer = false;
11375 }
11376 else
11377 {
11378 hasParent = true;
11379 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11380 refParentIB =
ItemBase.Cast(parent);
11381 }
11382 }
11383
11384 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11385 {
11386
11387 }
11388
11390 {
11391
11392 return false;
11393 }
11394
11396 {
11397
11398
11399 return false;
11400 }
11401
11403 {
11404
11405 return false;
11406 }
11407
11410 {
11411 return !GetIsFrozen() &&
IsOpen();
11412 }
11413
11415 {
11416 bool hasParent = false, hasRootAsPlayer = false;
11418
11419 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11420 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11421
11422 if (wwtu || foodDecay)
11423 {
11427
11428 if (processWetness || processTemperature || processDecay)
11429 {
11431
11432 if (processWetness)
11433 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11434
11435 if (processTemperature)
11437
11438 if (processDecay)
11439 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11440 }
11441 }
11442 }
11443
11446 {
11448 }
11449
11451 {
11454
11455 return super.GetTemperatureFreezeThreshold();
11456 }
11457
11459 {
11462
11463 return super.GetTemperatureThawThreshold();
11464 }
11465
11467 {
11470
11471 return super.GetItemOverheatThreshold();
11472 }
11473
11475 {
11477 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11478
11479 return super.GetTemperatureFreezeTime();
11480 }
11481
11483 {
11485 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11486
11487 return super.GetTemperatureThawTime();
11488 }
11489
11494
11496 {
11497 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11498 }
11499
11501 {
11502 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11503 }
11504
11507 {
11509 }
11510
11512 {
11514 }
11515
11517 {
11519 }
11520
11523 {
11524 return null;
11525 }
11526
11529 {
11530 return false;
11531 }
11532
11534 {
11536 {
11539 if (!trg)
11540 {
11542 explosive = this;
11543 }
11544
11545 explosive.PairRemote(trg);
11547
11548 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11549 trg.SetPersistentPairID(persistentID);
11550 explosive.SetPersistentPairID(persistentID);
11551
11552 return true;
11553 }
11554 return false;
11555 }
11556
11559 {
11560 float ret = 1.0;
11563 ret *= GetHealth01();
11564
11565 return ret;
11566 }
11567
11568 #ifdef DEVELOPER
11569 override void SetDebugItem()
11570 {
11571 super.SetDebugItem();
11572 _itemBase = this;
11573 }
11574
11576 {
11577 string text = super.GetDebugText();
11578
11580 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11581
11582 return text;
11583 }
11584 #endif
11585
11587 {
11588 return true;
11589 }
11590
11592
11594
11596 {
11599 }
11600
11601
11609
11625
11626 [
Obsolete(
"Use ItemSoundHandler instead")]
11629 {
11630 if (!
g_Game.IsDedicatedServer())
11631 {
11632 if (ConfigIsExisting("attachSoundSet"))
11633 {
11634 string cfg_path = "";
11635 string soundset = "";
11636 string type_name =
GetType();
11637
11640 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11641 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11642
11643 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11644 {
11645 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11646 {
11647 if (cfg_slot_array[i] == slot_type)
11648 {
11649 soundset = cfg_soundset_array[i];
11650 break;
11651 }
11652 }
11653 }
11654
11655 if (soundset != "")
11656 {
11657 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11659 }
11660 }
11661 }
11662 }
11663
11665}
11666
11668{
11670 if (entity)
11671 {
11672 bool is_item = entity.IsInherited(
ItemBase);
11673 if (is_item && full_quantity)
11674 {
11677 }
11678 }
11679 else
11680 {
11682 return NULL;
11683 }
11684 return entity;
11685}
11686
11688{
11689 if (item)
11690 {
11691 if (health > 0)
11692 item.SetHealth("", "", health);
11693
11694 if (item.CanHaveTemperature())
11695 {
11697 if (item.CanFreeze())
11698 item.SetFrozen(false);
11699 }
11700
11701 if (item.HasEnergyManager())
11702 {
11703 if (quantity >= 0)
11704 {
11705 item.GetCompEM().SetEnergy0To1(quantity);
11706 }
11707 else
11708 {
11710 }
11711 }
11712 else if (item.IsMagazine())
11713 {
11714 Magazine mag = Magazine.Cast(item);
11715 if (quantity >= 0)
11716 {
11717 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11718 }
11719 else
11720 {
11722 }
11723
11724 }
11725 else
11726 {
11727 if (quantity >= 0)
11728 {
11729 item.SetQuantityNormalized(quantity, false);
11730 }
11731 else
11732 {
11734 }
11735
11736 }
11737 }
11738}
11739
11740#ifdef DEVELOPER
11742#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.