6737{
6739 {
6740 return true;
6741 }
6742};
6743
6745{
6746
6747};
6748
6749
6750
6752{
6756
6758
6761
6762
6763
6764
6765
6774
6780
6785
6790
6811 protected bool m_IsResultOfSplit
6812
6814
6819
6820
6821
6823
6827
6828
6829
6831
6834
6835
6836
6842
6843
6851
6854
6855
6857
6858
6860
6861
6866
6867
6872
6874
6875
6877
6878
6880 {
6885
6886 if (!
g_Game.IsDedicatedServer())
6887 {
6889 {
6891
6893 {
6895 }
6896 }
6897
6900 }
6901
6902 m_OldLocation = null;
6903
6905 {
6907 }
6908
6909 if (ConfigIsExisting("headSelectionsToHide"))
6910 {
6913 }
6914
6916 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6917 {
6919 }
6920
6922
6923 m_IsResultOfSplit = false;
6924
6926 }
6927
6929 {
6930 super.InitItemVariables();
6931
6937 m_Count = ConfigGetInt(
"count");
6938
6941
6946
6949
6954
6966
6970
6971
6974 if (ConfigIsExisting("canBeSplit"))
6975 {
6978 }
6979
6981 if (ConfigIsExisting("itemBehaviour"))
6983
6984
6987 RegisterNetSyncVariableInt("m_VarLiquidType");
6988 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6989
6990 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6991 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6992 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6993
6994 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6995 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6996 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6997 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6998
6999 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7000 RegisterNetSyncVariableBool("m_IsTakeable");
7001 RegisterNetSyncVariableBool("m_IsHologram");
7002
7005 {
7008 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7009 }
7010
7012
7014 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7016
7018 }
7019
7021 {
7023 }
7024
7026 {
7029 {
7034 }
7035 }
7036
7037 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7038 {
7040 {
7043 }
7044
7046 }
7047
7049 {
7055 }
7056
7058
7060 {
7062
7063 if (!action)
7064 {
7065 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7066 return;
7067 }
7068
7070 if (!ai)
7071 {
7073 return;
7074 }
7075
7077 if (!action_array)
7078 {
7079 action_array = new array<ActionBase_Basic>;
7081 }
7082 if (LogManager.IsActionLogEnable())
7083 {
7084 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7085 }
7086
7087 if (action_array.Find(action) != -1)
7088 {
7089 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7090 }
7091 else
7092 {
7093 action_array.Insert(action);
7094 }
7095 }
7096
7098 {
7099 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7100 ActionBase action = player.GetActionManager().GetAction(actionName);
7103
7104 if (action_array)
7105 {
7106 action_array.RemoveItem(action);
7107 }
7108 }
7109
7110
7111
7113 {
7114 ActionOverrideData overrideData = new ActionOverrideData();
7118
7120 if (!actionMap)
7121 {
7124 }
7125
7126 actionMap.Insert(this.
Type(), overrideData);
7127
7128 }
7129
7131
7133
7134
7136 {
7139
7142
7143 string config_to_search = "CfgVehicles";
7144 string muzzle_owner_config;
7145
7147 {
7148 if (IsInherited(Weapon))
7149 config_to_search = "CfgWeapons";
7150
7151 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7152
7153 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7154
7155 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7156
7157 if (config_OnFire_subclass_count > 0)
7158 {
7159 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7160
7161 for (int i = 0; i < config_OnFire_subclass_count; i++)
7162 {
7163 string particle_class = "";
7164 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7165 string config_OnFire_entry = config_OnFire_class + particle_class;
7166 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7167 WPOF_array.Insert(WPOF);
7168 }
7169
7170
7172 }
7173 }
7174
7176 {
7177 config_to_search = "CfgWeapons";
7178 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7179
7180 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7181
7182 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7183
7184 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7185 {
7186 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7187
7188 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7189 {
7190 string particle_class2 = "";
7191 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7192 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7193 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7194 WPOBE_array.Insert(WPOBE);
7195 }
7196
7197
7199 }
7200 }
7201 }
7202
7203
7205 {
7208
7210 {
7211 string config_to_search = "CfgVehicles";
7212
7213 if (IsInherited(Weapon))
7214 config_to_search = "CfgWeapons";
7215
7216 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7217 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7218
7219 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7220 {
7221
7223
7225 {
7227 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7229 return;
7230 }
7231
7234
7235
7236
7237 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7238 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7239
7240 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7241 {
7242 string particle_class = "";
7243 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7244 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7245 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7246
7247 if (entry_type == CT_CLASS)
7248 {
7249 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7250 WPOOH_array.Insert(WPOF);
7251 }
7252 }
7253
7254
7256 }
7257 }
7258 }
7259
7261 {
7263 }
7264
7266 {
7268 {
7270
7273
7276
7277 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7278 }
7279 }
7280
7282 {
7284 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7285
7287 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7288
7290 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7291
7293 {
7295 }
7296 }
7297
7299 {
7301 }
7302
7304 {
7307 else
7309
7311 {
7314 }
7315 else
7316 {
7319
7322 }
7323
7325 }
7326
7328 {
7330 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7331 }
7332
7334 {
7336 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7338 }
7339
7341 {
7343 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7344 }
7345
7347 {
7350
7351 OverheatingParticle OP = new OverheatingParticle();
7356
7358 }
7359
7361 {
7364
7365 return -1;
7366 }
7367
7369 {
7371 {
7374
7375 for (int i = count; i > 0; --i)
7376 {
7377 int id = i - 1;
7380
7383
7384 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7385 {
7386 if (p)
7387 {
7390 }
7391 }
7392 }
7393 }
7394 }
7395
7397 {
7399 {
7401 {
7402 int id = i - 1;
7404
7405 if (OP)
7406 {
7408
7409 if (p)
7410 {
7412 }
7413
7414 delete OP;
7415 }
7416 }
7417
7420 }
7421 }
7422
7425 {
7426 return 0.0;
7427 }
7428
7429
7431 {
7432 return 250;
7433 }
7434
7436 {
7437 return 0;
7438 }
7439
7442 {
7444 return true;
7445
7446 return false;
7447 }
7448
7451 {
7454
7456 {
7458 }
7459 else
7460 {
7461
7463 }
7464
7466 }
7467
7474 {
7475 return -1;
7476 }
7477
7478
7479
7480
7482 {
7484 {
7485 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7486 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7487
7488 if (r_index >= 0)
7489 {
7490 InventoryLocation r_il = new InventoryLocation;
7491 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7492
7493 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7496 {
7497 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7498 }
7500 {
7501 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7502 }
7503
7504 }
7505
7506 player.GetHumanInventory().ClearUserReservedLocation(this);
7507 }
7508
7511 }
7512
7513
7514
7515
7517 {
7518 return ItemBase.m_DebugActionsMask;
7519 }
7520
7522 {
7523 return ItemBase.m_DebugActionsMask & mask;
7524 }
7525
7527 {
7528 ItemBase.m_DebugActionsMask = mask;
7529 }
7530
7532 {
7533 ItemBase.m_DebugActionsMask |= mask;
7534 }
7535
7537 {
7538 ItemBase.m_DebugActionsMask &= ~mask;
7539 }
7540
7542 {
7544 {
7546 }
7547 else
7548 {
7550 }
7551 }
7552
7553
7555 {
7556 if (GetEconomyProfile())
7557 {
7558 float q_max = GetEconomyProfile().GetQuantityMax();
7559 if (q_max > 0)
7560 {
7561 float q_min = GetEconomyProfile().GetQuantityMin();
7562 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7563
7565 {
7566 ComponentEnergyManager comp = GetCompEM();
7568 {
7570 }
7571 }
7573 {
7575
7576 }
7577
7578 }
7579 }
7580 }
7581
7584 {
7585 EntityAI parent = GetHierarchyParent();
7586
7587 if (parent)
7588 {
7589 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7590 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7591 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7592 }
7593 }
7594
7597 {
7598 EntityAI parent = GetHierarchyParent();
7599
7600 if (parent)
7601 {
7602 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7603 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7604 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7605 }
7606 }
7607
7609 {
7610
7611
7612
7613
7615
7617 {
7618 if (ScriptInputUserData.CanStoreInputUserData())
7619 {
7620 ScriptInputUserData ctx = new ScriptInputUserData;
7626 ctx.
Write(use_stack_max);
7629
7631 {
7632 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7633 }
7634 }
7635 }
7636 else if (!
g_Game.IsMultiplayer())
7637 {
7639 }
7640 }
7641
7643 {
7645 }
7646
7648 {
7650 }
7651
7653 {
7655 }
7656
7658 {
7659
7660 return false;
7661 }
7662
7664 {
7665 return false;
7666 }
7667
7671 {
7672 return false;
7673 }
7674
7676 {
7677 return "";
7678 }
7679
7681
7683 {
7684 return false;
7685 }
7686
7688 {
7689 return true;
7690 }
7691
7692
7693
7695 {
7696 return true;
7697 }
7698
7700 {
7701 return true;
7702 }
7703
7705 {
7706 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7708 }
7709
7711 {
7713 }
7714
7716 {
7718 if (!is_being_placed)
7720 SetSynchDirty();
7721 }
7722
7723
7725
7727 {
7729 }
7730
7732 {
7734 }
7735
7737 {
7738 return 1;
7739 }
7740
7742 {
7743 return false;
7744 }
7745
7747 {
7749 SetSynchDirty();
7750 }
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7787 {
7788 super.OnMovedInsideCargo(container);
7789
7790 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7791 }
7792
7793 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7794 {
7795 super.EEItemLocationChanged(oldLoc, newLoc);
7796
7797 PlayerBase newPlayer = null;
7798 PlayerBase oldPlayer = null;
7799
7800 if (newLoc.GetParent())
7801 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7802
7803 if (oldLoc.GetParent())
7804 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7805
7807 {
7808 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7809
7810 if (rIndex >= 0)
7811 {
7812 InventoryLocation rIl = new InventoryLocation;
7813 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7814
7815 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7818 {
7819 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7820 }
7822 {
7824 }
7825
7826 }
7827 }
7828
7830 {
7831 if (newPlayer)
7832 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7833
7834 if (newPlayer == oldPlayer)
7835 {
7836 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7837 {
7839 {
7840 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7841 {
7842 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7843 }
7844 }
7845 else
7846 {
7847 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7848 }
7849 }
7850
7851 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7852 {
7853 int type = oldLoc.GetType();
7855 {
7856 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7857 }
7859 {
7860 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7861 }
7862 }
7863 if (!m_OldLocation)
7864 {
7865 m_OldLocation = new InventoryLocation;
7866 }
7867 m_OldLocation.Copy(oldLoc);
7868 }
7869 else
7870 {
7871 if (m_OldLocation)
7872 {
7873 m_OldLocation.Reset();
7874 }
7875 }
7876
7877 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7878 }
7879 else
7880 {
7881 if (newPlayer)
7882 {
7883 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7884 if (resIndex >= 0)
7885 {
7886 InventoryLocation il = new InventoryLocation;
7887 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7889 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7892 {
7893 il.
GetParent().GetOnReleaseLock().Invoke(it);
7894 }
7896 {
7898 }
7899
7900 }
7901 }
7903 {
7904
7906 }
7907
7908 if (m_OldLocation)
7909 {
7910 m_OldLocation.Reset();
7911 }
7912 }
7913
7915 {
7916 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7917 }
7918
7920 {
7921 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7922 }
7923 }
7924
7925 override void EOnContact(IEntity other, Contact extra)
7926 {
7928 {
7929 int liquidType = -1;
7931 if (impactSpeed > 0.0)
7932 {
7934 #ifndef SERVER
7936 #else
7938 SetSynchDirty();
7939 #endif
7941 }
7942 }
7943
7944 #ifdef SERVER
7945 if (GetCompEM() && GetCompEM().IsPlugged())
7946 {
7947 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7948 GetCompEM().UnplugThis();
7949 }
7950 #endif
7951 }
7952
7954
7956 {
7958 }
7959
7961 {
7962
7963 }
7964
7966 {
7967 super.OnItemLocationChanged(old_owner, new_owner);
7968
7969 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7970 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7971
7972 if (!relatedPlayer && playerNew)
7973 relatedPlayer = playerNew;
7974
7975 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7976 {
7978 if (actionMgr)
7979 {
7980 ActionBase currentAction = actionMgr.GetRunningAction();
7981 if (currentAction)
7983 }
7984 }
7985
7986 Man ownerPlayerOld = null;
7987 Man ownerPlayerNew = null;
7988
7989 if (old_owner)
7990 {
7991 if (old_owner.
IsMan())
7992 {
7993 ownerPlayerOld = Man.Cast(old_owner);
7994 }
7995 else
7996 {
7997 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7998 }
7999 }
8000 else
8001 {
8003 {
8005
8006 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8007 {
8008 GetCompEM().UnplugThis();
8009 }
8010 }
8011 }
8012
8013 if (new_owner)
8014 {
8015 if (new_owner.
IsMan())
8016 {
8017 ownerPlayerNew = Man.Cast(new_owner);
8018 }
8019 else
8020 {
8021 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8022 }
8023 }
8024
8025 if (ownerPlayerOld != ownerPlayerNew)
8026 {
8027 if (ownerPlayerOld)
8028 {
8029 array<EntityAI> subItemsExit = new array<EntityAI>;
8031 for (int i = 0; i < subItemsExit.Count(); i++)
8032 {
8035 }
8036 }
8037
8038 if (ownerPlayerNew)
8039 {
8040 array<EntityAI> subItemsEnter = new array<EntityAI>;
8042 for (int j = 0; j < subItemsEnter.Count(); j++)
8043 {
8046 }
8047 }
8048 }
8049 else if (ownerPlayerNew != null)
8050 {
8051 PlayerBase nplayer;
8052 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8053 {
8054 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8056 for (int k = 0; k < subItemsUpdate.Count(); k++)
8057 {
8059 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8060 }
8061 }
8062 }
8063
8064 if (old_owner)
8065 old_owner.OnChildItemRemoved(this);
8066 if (new_owner)
8067 new_owner.OnChildItemReceived(this);
8068 }
8069
8070
8072 {
8073 super.EEDelete(parent);
8074 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8075 if (player)
8076 {
8078
8079 if (player.IsAlive())
8080 {
8081 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8082 if (r_index >= 0)
8083 {
8084 InventoryLocation r_il = new InventoryLocation;
8085 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8086
8087 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8090 {
8091 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8092 }
8094 {
8095 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8096 }
8097
8098 }
8099
8100 player.RemoveQuickBarEntityShortcut(this);
8101 }
8102 }
8103 }
8104
8106 {
8107 super.EEKilled(killer);
8108
8111 {
8112 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8113 {
8114 if (IsMagazine())
8115 {
8116 if (Magazine.Cast(this).GetAmmoCount() > 0)
8117 {
8119 }
8120 }
8121 else
8122 {
8124 }
8125 }
8126 }
8127 }
8128
8130 {
8131 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8132
8133 super.OnWasAttached(parent, slot_id);
8134
8137
8140 }
8141
8143 {
8144 super.OnWasDetached(parent, slot_id);
8145
8148
8151 }
8152
8154 {
8155 int idx;
8158
8159 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8160 if (inventory_slots.Count() < 1)
8161 {
8162 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8163 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8164 }
8165 else
8166 {
8167 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8168 }
8169
8170 idx = inventory_slots.Find(slot);
8171 if (idx < 0)
8172 return "";
8173
8174 return attach_types.Get(idx);
8175 }
8176
8178 {
8179 int idx = -1;
8180 string slot;
8181
8184
8185 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8186 if (inventory_slots.Count() < 1)
8187 {
8188 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8189 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8190 }
8191 else
8192 {
8193 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8194 if (detach_types.Count() < 1)
8195 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8196 }
8197
8198 for (int i = 0; i < inventory_slots.Count(); i++)
8199 {
8200 slot = inventory_slots.Get(i);
8201 }
8202
8203 if (slot != "")
8204 {
8205 if (detach_types.Count() == 1)
8206 idx = 0;
8207 else
8208 idx = inventory_slots.Find(slot);
8209 }
8210 if (idx < 0)
8211 return "";
8212
8213 return detach_types.Get(idx);
8214 }
8215
8217 {
8218
8220
8221
8222 float min_time = 1;
8223 float max_time = 3;
8224 float delay = Math.RandomFloat(min_time, max_time);
8225
8226 explode_timer.Run(delay, this, "DoAmmoExplosion");
8227 }
8228
8230 {
8231 Magazine magazine = Magazine.Cast(this);
8232 int pop_sounds_count = 6;
8233 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8234
8235
8236 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8237 string sound_name = pop_sounds[ sound_idx ];
8238 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8239
8240
8241 magazine.ServerAddAmmoCount(-1);
8242
8243
8244 float min_temp_to_explode = 100;
8245
8246 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8247 {
8249 }
8250 }
8251
8252
8253 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8254 {
8255 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8256
8257 const int CHANCE_DAMAGE_CARGO = 4;
8258 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8259 const int CHANCE_DAMAGE_NOTHING = 2;
8260
8262 {
8263 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8264 int chances;
8265 int rnd;
8266
8267 if (GetInventory().GetCargo())
8268 {
8269 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8270 rnd = Math.RandomInt(0,chances);
8271
8272 if (rnd < CHANCE_DAMAGE_CARGO)
8273 {
8275 }
8276 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8277 {
8279 }
8280 }
8281 else
8282 {
8283 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8284 rnd = Math.RandomInt(0,chances);
8285
8286 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8287 {
8289 }
8290 }
8291 }
8292 }
8293
8295 {
8296 CargoBase cargo = GetInventory().GetCargo();
8297 if (cargo)
8298 {
8300 if (item_count > 0)
8301 {
8302 int random_pick = Math.RandomInt(0, item_count);
8304 if (!item.IsExplosive())
8305 {
8306 item.AddHealth("","",damage);
8307 return true;
8308 }
8309 }
8310 }
8311 return false;
8312 }
8313
8315 {
8316 GameInventory inventory = GetInventory();
8318 if (attachment_count > 0)
8319 {
8320 int random_pick = Math.RandomInt(0, attachment_count);
8322 if (!attachment.IsExplosive())
8323 {
8324 attachment.AddHealth("","",damage);
8325 return true;
8326 }
8327 }
8328 return false;
8329 }
8330
8332 {
8334 }
8335
8337 {
8339 return GetInventory().CanRemoveEntity();
8340
8341 return false;
8342 }
8343
8345 {
8346
8348 return false;
8349
8350
8352 return false;
8353
8354
8355
8357 if (delta == 0)
8358 return false;
8359
8360
8361 return true;
8362 }
8363
8365 {
8367 {
8368 if (ScriptInputUserData.CanStoreInputUserData())
8369 {
8370 ScriptInputUserData ctx = new ScriptInputUserData;
8375 ctx.
Write(destination_entity);
8379 }
8380 }
8381 else if (!
g_Game.IsMultiplayer())
8382 {
8384 }
8385 }
8386
8388 {
8389 float split_quantity_new;
8393 InventoryLocation loc = new InventoryLocation;
8394
8395 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8396 {
8398 split_quantity_new = stack_max;
8399 else
8401
8403 {
8404 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8405 if (new_item)
8406 {
8407 new_item.SetResultOfSplit(true);
8408 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8410 new_item.
SetQuantity(split_quantity_new,
false,
true);
8411 }
8412 }
8413 }
8414 else if (destination_entity && slot_id == -1)
8415 {
8416 if (quantity > stack_max)
8417 split_quantity_new = stack_max;
8418 else
8419 split_quantity_new = quantity;
8420
8422 {
8423 GameInventory destinationInventory = destination_entity.GetInventory();
8425 {
8428 }
8429
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
8440 {
8441 if (stack_max != 0)
8442 {
8444 {
8446 }
8447
8448 if (split_quantity_new == 0)
8449 {
8450 if (!
g_Game.IsMultiplayer())
8451 player.PhysicalPredictiveDropItem(this);
8452 else
8453 player.ServerDropEntity(this);
8454 return;
8455 }
8456
8458 {
8460
8461 if (new_item)
8462 {
8463 new_item.SetResultOfSplit(true);
8464 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8467 new_item.PlaceOnSurface();
8468 }
8469 }
8470 }
8471 }
8472 }
8473
8475 {
8476 float split_quantity_new;
8480 InventoryLocation loc = new InventoryLocation;
8481
8482 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8483 {
8485 split_quantity_new = stack_max;
8486 else
8488
8490 {
8491 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8492 if (new_item)
8493 {
8494 new_item.SetResultOfSplit(true);
8495 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8497 new_item.
SetQuantity(split_quantity_new,
false,
true);
8498 }
8499 }
8500 }
8501 else if (destination_entity && slot_id == -1)
8502 {
8503 if (quantity > stack_max)
8504 split_quantity_new = stack_max;
8505 else
8506 split_quantity_new = quantity;
8507
8509 {
8510 GameInventory destinationInventory = destination_entity.GetInventory();
8512 {
8515 }
8516
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
8527 {
8528 if (stack_max != 0)
8529 {
8531 {
8533 }
8534
8536 {
8538
8539 if (new_item)
8540 {
8541 new_item.SetResultOfSplit(true);
8542 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8545 new_item.PlaceOnSurface();
8546 }
8547 }
8548 }
8549 }
8550 }
8551
8553 {
8555 {
8556 if (ScriptInputUserData.CanStoreInputUserData())
8557 {
8558 ScriptInputUserData ctx = new ScriptInputUserData;
8563 dst.WriteToContext(ctx);
8565 }
8566 }
8567 else if (!
g_Game.IsMultiplayer())
8568 {
8570 }
8571 }
8572
8574 {
8576 {
8577 if (ScriptInputUserData.CanStoreInputUserData())
8578 {
8579 ScriptInputUserData ctx = new ScriptInputUserData;
8584 ctx.
Write(destination_entity);
8590 }
8591 }
8592 else if (!
g_Game.IsMultiplayer())
8593 {
8595 }
8596 }
8597
8599 {
8601 }
8602
8604 {
8606 float split_quantity_new;
8608 if (dst.IsValid())
8609 {
8610 int slot_id = dst.GetSlot();
8612
8613 if (quantity > stack_max)
8614 split_quantity_new = stack_max;
8615 else
8616 split_quantity_new = quantity;
8617
8619 {
8621
8622 if (new_item)
8623 {
8624 new_item.SetResultOfSplit(true);
8625 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8627 new_item.
SetQuantity(split_quantity_new,
false,
true);
8628 }
8629
8630 return new_item;
8631 }
8632 }
8633
8634 return null;
8635 }
8636
8638 {
8640 float split_quantity_new;
8642 if (destination_entity)
8643 {
8645 if (quantity > stackable)
8646 split_quantity_new = stackable;
8647 else
8648 split_quantity_new = quantity;
8649
8651 {
8652 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8653 if (new_item)
8654 {
8655 new_item.SetResultOfSplit(true);
8656 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8658 new_item.
SetQuantity(split_quantity_new,
false,
true);
8659 }
8660 }
8661 }
8662 }
8663
8665 {
8667 {
8668 if (ScriptInputUserData.CanStoreInputUserData())
8669 {
8670 ScriptInputUserData ctx = new ScriptInputUserData;
8675 ItemBase destination_entity =
this;
8676 ctx.
Write(destination_entity);
8680 }
8681 }
8682 else if (!
g_Game.IsMultiplayer())
8683 {
8685 }
8686 }
8687
8689 {
8691 float split_quantity_new;
8693 if (player)
8694 {
8696 if (quantity > stackable)
8697 split_quantity_new = stackable;
8698 else
8699 split_quantity_new = quantity;
8700
8702 {
8703 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8704 new_item =
ItemBase.Cast(in_hands);
8705 if (new_item)
8706 {
8707 new_item.SetResultOfSplit(true);
8708 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8710 new_item.SetQuantity(split_quantity_new, false, true);
8711 }
8712 }
8713 }
8714 }
8715
8717 {
8719 float split_quantity_new = Math.Floor(quantity * 0.5);
8720
8722 return;
8723
8725
8726 if (new_item)
8727 {
8728 if (new_item.GetQuantityMax() < split_quantity_new)
8729 {
8730 split_quantity_new = new_item.GetQuantityMax();
8731 }
8732
8733 new_item.SetResultOfSplit(true);
8734 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8735
8737 {
8740 }
8741 else
8742 {
8744 new_item.
SetQuantity(split_quantity_new,
false,
true);
8745 }
8746 }
8747 }
8748
8750 {
8752 float split_quantity_new = Math.Floor(quantity / 2);
8753
8755 return;
8756
8757 InventoryLocation invloc = new InventoryLocation;
8759
8761 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8762
8763 if (new_item)
8764 {
8765 if (new_item.GetQuantityMax() < split_quantity_new)
8766 {
8767 split_quantity_new = new_item.GetQuantityMax();
8768 }
8770 {
8773 }
8774 else if (split_quantity_new > 1)
8775 {
8777 new_item.
SetQuantity(split_quantity_new,
false,
true);
8778 }
8779 }
8780 }
8781
8784 {
8785 SetWeightDirty();
8787
8788 if (parent)
8789 parent.OnAttachmentQuantityChangedEx(this, delta);
8790
8792 {
8794 {
8796 }
8798 {
8799 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8801 }
8802 }
8803 }
8804
8807 {
8808
8809 }
8810
8813 {
8815 }
8816
8818 {
8819 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8820
8822 {
8823 if (newLevel == GameConstants.STATE_RUINED)
8824 {
8826 EntityAI parent = GetHierarchyParent();
8827 if (parent && parent.IsFireplace())
8828 {
8829 CargoBase cargo = GetInventory().GetCargo();
8830 if (cargo)
8831 {
8833 {
8835 }
8836 }
8837 }
8838 }
8839
8841 {
8842
8844 return;
8845 }
8846
8847 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8848 {
8850 }
8851 }
8852 }
8853
8854
8856 {
8857 super.OnRightClick();
8858
8860 {
8862 {
8863 if (ScriptInputUserData.CanStoreInputUserData())
8864 {
8865 EntityAI root = GetHierarchyRoot();
8866 Man playerOwner = GetHierarchyRootPlayer();
8867 InventoryLocation dst = new InventoryLocation;
8868
8869
8870 if (!playerOwner && root && root == this)
8871 {
8873 }
8874 else
8875 {
8876
8877 GetInventory().GetCurrentInventoryLocation(dst);
8879 {
8880 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8882 {
8884 }
8885 else
8886 {
8888
8889
8890 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8891 {
8893 }
8894 else
8895 {
8896 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8897 }
8898 }
8899 }
8900 }
8901
8902 ScriptInputUserData ctx = new ScriptInputUserData;
8910 }
8911 }
8912 else if (!
g_Game.IsMultiplayer())
8913 {
8915 }
8916 }
8917 }
8918
8920 {
8921 if (root)
8922 {
8923 vector m4[4];
8924 root.GetTransform(m4);
8925 dst.SetGround(this, m4);
8926 }
8927 else
8928 {
8929 GetInventory().GetCurrentInventoryLocation(dst);
8930 }
8931 }
8932
8933 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8934 {
8935
8936 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8937 return false;
8938
8939 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8940 return false;
8941
8942
8944 return false;
8945
8946
8947 Magazine mag = Magazine.Cast(this);
8948 if (mag)
8949 {
8950 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8951 return false;
8952
8953 if (stack_max_limit)
8954 {
8955 Magazine other_mag = Magazine.Cast(other_item);
8956 if (other_item)
8957 {
8958 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8959 return false;
8960 }
8961
8962 }
8963 }
8964 else
8965 {
8966
8968 return false;
8969
8971 return false;
8972 }
8973
8974 PlayerBase player = null;
8975 if (CastTo(player, GetHierarchyRootPlayer()))
8976 {
8977 if (player.GetInventory().HasAttachment(this))
8978 return false;
8979
8980 if (player.IsItemsToDelete())
8981 return false;
8982 }
8983
8984 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8985 return false;
8986
8987 int slotID;
8989 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8990 return false;
8991
8992 return true;
8993 }
8994
8996 {
8998 }
8999
9001 {
9002 return m_IsResultOfSplit;
9003 }
9004
9006 {
9007 m_IsResultOfSplit = value;
9008 }
9009
9011 {
9013 }
9014
9016 {
9017 float other_item_quantity = other_item.GetQuantity();
9018 float this_free_space;
9019
9021
9023
9024 if (other_item_quantity > this_free_space)
9025 {
9026 return this_free_space;
9027 }
9028 else
9029 {
9030 return other_item_quantity;
9031 }
9032 }
9033
9035 {
9037 }
9038
9040 {
9042 return;
9043
9044 if (!IsMagazine() && other_item)
9045 {
9047 if (quantity_used != 0)
9048 {
9049 float hp1 = GetHealth01("","");
9050 float hp2 = other_item.GetHealth01("","");
9051 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9052 hpResult = hpResult / (
GetQuantity() + quantity_used);
9053
9054 hpResult *= GetMaxHealth();
9055 Math.Round(hpResult);
9056 SetHealth("", "Health", hpResult);
9057
9059 other_item.AddQuantity(-quantity_used);
9060 }
9061 }
9063 }
9064
9066 {
9067 #ifdef SERVER
9068 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9069 GetHierarchyParent().IncreaseLifetimeUp();
9070 #endif
9071 };
9072
9074 {
9075 PlayerBase p = PlayerBase.Cast(player);
9076
9077 array<int> recipesIds = p.m_Recipes;
9078 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9079 if (moduleRecipesManager)
9080 {
9081 EntityAI itemInHands = player.GetEntityInHands();
9082 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9083 }
9084
9085 for (int i = 0;i < recipesIds.Count(); i++)
9086 {
9087 int key = recipesIds.Get(i);
9088 string recipeName = moduleRecipesManager.GetRecipeName(key);
9090 }
9091 }
9092
9093
9094 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9095 {
9096 super.GetDebugActions(outputList);
9097
9098
9104
9105
9110
9115
9116
9120
9121
9123 {
9127 }
9128
9131
9132
9136
9138
9139 InventoryLocation loc = new InventoryLocation();
9140 GetInventory().GetCurrentInventoryLocation(loc);
9142 {
9143 if (Gizmo_IsSupported())
9146 }
9147
9149 }
9150
9151
9152
9153
9155 {
9156 super.OnAction(action_id, player, ctx);
9157
9159 {
9160 switch (action_id)
9161 {
9165 return true;
9169 return true;
9170 }
9171 }
9172
9174 {
9175 switch (action_id)
9176 {
9178 Delete();
9179 return true;
9180 }
9181 }
9182
9183 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9184 {
9185 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9186 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9187 PlayerBase p = PlayerBase.Cast(player);
9188 if (
EActions.RECIPES_RANGE_START < 1000)
9189 {
9190 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9191 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9192 }
9193 }
9194 #ifndef SERVER
9195 else if (action_id ==
EActions.WATCH_PLAYER)
9196 {
9197 PluginDeveloper.SetDeveloperItemClientEx(player);
9198 }
9199 #endif
9201 {
9202 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9203 {
9204 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9205 OnDebugButtonPressServer(id + 1);
9206 }
9207
9208 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9209 {
9210 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9212 }
9213
9214 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9215 {
9216 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9218 }
9219
9220 else if (action_id ==
EActions.ADD_QUANTITY)
9221 {
9222 if (IsMagazine())
9223 {
9224 Magazine mag = Magazine.Cast(this);
9225 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9226 }
9227 else
9228 {
9230 }
9231
9232 if (m_EM)
9233 {
9234 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9235 }
9236
9237 }
9238
9239 else if (action_id ==
EActions.REMOVE_QUANTITY)
9240 {
9241 if (IsMagazine())
9242 {
9243 Magazine mag2 = Magazine.Cast(this);
9244 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9245 }
9246 else
9247 {
9249 }
9250 if (m_EM)
9251 {
9252 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9253 }
9254
9255 }
9256
9257 else if (action_id ==
EActions.SET_QUANTITY_0)
9258 {
9260
9261 if (m_EM)
9262 {
9263 m_EM.SetEnergy(0);
9264 }
9265 }
9266
9267 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9268 {
9270
9271 if (m_EM)
9272 {
9273 m_EM.SetEnergy(m_EM.GetEnergyMax());
9274 }
9275 }
9276
9277 else if (action_id ==
EActions.ADD_HEALTH)
9278 {
9279 AddHealth("","",GetMaxHealth("","Health")/5);
9280 }
9281 else if (action_id ==
EActions.REMOVE_HEALTH)
9282 {
9283 AddHealth("","",-GetMaxHealth("","Health")/5);
9284 }
9285 else if (action_id ==
EActions.DESTROY_HEALTH)
9286 {
9287 SetHealth01("","",0);
9288 }
9289 else if (action_id ==
EActions.WATCH_ITEM)
9290 {
9292 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9293 #ifdef DEVELOPER
9294 SetDebugDeveloper_item(this);
9295 #endif
9296 }
9297
9298 else if (action_id ==
EActions.ADD_TEMPERATURE)
9299 {
9300 AddTemperature(20);
9301
9302 }
9303
9304 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9305 {
9306 AddTemperature(-20);
9307
9308 }
9309
9310 else if (action_id ==
EActions.FLIP_FROZEN)
9311 {
9312 SetFrozen(!GetIsFrozen());
9313
9314 }
9315
9316 else if (action_id ==
EActions.ADD_WETNESS)
9317 {
9319
9320 }
9321
9322 else if (action_id ==
EActions.REMOVE_WETNESS)
9323 {
9325
9326 }
9327
9328 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9329 {
9332
9333
9334 }
9335
9336 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9337 {
9340 }
9341
9342 else if (action_id ==
EActions.MAKE_SPECIAL)
9343 {
9344 auto debugParams = DebugSpawnParams.WithPlayer(player);
9345 OnDebugSpawnEx(debugParams);
9346 }
9347
9348 }
9349
9350
9351 return false;
9352 }
9353
9354
9355
9356
9360
9363
9364
9365
9367 {
9368 return false;
9369 }
9370
9371
9373 {
9374 return true;
9375 }
9376
9377
9379 {
9380 return true;
9381 }
9382
9383
9384
9386 {
9387 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9388 return g_Game.ConfigIsExisting(config_path);
9389 }
9390
9393 {
9394 return null;
9395 }
9396
9398 {
9399 return false;
9400 }
9401
9403 {
9404 return false;
9405 }
9406
9410
9411
9413 {
9414 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9415 return module_repairing.CanRepair(this, item_repair_kit);
9416 }
9417
9418
9419 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9420 {
9421 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9422 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9423 }
9424
9425
9427 {
9428
9429
9430
9431
9432
9433
9434
9435
9436 return 1;
9437 }
9438
9439
9440
9442 {
9444 }
9445
9446
9447
9449 {
9451 }
9452
9453
9462 {
9463 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9464
9465 if (player)
9466 {
9467 player.MessageStatus(text);
9468 }
9469 }
9470
9471
9480 {
9481 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9482
9483 if (player)
9484 {
9485 player.MessageAction(text);
9486 }
9487 }
9488
9489
9498 {
9499 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9500
9501 if (player)
9502 {
9503 player.MessageFriendly(text);
9504 }
9505 }
9506
9507
9516 {
9517 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9518
9519 if (player)
9520 {
9521 player.MessageImportant(text);
9522 }
9523 }
9524
9526 {
9527 return true;
9528 }
9529
9530
9531 override bool KindOf(
string tag)
9532 {
9533 bool found = false;
9534 string item_name = this.
GetType();
9536 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9537
9538 int array_size = item_tag_array.Count();
9539 for (int i = 0; i < array_size; i++)
9540 {
9541 if (item_tag_array.Get(i) == tag)
9542 {
9543 found = true;
9544 break;
9545 }
9546 }
9547 return found;
9548 }
9549
9550
9552 {
9553
9554 super.OnRPC(sender, rpc_type,ctx);
9555
9556
9557 switch (rpc_type)
9558 {
9559 #ifndef SERVER
9560 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9561 Param2<bool, string> p = new Param2<bool, string>(false, "");
9562
9564 return;
9565
9566 bool play = p.param1;
9567 string soundSet = p.param2;
9568
9569 if (play)
9570 {
9572 {
9574 {
9576 }
9577 }
9578 else
9579 {
9581 }
9582 }
9583 else
9584 {
9586 }
9587
9588 break;
9589 #endif
9590
9591 }
9592
9594 {
9596 }
9597 }
9598
9599
9600
9601
9603 {
9604 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9605 return plugin.GetID(
name);
9606 }
9607
9609 {
9610 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9611 return plugin.GetName(id);
9612 }
9613
9616 {
9617
9618
9619 int varFlags;
9620 if (!ctx.
Read(varFlags))
9621 return;
9622
9623 if (varFlags & ItemVariableFlags.FLOAT)
9624 {
9626 }
9627 }
9628
9630 {
9631
9632 super.SerializeNumericalVars(floats_out);
9633
9634
9635
9637 {
9639 }
9640
9642 {
9644 }
9645
9647 {
9649 }
9650
9652 {
9657 }
9658
9660 {
9662 }
9663 }
9664
9666 {
9667
9668 super.DeSerializeNumericalVars(floats);
9669
9670
9671 int index = 0;
9672 int mask = Math.Round(floats.Get(index));
9673
9674 index++;
9675
9677 {
9679 {
9681 }
9682 else
9683 {
9684 float quantity = floats.Get(index);
9686 }
9687 index++;
9688 }
9689
9691 {
9692 float wet = floats.Get(index);
9694 index++;
9695 }
9696
9698 {
9699 int liquidtype = Math.Round(floats.Get(index));
9701 index++;
9702 }
9703
9705 {
9707 index++;
9709 index++;
9711 index++;
9713 index++;
9714 }
9715
9717 {
9718 int cleanness = Math.Round(floats.Get(index));
9720 index++;
9721 }
9722 }
9723
9725 {
9726 super.WriteVarsToCTX(ctx);
9727
9728
9730 {
9732 }
9733
9735 {
9737 }
9738
9740 {
9742 }
9743
9745 {
9746 int r,g,b,a;
9752 }
9753
9755 {
9757 }
9758 }
9759
9761 {
9762 if (!super.ReadVarsFromCTX(ctx,version))
9763 return false;
9764
9765 int intValue;
9766 float value;
9767
9768 if (version < 140)
9769 {
9770 if (!ctx.
Read(intValue))
9771 return false;
9772
9773 m_VariablesMask = intValue;
9774 }
9775
9777 {
9778 if (!ctx.
Read(value))
9779 return false;
9780
9782 {
9784 }
9785 else
9786 {
9788 }
9789 }
9790
9791 if (version < 140)
9792 {
9794 {
9795 if (!ctx.
Read(value))
9796 return false;
9797 SetTemperatureDirect(value);
9798 }
9799 }
9800
9802 {
9803 if (!ctx.
Read(value))
9804 return false;
9806 }
9807
9809 {
9810 if (!ctx.
Read(intValue))
9811 return false;
9813 }
9814
9816 {
9817 int r,g,b,a;
9819 return false;
9821 return false;
9823 return false;
9825 return false;
9826
9828 }
9829
9831 {
9832 if (!ctx.
Read(intValue))
9833 return false;
9835 }
9836
9837 if (version >= 138 && version < 140)
9838 {
9840 {
9841 if (!ctx.
Read(intValue))
9842 return false;
9843 SetFrozen(intValue);
9844 }
9845 }
9846
9847 return true;
9848 }
9849
9850
9852 {
9855 {
9857 }
9858
9859 if (!super.OnStoreLoad(ctx, version))
9860 {
9862 return false;
9863 }
9864
9865 if (version >= 114)
9866 {
9867 bool hasQuickBarIndexSaved;
9868
9869 if (!ctx.
Read(hasQuickBarIndexSaved))
9870 {
9872 return false;
9873 }
9874
9875 if (hasQuickBarIndexSaved)
9876 {
9877 int itmQBIndex;
9878
9879
9880 if (!ctx.
Read(itmQBIndex))
9881 {
9883 return false;
9884 }
9885
9886 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9887 if (itmQBIndex != -1 && parentPlayer)
9888 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9889 }
9890 }
9891 else
9892 {
9893
9894 PlayerBase player;
9895 int itemQBIndex;
9896 if (version ==
int.
MAX)
9897 {
9898 if (!ctx.
Read(itemQBIndex))
9899 {
9901 return false;
9902 }
9903 }
9904 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9905 {
9906
9907 if (!ctx.
Read(itemQBIndex))
9908 {
9910 return false;
9911 }
9912 if (itemQBIndex != -1 && player)
9913 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9914 }
9915 }
9916
9917 if (version < 140)
9918 {
9919
9920 if (!LoadVariables(ctx, version))
9921 {
9923 return false;
9924 }
9925 }
9926
9927
9929 {
9931 return false;
9932 }
9933 if (version >= 132)
9934 {
9936 if (raib)
9937 {
9939 {
9941 return false;
9942 }
9943 }
9944 }
9945
9947 return true;
9948 }
9949
9950
9951
9953 {
9954 super.OnStoreSave(ctx);
9955
9956 PlayerBase player;
9957 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9958 {
9960
9961 int itemQBIndex = -1;
9962 itemQBIndex = player.FindQuickBarEntityIndex(this);
9963 ctx.
Write(itemQBIndex);
9964 }
9965 else
9966 {
9968 }
9969
9971
9973 if (raib)
9974 {
9976 }
9977 }
9978
9979
9981 {
9982 super.AfterStoreLoad();
9983
9985 {
9987 }
9988
9990 {
9993 }
9994 }
9995
9997 {
9998 super.EEOnAfterLoad();
9999
10001 {
10003 }
10004
10007 }
10008
10010 {
10011 return false;
10012 }
10013
10014
10015
10017 {
10019 {
10020 #ifdef PLATFORM_CONSOLE
10021
10023 {
10025 if (menu)
10026 {
10028 }
10029 }
10030 #endif
10031 }
10032
10034 {
10037 }
10038
10040 {
10041 SetWeightDirty();
10043 }
10045 {
10048 }
10049
10051 {
10054
10057 }
10059 {
10063 }
10064
10065 super.OnVariablesSynchronized();
10066 }
10067
10068
10069
10071 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10072 {
10073 if (!IsServerCheck(allow_client))
10074 return false;
10075
10077 return false;
10078
10081
10082 if (value <= (min + 0.001))
10083 value = min;
10084
10085 if (value == min)
10086 {
10087 if (destroy_config)
10088 {
10089 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10090 if (dstr)
10091 {
10093 this.Delete();
10094 return true;
10095 }
10096 }
10097 else if (destroy_forced)
10098 {
10100 this.Delete();
10101 return true;
10102 }
10103
10105 }
10106
10109
10111 {
10112 EntityAI parent = GetHierarchyRoot();
10113 InventoryLocation iLoc = new InventoryLocation();
10114 GetInventory().GetCurrentInventoryLocation(iLoc);
10116 {
10117 int iLocSlot = iLoc.
GetSlot();
10119 {
10121 }
10123 {
10125 }
10126 }
10127 }
10128
10130 {
10132
10133 if (delta)
10135 }
10136
10138
10139 return false;
10140 }
10141
10142
10144 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10145 {
10147 }
10148
10150 {
10153 }
10154
10156 {
10159 }
10160
10162 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10163 {
10164 float value_clamped = Math.Clamp(value, 0, 1);
10166 SetQuantity(result, destroy_config, destroy_forced);
10167 }
10168
10169
10172 {
10174 }
10175
10177 {
10179 }
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10191 {
10192 int slot = -1;
10193 GameInventory inventory = GetInventory();
10194 if (inventory)
10195 {
10196 InventoryLocation il = new InventoryLocation;
10199 }
10200
10202 }
10203
10205 {
10206 float quantity_max = 0;
10207
10209 {
10210 if (attSlotID != -1)
10211 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10212
10213 if (quantity_max <= 0)
10215 }
10216
10217 if (quantity_max <= 0)
10219
10220 return quantity_max;
10221 }
10222
10224 {
10226 }
10227
10229 {
10231 }
10232
10233
10235 {
10237 }
10238
10240 {
10242 }
10243
10245 {
10247 }
10248
10249
10251 {
10252
10253 float weightEx = GetWeightEx();
10254 float special = GetInventoryAndCargoWeight();
10255 return weightEx - special;
10256 }
10257
10258
10260 {
10262 }
10263
10265 {
10267 {
10268 #ifdef DEVELOPER
10269 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10270 {
10271 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10273 }
10274 #endif
10275
10276 return GetQuantity() * GetConfigWeightModified();
10277 }
10278 else if (HasEnergyManager())
10279 {
10280 #ifdef DEVELOPER
10281 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10282 {
10283 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10284 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10285 }
10286 #endif
10287 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10288 }
10289 else
10290 {
10291 #ifdef DEVELOPER
10292 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10293 {
10294 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10295 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10296 }
10297 #endif
10298 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10299 }
10300 }
10301
10304 {
10305 int item_count = 0;
10307
10308 GameInventory inventory = GetInventory();
10309 CargoBase cargo = inventory.
GetCargo();
10310 if (cargo != NULL)
10311 {
10313 }
10314
10316 for (int i = 0; i < nAttachments; ++i)
10317 {
10319 if (item)
10320 item_count += item.GetNumberOfItems();
10321 }
10322 return item_count;
10323 }
10324
10327 {
10328 float weight = 0;
10329 float wetness = 1;
10330 if (include_wetness)
10333 {
10334 weight = wetness * m_ConfigWeight;
10335 }
10337 {
10338 weight = 1;
10339 }
10340 return weight;
10341 }
10342
10343
10344
10346 {
10347 GameInventory inventory = GetInventory();
10348 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10349 {
10350 array<EntityAI> items = new array<EntityAI>;
10352 for (int i = 0; i < items.Count(); ++i)
10353 {
10355 if (item)
10356 {
10357 g_Game.ObjectDelete(item);
10358 }
10359 }
10360 }
10361 }
10362
10363
10364
10365
10367 {
10368 float energy = 0;
10369 if (HasEnergyManager())
10370 {
10371 energy = GetCompEM().GetEnergy();
10372 }
10373 return energy;
10374 }
10375
10376
10378 {
10379 super.OnEnergyConsumed();
10380
10382 }
10383
10385 {
10386 super.OnEnergyAdded();
10387
10389 }
10390
10391
10393 {
10394 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10395 {
10397 {
10398 float energy_0to1 = GetCompEM().GetEnergy0To1();
10400 }
10401 }
10402 }
10403
10404
10406 {
10407 return ConfigGetFloat("heatIsolation");
10408 }
10409
10411 {
10413 }
10414
10416 {
10417 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10418 if (
g_Game.ConfigIsExisting(paramPath))
10419 return g_Game.ConfigGetFloat(paramPath);
10420
10421 return 0.0;
10422 }
10423
10425 {
10426 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10427 if (
g_Game.ConfigIsExisting(paramPath))
10428 return g_Game.ConfigGetFloat(paramPath);
10429
10430 return 0.0;
10431 }
10432
10433 override void SetWet(
float value,
bool allow_client =
false)
10434 {
10435 if (!IsServerCheck(allow_client))
10436 return;
10437
10440
10442
10443 m_VarWet = Math.Clamp(value, min, max);
10444
10446 {
10449 }
10450 }
10451
10452 override void AddWet(
float value)
10453 {
10455 }
10456
10458 {
10460 }
10461
10463 {
10465 }
10466
10468 {
10470 }
10471
10473 {
10475 }
10476
10478 {
10480 }
10481
10482 override void OnWetChanged(
float newVal,
float oldVal)
10483 {
10486 if (newLevel != oldLevel)
10487 {
10489 }
10490 }
10491
10493 {
10494 SetWeightDirty();
10495 }
10496
10498 {
10499 return GetWetLevelInternal(
m_VarWet);
10500 }
10501
10502
10503
10505 {
10507 }
10508
10510 {
10512 }
10513
10515 {
10517 }
10518
10520 {
10522 }
10523
10524
10525
10527 {
10528 if (ConfigIsExisting("itemModelLength"))
10529 {
10530 return ConfigGetFloat("itemModelLength");
10531 }
10532 return 0;
10533 }
10534
10536 {
10537 if (ConfigIsExisting("itemAttachOffset"))
10538 {
10539 return ConfigGetFloat("itemAttachOffset");
10540 }
10541 return 0;
10542 }
10543
10544 override void SetCleanness(
int value,
bool allow_client =
false)
10545 {
10546 if (!IsServerCheck(allow_client))
10547 return;
10548
10550
10552
10555 }
10556
10558 {
10560 }
10561
10563 {
10564 return true;
10565 }
10566
10567
10568
10569
10571 {
10573 }
10574
10576 {
10578 }
10579
10580
10581
10582
10583 override void SetColor(
int r,
int g,
int b,
int a)
10584 {
10590 }
10592 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10593 {
10598 }
10599
10601 {
10603 }
10604
10607 {
10608 int r,g,b,a;
10610 r = r/255;
10611 g = g/255;
10612 b = b/255;
10613 a = a/255;
10614 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10615 }
10616
10617
10618
10619 override void SetLiquidType(
int value,
bool allow_client =
false)
10620 {
10621 if (!IsServerCheck(allow_client))
10622 return;
10623
10628 }
10629
10631 {
10632 return ConfigGetInt("varLiquidTypeInit");
10633 }
10634
10636 {
10638 }
10639
10641 {
10643 SetFrozen(false);
10644 }
10645
10648 {
10649 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10650 }
10651
10652
10655 {
10656 PlayerBase nplayer;
10657 if (PlayerBase.CastTo(nplayer, player))
10658 {
10660 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10661 }
10662 }
10663
10664
10667 {
10668 PlayerBase nplayer;
10669 if (PlayerBase.CastTo(nplayer,player))
10670 {
10671 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10672 }
10673
10674 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10675
10676 if (HasEnergyManager())
10677 {
10678 GetCompEM().UpdatePlugState();
10679 }
10680 }
10681
10682
10684 {
10685 super.OnPlacementStarted(player);
10686
10688 }
10689
10690 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10691 {
10693 {
10694 m_AdminLog.OnPlacementComplete(player,
this);
10695 }
10696
10697 super.OnPlacementComplete(player, position, orientation);
10698 }
10699
10700
10701
10702
10703
10705 {
10707 {
10708 return true;
10709 }
10710 else
10711 {
10712 return false;
10713 }
10714 }
10715
10716
10718 {
10720 {
10722 }
10723 }
10724
10725
10727 {
10729 }
10730
10732 {
10734 }
10735
10736 override void InsertAgent(
int agent,
float count = 1)
10737 {
10738 if (count < 1)
10739 return;
10740
10742 }
10743
10746 {
10748 }
10749
10750
10752 {
10754 }
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10798 {
10800 return false;
10801 return true;
10802 }
10803
10805 {
10806
10808 }
10809
10810
10813 {
10814 super.CheckForRoofLimited(timeTresholdMS);
10815
10816 float time =
g_Game.GetTime();
10817 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10818 {
10819 m_PreviousRoofTestTime = time;
10820 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10821 }
10822 }
10823
10824
10826 {
10828 {
10829 return 0;
10830 }
10831
10832 if (GetInventory().GetAttachmentSlotsCount() != 0)
10833 {
10834 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10835 if (filter)
10836 return filter.GetProtectionLevel(type, false, system);
10837 else
10838 return 0;
10839 }
10840
10841 string subclassPath, entryName;
10842
10843 switch (type)
10844 {
10846 entryName = "biological";
10847 break;
10849 entryName = "chemical";
10850 break;
10851 default:
10852 entryName = "biological";
10853 break;
10854 }
10855
10856 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10857
10858 return g_Game.ConfigGetFloat(subclassPath + entryName);
10859 }
10860
10861
10862
10865 {
10866 if (!IsMagazine())
10868
10870 }
10871
10872
10873
10874
10875
10880 {
10881 return true;
10882 }
10883
10885 {
10887 }
10888
10889
10890
10891
10892
10894 {
10895 if (parent)
10896 {
10897 if (parent.IsInherited(DayZInfected))
10898 return true;
10899
10900 if (!parent.IsRuined())
10901 return true;
10902 }
10903
10904 return true;
10905 }
10906
10908 {
10909 if (!super.CanPutAsAttachment(parent))
10910 {
10911 return false;
10912 }
10913
10914 if (!IsRuined() && !parent.IsRuined())
10915 {
10916 return true;
10917 }
10918
10919 return false;
10920 }
10921
10923 {
10924
10925
10926
10927
10928 return super.CanReceiveItemIntoCargo(item);
10929 }
10930
10932 {
10933
10934
10935
10936
10937 GameInventory attachmentInv = attachment.GetInventory();
10939 {
10940 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10941 return false;
10942 }
10943
10944 InventoryLocation loc = new InventoryLocation();
10945 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10946 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10947 return false;
10948
10949 return super.CanReceiveAttachment(attachment, slotId);
10950 }
10951
10953 {
10954 if (!super.CanReleaseAttachment(attachment))
10955 return false;
10956
10957 return GetInventory().AreChildrenAccessible();
10958 }
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10981 {
10982 int id = muzzle_owner.GetMuzzleID();
10983 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10984
10985 if (WPOF_array)
10986 {
10987 for (int i = 0; i < WPOF_array.Count(); i++)
10988 {
10989 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10990
10991 if (WPOF)
10992 {
10993 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10994 }
10995 }
10996 }
10997 }
10998
10999
11001 {
11002 int id = muzzle_owner.GetMuzzleID();
11004
11005 if (WPOBE_array)
11006 {
11007 for (int i = 0; i < WPOBE_array.Count(); i++)
11008 {
11009 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11010
11011 if (WPOBE)
11012 {
11013 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11014 }
11015 }
11016 }
11017 }
11018
11019
11021 {
11022 int id = muzzle_owner.GetMuzzleID();
11023 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11024
11025 if (WPOOH_array)
11026 {
11027 for (int i = 0; i < WPOOH_array.Count(); i++)
11028 {
11029 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11030
11031 if (WPOOH)
11032 {
11033 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11034 }
11035 }
11036 }
11037 }
11038
11039
11041 {
11042 int id = muzzle_owner.GetMuzzleID();
11043 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11044
11045 if (WPOOH_array)
11046 {
11047 for (int i = 0; i < WPOOH_array.Count(); i++)
11048 {
11049 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11050
11051 if (WPOOH)
11052 {
11053 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11054 }
11055 }
11056 }
11057 }
11058
11059
11061 {
11062 int id = muzzle_owner.GetMuzzleID();
11063 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11064
11065 if (WPOOH_array)
11066 {
11067 for (int i = 0; i < WPOOH_array.Count(); i++)
11068 {
11069 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11070
11071 if (WPOOH)
11072 {
11073 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11074 }
11075 }
11076 }
11077 }
11078
11079
11080
11082 {
11084 {
11085 return true;
11086 }
11087
11088 return false;
11089 }
11090
11092 {
11094 {
11095 return true;
11096 }
11097
11098 return false;
11099 }
11100
11102 {
11104 {
11105 return true;
11106 }
11107
11108 return false;
11109 }
11110
11112 {
11113 return false;
11114 }
11115
11118 {
11119 return UATimeSpent.DEFAULT_DEPLOY;
11120 }
11121
11122
11123
11124
11126 {
11128 SetSynchDirty();
11129 }
11130
11132 {
11134 }
11135
11136
11138 {
11139 return false;
11140 }
11141
11144 {
11145 string att_type = "None";
11146
11147 if (ConfigIsExisting("soundAttType"))
11148 {
11149 att_type = ConfigGetString("soundAttType");
11150 }
11151
11153 }
11154
11156 {
11158 }
11159
11160
11161
11162
11163
11169
11171 {
11174
11176 }
11177
11178
11180 {
11182 return;
11183
11185
11188
11191
11192 SoundParameters params = new SoundParameters();
11196 }
11197
11198
11200 {
11202 {
11205
11206 SetSynchDirty();
11207
11210 }
11211 }
11212
11214 {
11216 }
11217
11218
11220 {
11222 return;
11223
11225 SetSynchDirty();
11226
11229 }
11230
11232 {
11235 }
11236
11238 {
11240 }
11241
11242 void OnApply(PlayerBase player);
11243
11245 {
11246 return 1.0;
11247 };
11248
11250 {
11252 }
11253
11255 {
11257 }
11258
11260
11262 {
11263 SetDynamicPhysicsLifeTime(0.01);
11265 }
11266
11268 {
11269 array<string> zone_names = new array<string>;
11270 GetDamageZones(zone_names);
11271 for (int i = 0; i < zone_names.Count(); i++)
11272 {
11273 SetHealthMax(zone_names.Get(i),"Health");
11274 }
11275 SetHealthMax("","Health");
11276 }
11277
11280 {
11281 float global_health = GetHealth01("","Health");
11282 array<string> zones = new array<string>;
11283 GetDamageZones(zones);
11284
11285 for (int i = 0; i < zones.Count(); i++)
11286 {
11287 SetHealth01(zones.Get(i),"Health",global_health);
11288 }
11289 }
11290
11293 {
11294 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11295 }
11296
11298 {
11299 if (!hasRootAsPlayer)
11300 {
11301 if (refParentIB)
11302 {
11303
11304 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11305 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11306
11307 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11308 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11309
11312 }
11313 else
11314 {
11315
11318 }
11319 }
11320 }
11321
11323 {
11325 {
11326 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11327 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11328 {
11329 float heatPermCoef = 1.0;
11331 while (ent)
11332 {
11333 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11334 ent = ent.GetHierarchyParent();
11335 }
11336
11337 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11338 }
11339 }
11340 }
11341
11343 {
11344
11345 EntityAI parent = GetHierarchyParent();
11346 if (!parent)
11347 {
11348 hasParent = false;
11349 hasRootAsPlayer = false;
11350 }
11351 else
11352 {
11353 hasParent = true;
11354 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11355 refParentIB =
ItemBase.Cast(parent);
11356 }
11357 }
11358
11359 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11360 {
11361
11362 }
11363
11365 {
11366
11367 return false;
11368 }
11369
11371 {
11372
11373
11374 return false;
11375 }
11376
11378 {
11379
11380 return false;
11381 }
11382
11385 {
11386 return !GetIsFrozen() &&
IsOpen();
11387 }
11388
11390 {
11391 bool hasParent = false, hasRootAsPlayer = false;
11393
11394 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11395 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11396
11397 if (wwtu || foodDecay)
11398 {
11402
11403 if (processWetness || processTemperature || processDecay)
11404 {
11406
11407 if (processWetness)
11408 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11409
11410 if (processTemperature)
11412
11413 if (processDecay)
11414 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11415 }
11416 }
11417 }
11418
11421 {
11423 }
11424
11426 {
11429
11430 return super.GetTemperatureFreezeThreshold();
11431 }
11432
11434 {
11437
11438 return super.GetTemperatureThawThreshold();
11439 }
11440
11442 {
11445
11446 return super.GetItemOverheatThreshold();
11447 }
11448
11450 {
11452 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11453
11454 return super.GetTemperatureFreezeTime();
11455 }
11456
11458 {
11460 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11461
11462 return super.GetTemperatureThawTime();
11463 }
11464
11469
11471 {
11472 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11473 }
11474
11476 {
11477 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11478 }
11479
11482 {
11484 }
11485
11487 {
11489 }
11490
11492 {
11494 }
11495
11498 {
11499 return null;
11500 }
11501
11504 {
11505 return false;
11506 }
11507
11509 {
11511 {
11514 if (!trg)
11515 {
11517 explosive = this;
11518 }
11519
11520 explosive.PairRemote(trg);
11522
11523 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11524 trg.SetPersistentPairID(persistentID);
11525 explosive.SetPersistentPairID(persistentID);
11526
11527 return true;
11528 }
11529 return false;
11530 }
11531
11534 {
11535 float ret = 1.0;
11538 ret *= GetHealth01();
11539
11540 return ret;
11541 }
11542
11543 #ifdef DEVELOPER
11544 override void SetDebugItem()
11545 {
11546 super.SetDebugItem();
11547 _itemBase = this;
11548 }
11549
11551 {
11552 string text = super.GetDebugText();
11553
11555 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11556
11557 return text;
11558 }
11559 #endif
11560
11562 {
11563 return true;
11564 }
11565
11567
11569
11571 {
11574 }
11575
11576
11584
11600
11601 [
Obsolete(
"Use ItemSoundHandler instead")]
11604 {
11605 if (!
g_Game.IsDedicatedServer())
11606 {
11607 if (ConfigIsExisting("attachSoundSet"))
11608 {
11609 string cfg_path = "";
11610 string soundset = "";
11611 string type_name =
GetType();
11612
11615 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11616 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11617
11618 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11619 {
11620 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11621 {
11622 if (cfg_slot_array[i] == slot_type)
11623 {
11624 soundset = cfg_soundset_array[i];
11625 break;
11626 }
11627 }
11628 }
11629
11630 if (soundset != "")
11631 {
11632 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11634 }
11635 }
11636 }
11637 }
11638
11640}
11641
11643{
11645 if (entity)
11646 {
11647 bool is_item = entity.IsInherited(
ItemBase);
11648 if (is_item && full_quantity)
11649 {
11652 }
11653 }
11654 else
11655 {
11657 return NULL;
11658 }
11659 return entity;
11660}
11661
11663{
11664 if (item)
11665 {
11666 if (health > 0)
11667 item.SetHealth("", "", health);
11668
11669 if (item.CanHaveTemperature())
11670 {
11672 if (item.CanFreeze())
11673 item.SetFrozen(false);
11674 }
11675
11676 if (item.HasEnergyManager())
11677 {
11678 if (quantity >= 0)
11679 {
11680 item.GetCompEM().SetEnergy0To1(quantity);
11681 }
11682 else
11683 {
11685 }
11686 }
11687 else if (item.IsMagazine())
11688 {
11689 Magazine mag = Magazine.Cast(item);
11690 if (quantity >= 0)
11691 {
11692 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11693 }
11694 else
11695 {
11697 }
11698
11699 }
11700 else
11701 {
11702 if (quantity >= 0)
11703 {
11704 item.SetQuantityNormalized(quantity, false);
11705 }
11706 else
11707 {
11709 }
11710
11711 }
11712 }
11713}
11714
11715#ifdef DEVELOPER
11717#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.