6852{
6854 {
6855 return true;
6856 }
6857};
6858
6860{
6861
6862};
6863
6864
6865
6867{
6871
6873
6876
6877
6878
6879
6880
6889
6895
6900
6905
6926 protected bool m_IsResultOfSplit
6927
6929
6934
6935
6936
6938
6942
6943
6944
6946
6949
6950
6951
6957
6958
6966
6969
6970
6972
6973
6975
6976
6981
6982
6987
6989
6990
6992
6993
6995 {
7000
7001 if (!
g_Game.IsDedicatedServer())
7002 {
7004 {
7006
7008 {
7010 }
7011 }
7012
7015 }
7016
7017 m_OldLocation = null;
7018
7020 {
7022 }
7023
7024 if (ConfigIsExisting("headSelectionsToHide"))
7025 {
7028 }
7029
7031 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7032 {
7034 }
7035
7037
7038 m_IsResultOfSplit = false;
7039
7041 }
7042
7044 {
7045 super.InitItemVariables();
7046
7052 m_Count = ConfigGetInt(
"count");
7053
7056
7061
7064
7069
7081
7085
7086
7089 if (ConfigIsExisting("canBeSplit"))
7090 {
7093 }
7094
7096 if (ConfigIsExisting("itemBehaviour"))
7098
7099
7102 RegisterNetSyncVariableInt("m_VarLiquidType");
7103 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7104
7105 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7106 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7107 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7108
7109 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7110 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7111 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7112 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7113
7114 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7115 RegisterNetSyncVariableBool("m_IsTakeable");
7116 RegisterNetSyncVariableBool("m_IsHologram");
7117
7120 {
7123 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7124 }
7125
7127
7129 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7131
7133 }
7134
7136 {
7138 }
7139
7141 {
7144 {
7149 }
7150 }
7151
7152 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7153 {
7155 {
7158 }
7159
7161 }
7162
7164 {
7170 }
7171
7173
7175 {
7177
7178 if (!action)
7179 {
7180 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7181 return;
7182 }
7183
7185 if (!ai)
7186 {
7188 return;
7189 }
7190
7192 if (!action_array)
7193 {
7194 action_array = new array<ActionBase_Basic>;
7196 }
7197 if (LogManager.IsActionLogEnable())
7198 {
7199 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7200 }
7201
7202 if (action_array.Find(action) != -1)
7203 {
7204 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7205 }
7206 else
7207 {
7208 action_array.Insert(action);
7209 }
7210 }
7211
7213 {
7214 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7215 ActionBase action = player.GetActionManager().GetAction(actionName);
7218
7219 if (action_array)
7220 {
7221 action_array.RemoveItem(action);
7222 }
7223 }
7224
7225
7226
7228 {
7229 ActionOverrideData overrideData = new ActionOverrideData();
7233
7235 if (!actionMap)
7236 {
7239 }
7240
7241 actionMap.Insert(this.
Type(), overrideData);
7242
7243 }
7244
7246
7248
7249
7251 {
7254
7257
7258 string config_to_search = "CfgVehicles";
7259 string muzzle_owner_config;
7260
7262 {
7263 if (IsInherited(Weapon))
7264 config_to_search = "CfgWeapons";
7265
7266 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7267
7268 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7269
7270 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7271
7272 if (config_OnFire_subclass_count > 0)
7273 {
7274 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7275
7276 for (int i = 0; i < config_OnFire_subclass_count; i++)
7277 {
7278 string particle_class = "";
7279 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7280 string config_OnFire_entry = config_OnFire_class + particle_class;
7281 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7282 WPOF_array.Insert(WPOF);
7283 }
7284
7285
7287 }
7288 }
7289
7291 {
7292 config_to_search = "CfgWeapons";
7293 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7294
7295 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7296
7297 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7298
7299 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7300 {
7301 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7302
7303 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7304 {
7305 string particle_class2 = "";
7306 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7307 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7308 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7309 WPOBE_array.Insert(WPOBE);
7310 }
7311
7312
7314 }
7315 }
7316 }
7317
7318
7320 {
7323
7325 {
7326 string config_to_search = "CfgVehicles";
7327
7328 if (IsInherited(Weapon))
7329 config_to_search = "CfgWeapons";
7330
7331 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7332 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7333
7334 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7335 {
7336
7338
7340 {
7342 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7344 return;
7345 }
7346
7349
7350
7351
7352 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7353 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7354
7355 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7356 {
7357 string particle_class = "";
7358 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7359 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7360 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7361
7362 if (entry_type == CT_CLASS)
7363 {
7364 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7365 WPOOH_array.Insert(WPOF);
7366 }
7367 }
7368
7369
7371 }
7372 }
7373 }
7374
7376 {
7378 }
7379
7381 {
7383 {
7385
7388
7391
7392 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7393 }
7394 }
7395
7397 {
7399 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7400
7402 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7403
7405 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7406
7408 {
7410 }
7411 }
7412
7414 {
7416 }
7417
7419 {
7422 else
7424
7426 {
7429 }
7430 else
7431 {
7434
7437 }
7438
7440 }
7441
7443 {
7445 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7446 }
7447
7449 {
7451 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7453 }
7454
7456 {
7458 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7459 }
7460
7462 {
7465
7466 OverheatingParticle OP = new OverheatingParticle();
7471
7473 }
7474
7476 {
7479
7480 return -1;
7481 }
7482
7484 {
7486 {
7489
7490 for (int i = count; i > 0; --i)
7491 {
7492 int id = i - 1;
7495
7498
7499 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7500 {
7501 if (p)
7502 {
7505 }
7506 }
7507 }
7508 }
7509 }
7510
7512 {
7514 {
7516 {
7517 int id = i - 1;
7519
7520 if (OP)
7521 {
7523
7524 if (p)
7525 {
7527 }
7528
7529 delete OP;
7530 }
7531 }
7532
7535 }
7536 }
7537
7540 {
7541 return 0.0;
7542 }
7543
7544
7546 {
7547 return 250;
7548 }
7549
7551 {
7552 return 0;
7553 }
7554
7557 {
7559 return true;
7560
7561 return false;
7562 }
7563
7566 {
7569
7571 {
7573 }
7574 else
7575 {
7576
7578 }
7579
7581 }
7582
7589 {
7590 return -1;
7591 }
7592
7593
7594
7595
7597 {
7599 {
7600 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7601 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7602
7603 if (r_index >= 0)
7604 {
7605 InventoryLocation r_il = new InventoryLocation;
7606 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7607
7608 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7611 {
7612 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7613 }
7615 {
7616 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7617 }
7618
7619 }
7620
7621 player.GetHumanInventory().ClearUserReservedLocation(this);
7622 }
7623
7626 }
7627
7628
7629
7630
7632 {
7633 return ItemBase.m_DebugActionsMask;
7634 }
7635
7637 {
7638 return ItemBase.m_DebugActionsMask & mask;
7639 }
7640
7642 {
7643 ItemBase.m_DebugActionsMask = mask;
7644 }
7645
7647 {
7648 ItemBase.m_DebugActionsMask |= mask;
7649 }
7650
7652 {
7653 ItemBase.m_DebugActionsMask &= ~mask;
7654 }
7655
7657 {
7659 {
7661 }
7662 else
7663 {
7665 }
7666 }
7667
7668
7670 {
7671 if (GetEconomyProfile())
7672 {
7673 float q_max = GetEconomyProfile().GetQuantityMax();
7674 if (q_max > 0)
7675 {
7676 float q_min = GetEconomyProfile().GetQuantityMin();
7677 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7678
7680 {
7681 ComponentEnergyManager comp = GetCompEM();
7683 {
7685 }
7686 }
7688 {
7690
7691 }
7692
7693 }
7694 }
7695 }
7696
7699 {
7700 EntityAI parent = GetHierarchyParent();
7701
7702 if (parent)
7703 {
7704 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7705 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7706 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7707 }
7708 }
7709
7712 {
7713 EntityAI parent = GetHierarchyParent();
7714
7715 if (parent)
7716 {
7717 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7718 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7719 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7720 }
7721 }
7722
7724 {
7725
7726
7727
7728
7730
7732 {
7733 if (ScriptInputUserData.CanStoreInputUserData())
7734 {
7735 ScriptInputUserData ctx = new ScriptInputUserData;
7741 ctx.
Write(use_stack_max);
7744
7746 {
7747 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7748 }
7749 }
7750 }
7751 else if (!
g_Game.IsMultiplayer())
7752 {
7754 }
7755 }
7756
7758 {
7760 }
7761
7763 {
7765 }
7766
7768 {
7770 }
7771
7773 {
7774
7775 return false;
7776 }
7777
7779 {
7780 return false;
7781 }
7782
7786 {
7787 return false;
7788 }
7789
7791 {
7792 return "";
7793 }
7794
7796
7798 {
7799 return false;
7800 }
7801
7803 {
7804 return true;
7805 }
7806
7807
7808
7810 {
7811 return true;
7812 }
7813
7815 {
7816 return true;
7817 }
7818
7820 {
7821 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7823 }
7824
7826 {
7828 }
7829
7831 {
7833 if (!is_being_placed)
7835 SetSynchDirty();
7836 }
7837
7838
7840
7842 {
7844 }
7845
7847 {
7849 }
7850
7852 {
7853 return 1;
7854 }
7855
7857 {
7858 return false;
7859 }
7860
7862 {
7864 SetSynchDirty();
7865 }
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7902 {
7903 super.OnMovedInsideCargo(container);
7904
7905 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7906 }
7907
7908 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7909 {
7910 super.EEItemLocationChanged(oldLoc, newLoc);
7911
7912 PlayerBase newPlayer = null;
7913 PlayerBase oldPlayer = null;
7914
7915 if (newLoc.GetParent())
7916 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7917
7918 if (oldLoc.GetParent())
7919 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7920
7922 {
7923 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7924
7925 if (rIndex >= 0)
7926 {
7927 InventoryLocation rIl = new InventoryLocation;
7928 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7929
7930 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7933 {
7934 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7935 }
7937 {
7939 }
7940
7941 }
7942 }
7943
7945 {
7946 if (newPlayer)
7947 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7948
7949 if (newPlayer == oldPlayer)
7950 {
7951 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7952 {
7954 {
7955 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7956 {
7957 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7958 }
7959 }
7960 else
7961 {
7962 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7963 }
7964 }
7965
7966 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7967 {
7968 int type = oldLoc.GetType();
7970 {
7971 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7972 }
7974 {
7975 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7976 }
7977 }
7978 if (!m_OldLocation)
7979 {
7980 m_OldLocation = new InventoryLocation;
7981 }
7982 m_OldLocation.Copy(oldLoc);
7983 }
7984 else
7985 {
7986 if (m_OldLocation)
7987 {
7988 m_OldLocation.Reset();
7989 }
7990 }
7991
7992 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7993 }
7994 else
7995 {
7996 if (newPlayer)
7997 {
7998 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7999 if (resIndex >= 0)
8000 {
8001 InventoryLocation il = new InventoryLocation;
8002 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8004 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8007 {
8008 il.
GetParent().GetOnReleaseLock().Invoke(it);
8009 }
8011 {
8013 }
8014
8015 }
8016 }
8018 {
8019
8021 }
8022
8023 if (m_OldLocation)
8024 {
8025 m_OldLocation.Reset();
8026 }
8027 }
8028
8030 {
8031 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8032 }
8033
8035 {
8036 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8037 }
8038 }
8039
8040 override void EOnContact(IEntity other, Contact extra)
8041 {
8043 {
8044 int liquidType = -1;
8046 if (impactSpeed > 0.0)
8047 {
8049 #ifndef SERVER
8051 #else
8053 SetSynchDirty();
8054 #endif
8056 }
8057 }
8058
8059 #ifdef SERVER
8060 if (GetCompEM() && GetCompEM().IsPlugged())
8061 {
8062 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8063 GetCompEM().UnplugThis();
8064 }
8065 #endif
8066 }
8067
8069
8071 {
8073 }
8074
8076 {
8077
8078 }
8079
8081 {
8082 super.OnItemLocationChanged(old_owner, new_owner);
8083
8084 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8085 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8086
8087 if (!relatedPlayer && playerNew)
8088 relatedPlayer = playerNew;
8089
8090 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8091 {
8093 if (actionMgr)
8094 {
8095 ActionBase currentAction = actionMgr.GetRunningAction();
8096 if (currentAction)
8098 }
8099 }
8100
8101 Man ownerPlayerOld = null;
8102 Man ownerPlayerNew = null;
8103
8104 if (old_owner)
8105 {
8106 if (old_owner.
IsMan())
8107 {
8108 ownerPlayerOld = Man.Cast(old_owner);
8109 }
8110 else
8111 {
8112 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8113 }
8114 }
8115 else
8116 {
8118 {
8120
8121 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8122 {
8123 GetCompEM().UnplugThis();
8124 }
8125 }
8126 }
8127
8128 if (new_owner)
8129 {
8130 if (new_owner.
IsMan())
8131 {
8132 ownerPlayerNew = Man.Cast(new_owner);
8133 }
8134 else
8135 {
8136 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8137 }
8138 }
8139
8140 if (ownerPlayerOld != ownerPlayerNew)
8141 {
8142 if (ownerPlayerOld)
8143 {
8144 array<EntityAI> subItemsExit = new array<EntityAI>;
8146 for (int i = 0; i < subItemsExit.Count(); i++)
8147 {
8150 }
8151 }
8152
8153 if (ownerPlayerNew)
8154 {
8155 array<EntityAI> subItemsEnter = new array<EntityAI>;
8157 for (int j = 0; j < subItemsEnter.Count(); j++)
8158 {
8161 }
8162 }
8163 }
8164 else if (ownerPlayerNew != null)
8165 {
8166 PlayerBase nplayer;
8167 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8168 {
8169 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8171 for (int k = 0; k < subItemsUpdate.Count(); k++)
8172 {
8174 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8175 }
8176 }
8177 }
8178
8179 if (old_owner)
8180 old_owner.OnChildItemRemoved(this);
8181 if (new_owner)
8182 new_owner.OnChildItemReceived(this);
8183 }
8184
8185
8187 {
8188 super.EEDelete(parent);
8189 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8190 if (player)
8191 {
8193
8194 if (player.IsAlive())
8195 {
8196 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8197 if (r_index >= 0)
8198 {
8199 InventoryLocation r_il = new InventoryLocation;
8200 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8201
8202 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8205 {
8206 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8207 }
8209 {
8210 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8211 }
8212
8213 }
8214
8215 player.RemoveQuickBarEntityShortcut(this);
8216 }
8217 }
8218 }
8219
8221 {
8222 super.EEKilled(killer);
8223
8226 {
8227 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8228 {
8229 if (IsMagazine())
8230 {
8231 if (Magazine.Cast(this).GetAmmoCount() > 0)
8232 {
8234 }
8235 }
8236 else
8237 {
8239 }
8240 }
8241 }
8242 }
8243
8245 {
8246 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8247
8248 super.OnWasAttached(parent, slot_id);
8249
8252
8255 }
8256
8258 {
8259 super.OnWasDetached(parent, slot_id);
8260
8263
8266 }
8267
8269 {
8270 int idx;
8273
8274 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8275 if (inventory_slots.Count() < 1)
8276 {
8277 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8278 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8279 }
8280 else
8281 {
8282 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8283 }
8284
8285 idx = inventory_slots.Find(slot);
8286 if (idx < 0)
8287 return "";
8288
8289 return attach_types.Get(idx);
8290 }
8291
8293 {
8294 int idx = -1;
8295 string slot;
8296
8299
8300 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8301 if (inventory_slots.Count() < 1)
8302 {
8303 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8304 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8305 }
8306 else
8307 {
8308 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8309 if (detach_types.Count() < 1)
8310 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8311 }
8312
8313 for (int i = 0; i < inventory_slots.Count(); i++)
8314 {
8315 slot = inventory_slots.Get(i);
8316 }
8317
8318 if (slot != "")
8319 {
8320 if (detach_types.Count() == 1)
8321 idx = 0;
8322 else
8323 idx = inventory_slots.Find(slot);
8324 }
8325 if (idx < 0)
8326 return "";
8327
8328 return detach_types.Get(idx);
8329 }
8330
8332 {
8333
8335
8336
8337 float min_time = 1;
8338 float max_time = 3;
8339 float delay = Math.RandomFloat(min_time, max_time);
8340
8341 explode_timer.Run(delay, this, "DoAmmoExplosion");
8342 }
8343
8345 {
8346 Magazine magazine = Magazine.Cast(this);
8347 int pop_sounds_count = 6;
8348 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8349
8350
8351 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8352 string sound_name = pop_sounds[ sound_idx ];
8353 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8354
8355
8356 magazine.ServerAddAmmoCount(-1);
8357
8358
8359 float min_temp_to_explode = 100;
8360
8361 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8362 {
8364 }
8365 }
8366
8367
8368 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8369 {
8370 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8371
8372 const int CHANCE_DAMAGE_CARGO = 4;
8373 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8374 const int CHANCE_DAMAGE_NOTHING = 2;
8375
8377 {
8378 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8379 int chances;
8380 int rnd;
8381
8382 if (GetInventory().GetCargo())
8383 {
8384 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8385 rnd = Math.RandomInt(0,chances);
8386
8387 if (rnd < CHANCE_DAMAGE_CARGO)
8388 {
8390 }
8391 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8392 {
8394 }
8395 }
8396 else
8397 {
8398 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8399 rnd = Math.RandomInt(0,chances);
8400
8401 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8402 {
8404 }
8405 }
8406 }
8407 }
8408
8410 {
8411 CargoBase cargo = GetInventory().GetCargo();
8412 if (cargo)
8413 {
8415 if (item_count > 0)
8416 {
8417 int random_pick = Math.RandomInt(0, item_count);
8419 if (!item.IsExplosive())
8420 {
8421 item.AddHealth("","",damage);
8422 return true;
8423 }
8424 }
8425 }
8426 return false;
8427 }
8428
8430 {
8431 GameInventory inventory = GetInventory();
8433 if (attachment_count > 0)
8434 {
8435 int random_pick = Math.RandomInt(0, attachment_count);
8437 if (!attachment.IsExplosive())
8438 {
8439 attachment.AddHealth("","",damage);
8440 return true;
8441 }
8442 }
8443 return false;
8444 }
8445
8447 {
8449 }
8450
8452 {
8454 return GetInventory().CanRemoveEntity();
8455
8456 return false;
8457 }
8458
8460 {
8461
8463 return false;
8464
8465
8467 return false;
8468
8469
8470
8472 if (delta == 0)
8473 return false;
8474
8475
8476 return true;
8477 }
8478
8480 {
8482 {
8483 if (ScriptInputUserData.CanStoreInputUserData())
8484 {
8485 ScriptInputUserData ctx = new ScriptInputUserData;
8490 ctx.
Write(destination_entity);
8494 }
8495 }
8496 else if (!
g_Game.IsMultiplayer())
8497 {
8499 }
8500 }
8501
8503 {
8504 float split_quantity_new;
8508 InventoryLocation loc = new InventoryLocation;
8509
8510 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8511 {
8513 split_quantity_new = stack_max;
8514 else
8516
8518 {
8519 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8520 if (new_item)
8521 {
8522 new_item.SetResultOfSplit(true);
8523 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8525 new_item.
SetQuantity(split_quantity_new,
false,
true);
8526 }
8527 }
8528 }
8529 else if (destination_entity && slot_id == -1)
8530 {
8531 if (quantity > stack_max)
8532 split_quantity_new = stack_max;
8533 else
8534 split_quantity_new = quantity;
8535
8537 {
8538 GameInventory destinationInventory = destination_entity.GetInventory();
8540 {
8543 }
8544
8545 if (new_item)
8546 {
8547 new_item.SetResultOfSplit(true);
8548 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8550 new_item.
SetQuantity(split_quantity_new,
false,
true);
8551 }
8552 }
8553 }
8554 else
8555 {
8556 if (stack_max != 0)
8557 {
8559 {
8561 }
8562
8563 if (split_quantity_new == 0)
8564 {
8565 if (!
g_Game.IsMultiplayer())
8566 player.PhysicalPredictiveDropItem(this);
8567 else
8568 player.ServerDropEntity(this);
8569 return;
8570 }
8571
8573 {
8575
8576 if (new_item)
8577 {
8578 new_item.SetResultOfSplit(true);
8579 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8582 new_item.PlaceOnSurface();
8583 }
8584 }
8585 }
8586 }
8587 }
8588
8590 {
8591 float split_quantity_new;
8595 InventoryLocation loc = new InventoryLocation;
8596
8597 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8598 {
8600 split_quantity_new = stack_max;
8601 else
8603
8605 {
8606 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8607 if (new_item)
8608 {
8609 new_item.SetResultOfSplit(true);
8610 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8612 new_item.
SetQuantity(split_quantity_new,
false,
true);
8613 }
8614 }
8615 }
8616 else if (destination_entity && slot_id == -1)
8617 {
8618 if (quantity > stack_max)
8619 split_quantity_new = stack_max;
8620 else
8621 split_quantity_new = quantity;
8622
8624 {
8625 GameInventory destinationInventory = destination_entity.GetInventory();
8627 {
8630 }
8631
8632 if (new_item)
8633 {
8634 new_item.SetResultOfSplit(true);
8635 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8637 new_item.
SetQuantity(split_quantity_new,
false,
true);
8638 }
8639 }
8640 }
8641 else
8642 {
8643 if (stack_max != 0)
8644 {
8646 {
8648 }
8649
8651 {
8653
8654 if (new_item)
8655 {
8656 new_item.SetResultOfSplit(true);
8657 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8660 new_item.PlaceOnSurface();
8661 }
8662 }
8663 }
8664 }
8665 }
8666
8668 {
8670 {
8671 if (ScriptInputUserData.CanStoreInputUserData())
8672 {
8673 ScriptInputUserData ctx = new ScriptInputUserData;
8678 dst.WriteToContext(ctx);
8680 }
8681 }
8682 else if (!
g_Game.IsMultiplayer())
8683 {
8685 }
8686 }
8687
8689 {
8691 {
8692 if (ScriptInputUserData.CanStoreInputUserData())
8693 {
8694 ScriptInputUserData ctx = new ScriptInputUserData;
8699 ctx.
Write(destination_entity);
8705 }
8706 }
8707 else if (!
g_Game.IsMultiplayer())
8708 {
8710 }
8711 }
8712
8714 {
8716 }
8717
8719 {
8721 float split_quantity_new;
8723 if (dst.IsValid())
8724 {
8725 int slot_id = dst.GetSlot();
8727
8728 if (quantity > stack_max)
8729 split_quantity_new = stack_max;
8730 else
8731 split_quantity_new = quantity;
8732
8734 {
8736
8737 if (new_item)
8738 {
8739 new_item.SetResultOfSplit(true);
8740 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8742 new_item.
SetQuantity(split_quantity_new,
false,
true);
8743 }
8744
8745 return new_item;
8746 }
8747 }
8748
8749 return null;
8750 }
8751
8753 {
8755 float split_quantity_new;
8757 if (destination_entity)
8758 {
8760 if (quantity > stackable)
8761 split_quantity_new = stackable;
8762 else
8763 split_quantity_new = quantity;
8764
8766 {
8767 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8768 if (new_item)
8769 {
8770 new_item.SetResultOfSplit(true);
8771 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8773 new_item.
SetQuantity(split_quantity_new,
false,
true);
8774 }
8775 }
8776 }
8777 }
8778
8780 {
8782 {
8783 if (ScriptInputUserData.CanStoreInputUserData())
8784 {
8785 ScriptInputUserData ctx = new ScriptInputUserData;
8790 ItemBase destination_entity =
this;
8791 ctx.
Write(destination_entity);
8795 }
8796 }
8797 else if (!
g_Game.IsMultiplayer())
8798 {
8800 }
8801 }
8802
8804 {
8806 float split_quantity_new;
8808 if (player)
8809 {
8811 if (quantity > stackable)
8812 split_quantity_new = stackable;
8813 else
8814 split_quantity_new = quantity;
8815
8817 {
8818 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8819 new_item =
ItemBase.Cast(in_hands);
8820 if (new_item)
8821 {
8822 new_item.SetResultOfSplit(true);
8823 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8825 new_item.SetQuantity(split_quantity_new, false, true);
8826 }
8827 }
8828 }
8829 }
8830
8832 {
8834 float split_quantity_new = Math.Floor(quantity * 0.5);
8835
8837 return;
8838
8840
8841 if (new_item)
8842 {
8843 if (new_item.GetQuantityMax() < split_quantity_new)
8844 {
8845 split_quantity_new = new_item.GetQuantityMax();
8846 }
8847
8848 new_item.SetResultOfSplit(true);
8849 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8850
8852 {
8855 }
8856 else
8857 {
8859 new_item.
SetQuantity(split_quantity_new,
false,
true);
8860 }
8861 }
8862 }
8863
8865 {
8867 float split_quantity_new = Math.Floor(quantity / 2);
8868
8870 return;
8871
8872 InventoryLocation invloc = new InventoryLocation;
8874
8876 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8877
8878 if (new_item)
8879 {
8880 if (new_item.GetQuantityMax() < split_quantity_new)
8881 {
8882 split_quantity_new = new_item.GetQuantityMax();
8883 }
8885 {
8888 }
8889 else if (split_quantity_new > 1)
8890 {
8892 new_item.
SetQuantity(split_quantity_new,
false,
true);
8893 }
8894 }
8895 }
8896
8899 {
8900 SetWeightDirty();
8902
8903 if (parent)
8904 parent.OnAttachmentQuantityChangedEx(this, delta);
8905
8907 {
8909 {
8911 }
8913 {
8914 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8916 }
8917 }
8918 }
8919
8922 {
8923
8924 }
8925
8928 {
8930 }
8931
8933 {
8934 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8935
8937 {
8938 if (newLevel == GameConstants.STATE_RUINED)
8939 {
8941 EntityAI parent = GetHierarchyParent();
8942 if (parent && parent.IsFireplace())
8943 {
8944 CargoBase cargo = GetInventory().GetCargo();
8945 if (cargo)
8946 {
8948 {
8950 }
8951 }
8952 }
8953 }
8954
8956 {
8957
8959 return;
8960 }
8961
8962 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8963 {
8965 }
8966 }
8967 }
8968
8969
8971 {
8972 super.OnRightClick();
8973
8975 {
8977 {
8978 if (ScriptInputUserData.CanStoreInputUserData())
8979 {
8980 EntityAI root = GetHierarchyRoot();
8981 Man playerOwner = GetHierarchyRootPlayer();
8982 InventoryLocation dst = new InventoryLocation;
8983
8984
8985 if (!playerOwner && root && root == this)
8986 {
8988 }
8989 else
8990 {
8991
8992 GetInventory().GetCurrentInventoryLocation(dst);
8994 {
8995 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8997 {
8999 }
9000 else
9001 {
9003
9004
9005 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9006 {
9008 }
9009 else
9010 {
9011 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9012 }
9013 }
9014 }
9015 }
9016
9017 ScriptInputUserData ctx = new ScriptInputUserData;
9025 }
9026 }
9027 else if (!
g_Game.IsMultiplayer())
9028 {
9030 }
9031 }
9032 }
9033
9035 {
9036 if (root)
9037 {
9038 vector m4[4];
9039 root.GetTransform(m4);
9040 dst.SetGround(this, m4);
9041 }
9042 else
9043 {
9044 GetInventory().GetCurrentInventoryLocation(dst);
9045 }
9046 }
9047
9048 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9049 {
9050
9051 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9052 return false;
9053
9054 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9055 return false;
9056
9057
9059 return false;
9060
9061
9062 Magazine mag = Magazine.Cast(this);
9063 if (mag)
9064 {
9065 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9066 return false;
9067
9068 if (stack_max_limit)
9069 {
9070 Magazine other_mag = Magazine.Cast(other_item);
9071 if (other_item)
9072 {
9073 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9074 return false;
9075 }
9076
9077 }
9078 }
9079 else
9080 {
9081
9083 return false;
9084
9086 return false;
9087 }
9088
9089 PlayerBase player = null;
9090 if (CastTo(player, GetHierarchyRootPlayer()))
9091 {
9092 if (player.GetInventory().HasAttachment(this))
9093 return false;
9094
9095 if (player.IsItemsToDelete())
9096 return false;
9097 }
9098
9099 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9100 return false;
9101
9102 int slotID;
9104 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9105 return false;
9106
9107 return true;
9108 }
9109
9111 {
9113 }
9114
9116 {
9117 return m_IsResultOfSplit;
9118 }
9119
9121 {
9122 m_IsResultOfSplit = value;
9123 }
9124
9126 {
9128 }
9129
9131 {
9132 float other_item_quantity = other_item.GetQuantity();
9133 float this_free_space;
9134
9136
9138
9139 if (other_item_quantity > this_free_space)
9140 {
9141 return this_free_space;
9142 }
9143 else
9144 {
9145 return other_item_quantity;
9146 }
9147 }
9148
9150 {
9152 }
9153
9155 {
9157 return;
9158
9159 if (!IsMagazine() && other_item)
9160 {
9162 if (quantity_used != 0)
9163 {
9164 float hp1 = GetHealth01("","");
9165 float hp2 = other_item.GetHealth01("","");
9166 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9167 hpResult = hpResult / (
GetQuantity() + quantity_used);
9168
9169 hpResult *= GetMaxHealth();
9170 Math.Round(hpResult);
9171 SetHealth("", "Health", hpResult);
9172
9174 other_item.AddQuantity(-quantity_used);
9175 }
9176 }
9178 }
9179
9181 {
9182 #ifdef SERVER
9183 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9184 GetHierarchyParent().IncreaseLifetimeUp();
9185 #endif
9186 };
9187
9189 {
9190 PlayerBase p = PlayerBase.Cast(player);
9191
9192 array<int> recipesIds = p.m_Recipes;
9193 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9194 if (moduleRecipesManager)
9195 {
9196 EntityAI itemInHands = player.GetEntityInHands();
9197 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9198 }
9199
9200 for (int i = 0;i < recipesIds.Count(); i++)
9201 {
9202 int key = recipesIds.Get(i);
9203 string recipeName = moduleRecipesManager.GetRecipeName(key);
9205 }
9206 }
9207
9208
9209 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9210 {
9211 super.GetDebugActions(outputList);
9212
9213
9219
9220
9225
9230
9231
9235
9236
9238 {
9242 }
9243
9246
9247
9251
9253
9254 InventoryLocation loc = new InventoryLocation();
9255 GetInventory().GetCurrentInventoryLocation(loc);
9257 {
9258 if (Gizmo_IsSupported())
9261 }
9262
9264 }
9265
9266
9267
9268
9270 {
9271 super.OnAction(action_id, player, ctx);
9272
9274 {
9275 switch (action_id)
9276 {
9280 return true;
9284 return true;
9285 }
9286 }
9287
9289 {
9290 switch (action_id)
9291 {
9293 Delete();
9294 return true;
9295 }
9296 }
9297
9298 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9299 {
9300 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9301 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9302 PlayerBase p = PlayerBase.Cast(player);
9303 if (
EActions.RECIPES_RANGE_START < 1000)
9304 {
9305 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9306 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9307 }
9308 }
9309 #ifndef SERVER
9310 else if (action_id ==
EActions.WATCH_PLAYER)
9311 {
9312 PluginDeveloper.SetDeveloperItemClientEx(player);
9313 }
9314 #endif
9316 {
9317 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9318 {
9319 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9320 OnDebugButtonPressServer(id + 1);
9321 }
9322
9323 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9324 {
9325 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9327 }
9328
9329 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9330 {
9331 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9333 }
9334
9335 else if (action_id ==
EActions.ADD_QUANTITY)
9336 {
9337 if (IsMagazine())
9338 {
9339 Magazine mag = Magazine.Cast(this);
9340 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9341 }
9342 else
9343 {
9345 }
9346
9347 if (m_EM)
9348 {
9349 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9350 }
9351
9352 }
9353
9354 else if (action_id ==
EActions.REMOVE_QUANTITY)
9355 {
9356 if (IsMagazine())
9357 {
9358 Magazine mag2 = Magazine.Cast(this);
9359 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9360 }
9361 else
9362 {
9364 }
9365 if (m_EM)
9366 {
9367 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9368 }
9369
9370 }
9371
9372 else if (action_id ==
EActions.SET_QUANTITY_0)
9373 {
9375
9376 if (m_EM)
9377 {
9378 m_EM.SetEnergy(0);
9379 }
9380 }
9381
9382 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9383 {
9385
9386 if (m_EM)
9387 {
9388 m_EM.SetEnergy(m_EM.GetEnergyMax());
9389 }
9390 }
9391
9392 else if (action_id ==
EActions.ADD_HEALTH)
9393 {
9394 AddHealth("","",GetMaxHealth("","Health")/5);
9395 }
9396 else if (action_id ==
EActions.REMOVE_HEALTH)
9397 {
9398 AddHealth("","",-GetMaxHealth("","Health")/5);
9399 }
9400 else if (action_id ==
EActions.DESTROY_HEALTH)
9401 {
9402 SetHealth01("","",0);
9403 }
9404 else if (action_id ==
EActions.WATCH_ITEM)
9405 {
9407 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9408 #ifdef DEVELOPER
9409 SetDebugDeveloper_item(this);
9410 #endif
9411 }
9412
9413 else if (action_id ==
EActions.ADD_TEMPERATURE)
9414 {
9415 AddTemperature(20);
9416
9417 }
9418
9419 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9420 {
9421 AddTemperature(-20);
9422
9423 }
9424
9425 else if (action_id ==
EActions.FLIP_FROZEN)
9426 {
9427 SetFrozen(!GetIsFrozen());
9428
9429 }
9430
9431 else if (action_id ==
EActions.ADD_WETNESS)
9432 {
9434
9435 }
9436
9437 else if (action_id ==
EActions.REMOVE_WETNESS)
9438 {
9440
9441 }
9442
9443 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9444 {
9447
9448
9449 }
9450
9451 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9452 {
9455 }
9456
9457 else if (action_id ==
EActions.MAKE_SPECIAL)
9458 {
9459 auto debugParams = DebugSpawnParams.WithPlayer(player);
9460 OnDebugSpawnEx(debugParams);
9461 }
9462
9463 }
9464
9465
9466 return false;
9467 }
9468
9469
9470
9471
9475
9478
9479
9480
9482 {
9483 return false;
9484 }
9485
9486
9488 {
9489 return true;
9490 }
9491
9492
9494 {
9495 return true;
9496 }
9497
9498
9499
9501 {
9502 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9503 return g_Game.ConfigIsExisting(config_path);
9504 }
9505
9508 {
9509 return null;
9510 }
9511
9513 {
9514 return false;
9515 }
9516
9518 {
9519 return false;
9520 }
9521
9525
9526
9528 {
9529 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9530 return module_repairing.CanRepair(this, item_repair_kit);
9531 }
9532
9533
9534 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9535 {
9536 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9537 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9538 }
9539
9540
9542 {
9543
9544
9545
9546
9547
9548
9549
9550
9551 return 1;
9552 }
9553
9554
9555
9557 {
9559 }
9560
9561
9562
9564 {
9566 }
9567
9568
9577 {
9578 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9579
9580 if (player)
9581 {
9582 player.MessageStatus(text);
9583 }
9584 }
9585
9586
9595 {
9596 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9597
9598 if (player)
9599 {
9600 player.MessageAction(text);
9601 }
9602 }
9603
9604
9613 {
9614 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9615
9616 if (player)
9617 {
9618 player.MessageFriendly(text);
9619 }
9620 }
9621
9622
9631 {
9632 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9633
9634 if (player)
9635 {
9636 player.MessageImportant(text);
9637 }
9638 }
9639
9641 {
9642 return true;
9643 }
9644
9645
9646 override bool KindOf(
string tag)
9647 {
9648 bool found = false;
9649 string item_name = this.
GetType();
9651 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9652
9653 int array_size = item_tag_array.Count();
9654 for (int i = 0; i < array_size; i++)
9655 {
9656 if (item_tag_array.Get(i) == tag)
9657 {
9658 found = true;
9659 break;
9660 }
9661 }
9662 return found;
9663 }
9664
9665
9667 {
9668
9669 super.OnRPC(sender, rpc_type,ctx);
9670
9671
9672 switch (rpc_type)
9673 {
9674 #ifndef SERVER
9675 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9676 Param2<bool, string> p = new Param2<bool, string>(false, "");
9677
9679 return;
9680
9681 bool play = p.param1;
9682 string soundSet = p.param2;
9683
9684 if (play)
9685 {
9687 {
9689 {
9691 }
9692 }
9693 else
9694 {
9696 }
9697 }
9698 else
9699 {
9701 }
9702
9703 break;
9704 #endif
9705
9706 }
9707
9709 {
9711 }
9712 }
9713
9714
9715
9716
9718 {
9719 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9720 return plugin.GetID(
name);
9721 }
9722
9724 {
9725 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9726 return plugin.GetName(id);
9727 }
9728
9731 {
9732
9733
9734 int varFlags;
9735 if (!ctx.
Read(varFlags))
9736 return;
9737
9738 if (varFlags & ItemVariableFlags.FLOAT)
9739 {
9741 }
9742 }
9743
9745 {
9746
9747 super.SerializeNumericalVars(floats_out);
9748
9749
9750
9752 {
9754 }
9755
9757 {
9759 }
9760
9762 {
9764 }
9765
9767 {
9772 }
9773
9775 {
9777 }
9778 }
9779
9781 {
9782
9783 super.DeSerializeNumericalVars(floats);
9784
9785
9786 int index = 0;
9787 int mask = Math.Round(floats.Get(index));
9788
9789 index++;
9790
9792 {
9794 {
9796 }
9797 else
9798 {
9799 float quantity = floats.Get(index);
9801 }
9802 index++;
9803 }
9804
9806 {
9807 float wet = floats.Get(index);
9809 index++;
9810 }
9811
9813 {
9814 int liquidtype = Math.Round(floats.Get(index));
9816 index++;
9817 }
9818
9820 {
9822 index++;
9824 index++;
9826 index++;
9828 index++;
9829 }
9830
9832 {
9833 int cleanness = Math.Round(floats.Get(index));
9835 index++;
9836 }
9837 }
9838
9840 {
9841 super.WriteVarsToCTX(ctx);
9842
9843
9845 {
9847 }
9848
9850 {
9852 }
9853
9855 {
9857 }
9858
9860 {
9861 int r,g,b,a;
9867 }
9868
9870 {
9872 }
9873 }
9874
9876 {
9877 if (!super.ReadVarsFromCTX(ctx,version))
9878 return false;
9879
9880 int intValue;
9881 float value;
9882
9883 if (version < 140)
9884 {
9885 if (!ctx.
Read(intValue))
9886 return false;
9887
9888 m_VariablesMask = intValue;
9889 }
9890
9892 {
9893 if (!ctx.
Read(value))
9894 return false;
9895
9897 {
9899 }
9900 else
9901 {
9903 }
9904 }
9905
9906 if (version < 140)
9907 {
9909 {
9910 if (!ctx.
Read(value))
9911 return false;
9912 SetTemperatureDirect(value);
9913 }
9914 }
9915
9917 {
9918 if (!ctx.
Read(value))
9919 return false;
9921 }
9922
9924 {
9925 if (!ctx.
Read(intValue))
9926 return false;
9928 }
9929
9931 {
9932 int r,g,b,a;
9934 return false;
9936 return false;
9938 return false;
9940 return false;
9941
9943 }
9944
9946 {
9947 if (!ctx.
Read(intValue))
9948 return false;
9950 }
9951
9952 if (version >= 138 && version < 140)
9953 {
9955 {
9956 if (!ctx.
Read(intValue))
9957 return false;
9958 SetFrozen(intValue);
9959 }
9960 }
9961
9962 return true;
9963 }
9964
9965
9967 {
9970 {
9972 }
9973
9974 if (!super.OnStoreLoad(ctx, version))
9975 {
9977 return false;
9978 }
9979
9980 if (version >= 114)
9981 {
9982 bool hasQuickBarIndexSaved;
9983
9984 if (!ctx.
Read(hasQuickBarIndexSaved))
9985 {
9987 return false;
9988 }
9989
9990 if (hasQuickBarIndexSaved)
9991 {
9992 int itmQBIndex;
9993
9994
9995 if (!ctx.
Read(itmQBIndex))
9996 {
9998 return false;
9999 }
10000
10001 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10002 if (itmQBIndex != -1 && parentPlayer)
10003 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10004 }
10005 }
10006 else
10007 {
10008
10009 PlayerBase player;
10010 int itemQBIndex;
10011 if (version ==
int.
MAX)
10012 {
10013 if (!ctx.
Read(itemQBIndex))
10014 {
10016 return false;
10017 }
10018 }
10019 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10020 {
10021
10022 if (!ctx.
Read(itemQBIndex))
10023 {
10025 return false;
10026 }
10027 if (itemQBIndex != -1 && player)
10028 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10029 }
10030 }
10031
10032 if (version < 140)
10033 {
10034
10035 if (!LoadVariables(ctx, version))
10036 {
10038 return false;
10039 }
10040 }
10041
10042
10044 {
10046 return false;
10047 }
10048 if (version >= 132)
10049 {
10051 if (raib)
10052 {
10054 {
10056 return false;
10057 }
10058 }
10059 }
10060
10062 return true;
10063 }
10064
10065
10066
10068 {
10069 super.OnStoreSave(ctx);
10070
10071 PlayerBase player;
10072 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10073 {
10075
10076 int itemQBIndex = -1;
10077 itemQBIndex = player.FindQuickBarEntityIndex(this);
10078 ctx.
Write(itemQBIndex);
10079 }
10080 else
10081 {
10083 }
10084
10086
10088 if (raib)
10089 {
10091 }
10092 }
10093
10094
10096 {
10097 super.AfterStoreLoad();
10098
10100 {
10102 }
10103
10105 {
10108 }
10109 }
10110
10112 {
10113 super.EEOnAfterLoad();
10114
10116 {
10118 }
10119
10122 }
10123
10125 {
10126 return false;
10127 }
10128
10129
10130
10132 {
10134 {
10135 #ifdef PLATFORM_CONSOLE
10136
10138 {
10140 if (menu)
10141 {
10143 }
10144 }
10145 #endif
10146 }
10147
10149 {
10152 }
10153
10155 {
10156 SetWeightDirty();
10158 }
10160 {
10163 }
10164
10166 {
10169
10172 }
10174 {
10178 }
10179
10180 super.OnVariablesSynchronized();
10181 }
10182
10183
10184
10186 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10187 {
10188 if (!IsServerCheck(allow_client))
10189 return false;
10190
10192 return false;
10193
10196
10197 if (value <= (min + 0.001))
10198 value = min;
10199
10200 if (value == min)
10201 {
10202 if (destroy_config)
10203 {
10204 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10205 if (dstr)
10206 {
10208 this.Delete();
10209 return true;
10210 }
10211 }
10212 else if (destroy_forced)
10213 {
10215 this.Delete();
10216 return true;
10217 }
10218
10220 }
10221
10224
10226 {
10227 EntityAI parent = GetHierarchyRoot();
10228 InventoryLocation iLoc = new InventoryLocation();
10229 GetInventory().GetCurrentInventoryLocation(iLoc);
10231 {
10232 int iLocSlot = iLoc.
GetSlot();
10234 {
10236 }
10238 {
10240 }
10241 }
10242 }
10243
10245 {
10247
10248 if (delta)
10250 }
10251
10253
10254 return false;
10255 }
10256
10257
10259 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10260 {
10262 }
10263
10265 {
10268 }
10269
10271 {
10274 }
10275
10277 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10278 {
10279 float value_clamped = Math.Clamp(value, 0, 1);
10281 SetQuantity(result, destroy_config, destroy_forced);
10282 }
10283
10284
10287 {
10289 }
10290
10292 {
10294 }
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10306 {
10307 int slot = -1;
10308 GameInventory inventory = GetInventory();
10309 if (inventory)
10310 {
10311 InventoryLocation il = new InventoryLocation;
10314 }
10315
10317 }
10318
10320 {
10321 float quantity_max = 0;
10322
10324 {
10325 if (attSlotID != -1)
10326 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10327
10328 if (quantity_max <= 0)
10330 }
10331
10332 if (quantity_max <= 0)
10334
10335 return quantity_max;
10336 }
10337
10339 {
10341 }
10342
10344 {
10346 }
10347
10348
10350 {
10352 }
10353
10355 {
10357 }
10358
10360 {
10362 }
10363
10364
10366 {
10367
10368 float weightEx = GetWeightEx();
10369 float special = GetInventoryAndCargoWeight();
10370 return weightEx - special;
10371 }
10372
10373
10375 {
10377 }
10378
10380 {
10382 {
10383 #ifdef DEVELOPER
10384 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10385 {
10386 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10388 }
10389 #endif
10390
10391 return GetQuantity() * GetConfigWeightModified();
10392 }
10393 else if (HasEnergyManager())
10394 {
10395 #ifdef DEVELOPER
10396 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10397 {
10398 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10399 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10400 }
10401 #endif
10402 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10403 }
10404 else
10405 {
10406 #ifdef DEVELOPER
10407 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10408 {
10409 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10410 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10411 }
10412 #endif
10413 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10414 }
10415 }
10416
10419 {
10420 int item_count = 0;
10422
10423 GameInventory inventory = GetInventory();
10424 CargoBase cargo = inventory.
GetCargo();
10425 if (cargo != NULL)
10426 {
10428 }
10429
10431 for (int i = 0; i < nAttachments; ++i)
10432 {
10434 if (item)
10435 item_count += item.GetNumberOfItems();
10436 }
10437 return item_count;
10438 }
10439
10442 {
10443 float weight = 0;
10444 float wetness = 1;
10445 if (include_wetness)
10448 {
10449 weight = wetness * m_ConfigWeight;
10450 }
10452 {
10453 weight = 1;
10454 }
10455 return weight;
10456 }
10457
10458
10459
10461 {
10462 GameInventory inventory = GetInventory();
10463 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10464 {
10465 array<EntityAI> items = new array<EntityAI>;
10467 for (int i = 0; i < items.Count(); ++i)
10468 {
10470 if (item)
10471 {
10472 g_Game.ObjectDelete(item);
10473 }
10474 }
10475 }
10476 }
10477
10478
10479
10480
10482 {
10483 float energy = 0;
10484 if (HasEnergyManager())
10485 {
10486 energy = GetCompEM().GetEnergy();
10487 }
10488 return energy;
10489 }
10490
10491
10493 {
10494 super.OnEnergyConsumed();
10495
10497 }
10498
10500 {
10501 super.OnEnergyAdded();
10502
10504 }
10505
10506
10508 {
10509 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10510 {
10512 {
10513 float energy_0to1 = GetCompEM().GetEnergy0To1();
10515 }
10516 }
10517 }
10518
10519
10521 {
10522 return ConfigGetFloat("heatIsolation");
10523 }
10524
10526 {
10528 }
10529
10531 {
10532 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10533 if (
g_Game.ConfigIsExisting(paramPath))
10534 return g_Game.ConfigGetFloat(paramPath);
10535
10536 return 0.0;
10537 }
10538
10540 {
10541 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10542 if (
g_Game.ConfigIsExisting(paramPath))
10543 return g_Game.ConfigGetFloat(paramPath);
10544
10545 return 0.0;
10546 }
10547
10548 override void SetWet(
float value,
bool allow_client =
false)
10549 {
10550 if (!IsServerCheck(allow_client))
10551 return;
10552
10555
10557
10558 m_VarWet = Math.Clamp(value, min, max);
10559
10561 {
10564 }
10565 }
10566
10567 override void AddWet(
float value)
10568 {
10570 }
10571
10573 {
10575 }
10576
10578 {
10580 }
10581
10583 {
10585 }
10586
10588 {
10590 }
10591
10593 {
10595 }
10596
10597 override void OnWetChanged(
float newVal,
float oldVal)
10598 {
10601 if (newLevel != oldLevel)
10602 {
10604 }
10605 }
10606
10608 {
10609 SetWeightDirty();
10610 }
10611
10613 {
10614 return GetWetLevelInternal(
m_VarWet);
10615 }
10616
10617
10618
10620 {
10622 }
10623
10625 {
10627 }
10628
10630 {
10632 }
10633
10635 {
10637 }
10638
10639
10640
10642 {
10643 if (ConfigIsExisting("itemModelLength"))
10644 {
10645 return ConfigGetFloat("itemModelLength");
10646 }
10647 return 0;
10648 }
10649
10651 {
10652 if (ConfigIsExisting("itemAttachOffset"))
10653 {
10654 return ConfigGetFloat("itemAttachOffset");
10655 }
10656 return 0;
10657 }
10658
10659 override void SetCleanness(
int value,
bool allow_client =
false)
10660 {
10661 if (!IsServerCheck(allow_client))
10662 return;
10663
10665
10667
10670 }
10671
10673 {
10675 }
10676
10678 {
10679 return true;
10680 }
10681
10682
10683
10684
10686 {
10688 }
10689
10691 {
10693 }
10694
10695
10696
10697
10698 override void SetColor(
int r,
int g,
int b,
int a)
10699 {
10705 }
10707 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10708 {
10713 }
10714
10716 {
10718 }
10719
10722 {
10723 int r,g,b,a;
10725 r = r/255;
10726 g = g/255;
10727 b = b/255;
10728 a = a/255;
10729 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10730 }
10731
10732
10733
10734 override void SetLiquidType(
int value,
bool allow_client =
false)
10735 {
10736 if (!IsServerCheck(allow_client))
10737 return;
10738
10743 }
10744
10746 {
10747 return ConfigGetInt("varLiquidTypeInit");
10748 }
10749
10751 {
10753 }
10754
10756 {
10758 SetFrozen(false);
10759 }
10760
10763 {
10764 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10765 }
10766
10767
10770 {
10771 PlayerBase nplayer;
10772 if (PlayerBase.CastTo(nplayer, player))
10773 {
10775 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10776 }
10777 }
10778
10779
10782 {
10783 PlayerBase nplayer;
10784 if (PlayerBase.CastTo(nplayer,player))
10785 {
10786 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10787 }
10788
10789 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10790
10791 if (HasEnergyManager())
10792 {
10793 GetCompEM().UpdatePlugState();
10794 }
10795 }
10796
10797
10799 {
10800 super.OnPlacementStarted(player);
10801
10803 }
10804
10805 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10806 {
10808 {
10809 m_AdminLog.OnPlacementComplete(player,
this);
10810 }
10811
10812 super.OnPlacementComplete(player, position, orientation);
10813 }
10814
10815
10816
10817
10818
10820 {
10822 {
10823 return true;
10824 }
10825 else
10826 {
10827 return false;
10828 }
10829 }
10830
10831
10833 {
10835 {
10837 }
10838 }
10839
10840
10842 {
10844 }
10845
10847 {
10849 }
10850
10851 override void InsertAgent(
int agent,
float count = 1)
10852 {
10853 if (count < 1)
10854 return;
10855
10857 }
10858
10861 {
10863 }
10864
10865
10867 {
10869 }
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10913 {
10915 return false;
10916 return true;
10917 }
10918
10920 {
10921
10923 }
10924
10925
10928 {
10929 super.CheckForRoofLimited(timeTresholdMS);
10930
10931 float time =
g_Game.GetTime();
10932 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10933 {
10934 m_PreviousRoofTestTime = time;
10935 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10936 }
10937 }
10938
10939
10941 {
10943 {
10944 return 0;
10945 }
10946
10947 if (GetInventory().GetAttachmentSlotsCount() != 0)
10948 {
10949 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10950 if (filter)
10951 return filter.GetProtectionLevel(type, false, system);
10952 else
10953 return 0;
10954 }
10955
10956 string subclassPath, entryName;
10957
10958 switch (type)
10959 {
10961 entryName = "biological";
10962 break;
10964 entryName = "chemical";
10965 break;
10966 default:
10967 entryName = "biological";
10968 break;
10969 }
10970
10971 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10972
10973 return g_Game.ConfigGetFloat(subclassPath + entryName);
10974 }
10975
10976
10977
10980 {
10981 if (!IsMagazine())
10983
10985 }
10986
10987
10988
10989
10990
10995 {
10996 return true;
10997 }
10998
11000 {
11002 }
11003
11004
11005
11006
11007
11009 {
11010 if (parent)
11011 {
11012 if (parent.IsInherited(DayZInfected))
11013 return true;
11014
11015 if (!parent.IsRuined())
11016 return true;
11017 }
11018
11019 return true;
11020 }
11021
11023 {
11024 if (!super.CanPutAsAttachment(parent))
11025 {
11026 return false;
11027 }
11028
11029 if (!IsRuined() && !parent.IsRuined())
11030 {
11031 return true;
11032 }
11033
11034 return false;
11035 }
11036
11038 {
11039
11040
11041
11042
11043 return super.CanReceiveItemIntoCargo(item);
11044 }
11045
11047 {
11048
11049
11050
11051
11052 GameInventory attachmentInv = attachment.GetInventory();
11054 {
11055 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11056 return false;
11057 }
11058
11059 InventoryLocation loc = new InventoryLocation();
11060 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11061 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11062 return false;
11063
11064 return super.CanReceiveAttachment(attachment, slotId);
11065 }
11066
11068 {
11069 if (!super.CanReleaseAttachment(attachment))
11070 return false;
11071
11072 return GetInventory().AreChildrenAccessible();
11073 }
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11096 {
11097 int id = muzzle_owner.GetMuzzleID();
11098 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11099
11100 if (WPOF_array)
11101 {
11102 for (int i = 0; i < WPOF_array.Count(); i++)
11103 {
11104 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11105
11106 if (WPOF)
11107 {
11108 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11109 }
11110 }
11111 }
11112 }
11113
11114
11116 {
11117 int id = muzzle_owner.GetMuzzleID();
11119
11120 if (WPOBE_array)
11121 {
11122 for (int i = 0; i < WPOBE_array.Count(); i++)
11123 {
11124 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11125
11126 if (WPOBE)
11127 {
11128 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11129 }
11130 }
11131 }
11132 }
11133
11134
11136 {
11137 int id = muzzle_owner.GetMuzzleID();
11138 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11139
11140 if (WPOOH_array)
11141 {
11142 for (int i = 0; i < WPOOH_array.Count(); i++)
11143 {
11144 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11145
11146 if (WPOOH)
11147 {
11148 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11149 }
11150 }
11151 }
11152 }
11153
11154
11156 {
11157 int id = muzzle_owner.GetMuzzleID();
11158 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11159
11160 if (WPOOH_array)
11161 {
11162 for (int i = 0; i < WPOOH_array.Count(); i++)
11163 {
11164 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11165
11166 if (WPOOH)
11167 {
11168 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11169 }
11170 }
11171 }
11172 }
11173
11174
11176 {
11177 int id = muzzle_owner.GetMuzzleID();
11178 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11179
11180 if (WPOOH_array)
11181 {
11182 for (int i = 0; i < WPOOH_array.Count(); i++)
11183 {
11184 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11185
11186 if (WPOOH)
11187 {
11188 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11189 }
11190 }
11191 }
11192 }
11193
11194
11195
11197 {
11199 {
11200 return true;
11201 }
11202
11203 return false;
11204 }
11205
11207 {
11209 {
11210 return true;
11211 }
11212
11213 return false;
11214 }
11215
11217 {
11219 {
11220 return true;
11221 }
11222
11223 return false;
11224 }
11225
11227 {
11228 return false;
11229 }
11230
11233 {
11234 return UATimeSpent.DEFAULT_DEPLOY;
11235 }
11236
11237
11238
11239
11241 {
11243 SetSynchDirty();
11244 }
11245
11247 {
11249 }
11250
11251
11253 {
11254 return false;
11255 }
11256
11259 {
11260 string att_type = "None";
11261
11262 if (ConfigIsExisting("soundAttType"))
11263 {
11264 att_type = ConfigGetString("soundAttType");
11265 }
11266
11268 }
11269
11271 {
11273 }
11274
11275
11276
11277
11278
11284
11286 {
11289
11291 }
11292
11293
11295 {
11297 return;
11298
11300
11303
11306
11307 SoundParameters params = new SoundParameters();
11311 }
11312
11313
11315 {
11317 {
11320
11321 SetSynchDirty();
11322
11325 }
11326 }
11327
11329 {
11331 }
11332
11333
11335 {
11337 return;
11338
11340 SetSynchDirty();
11341
11344 }
11345
11347 {
11350 }
11351
11353 {
11355 }
11356
11357 void OnApply(PlayerBase player);
11358
11360 {
11361 return 1.0;
11362 };
11363
11365 {
11367 }
11368
11370 {
11372 }
11373
11375
11377 {
11378 SetDynamicPhysicsLifeTime(0.01);
11380 }
11381
11383 {
11384 array<string> zone_names = new array<string>;
11385 GetDamageZones(zone_names);
11386 for (int i = 0; i < zone_names.Count(); i++)
11387 {
11388 SetHealthMax(zone_names.Get(i),"Health");
11389 }
11390 SetHealthMax("","Health");
11391 }
11392
11395 {
11396 float global_health = GetHealth01("","Health");
11397 array<string> zones = new array<string>;
11398 GetDamageZones(zones);
11399
11400 for (int i = 0; i < zones.Count(); i++)
11401 {
11402 SetHealth01(zones.Get(i),"Health",global_health);
11403 }
11404 }
11405
11408 {
11409 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11410 }
11411
11413 {
11414 if (!hasRootAsPlayer)
11415 {
11416 if (refParentIB)
11417 {
11418
11419 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11420 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11421
11422 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11423 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11424
11427 }
11428 else
11429 {
11430
11433 }
11434 }
11435 }
11436
11438 {
11440 {
11441 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11442 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11443 {
11444 float heatPermCoef = 1.0;
11446 while (ent)
11447 {
11448 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11449 ent = ent.GetHierarchyParent();
11450 }
11451
11452 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11453 }
11454 }
11455 }
11456
11458 {
11459
11460 EntityAI parent = GetHierarchyParent();
11461 if (!parent)
11462 {
11463 hasParent = false;
11464 hasRootAsPlayer = false;
11465 }
11466 else
11467 {
11468 hasParent = true;
11469 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11470 refParentIB =
ItemBase.Cast(parent);
11471 }
11472 }
11473
11474 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11475 {
11476
11477 }
11478
11480 {
11481
11482 return false;
11483 }
11484
11486 {
11487
11488
11489 return false;
11490 }
11491
11493 {
11494
11495 return false;
11496 }
11497
11500 {
11501 return !GetIsFrozen() &&
IsOpen();
11502 }
11503
11505 {
11506 bool hasParent = false, hasRootAsPlayer = false;
11508
11509 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11510 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11511
11512 if (wwtu || foodDecay)
11513 {
11517
11518 if (processWetness || processTemperature || processDecay)
11519 {
11521
11522 if (processWetness)
11523 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11524
11525 if (processTemperature)
11527
11528 if (processDecay)
11529 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11530 }
11531 }
11532 }
11533
11536 {
11538 }
11539
11541 {
11544
11545 return super.GetTemperatureFreezeThreshold();
11546 }
11547
11549 {
11552
11553 return super.GetTemperatureThawThreshold();
11554 }
11555
11557 {
11560
11561 return super.GetItemOverheatThreshold();
11562 }
11563
11565 {
11567 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11568
11569 return super.GetTemperatureFreezeTime();
11570 }
11571
11573 {
11575 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11576
11577 return super.GetTemperatureThawTime();
11578 }
11579
11584
11586 {
11587 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11588 }
11589
11591 {
11592 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11593 }
11594
11597 {
11599 }
11600
11602 {
11604 }
11605
11607 {
11609 }
11610
11613 {
11614 return null;
11615 }
11616
11619 {
11620 return false;
11621 }
11622
11624 {
11626 {
11629 if (!trg)
11630 {
11632 explosive = this;
11633 }
11634
11635 explosive.PairRemote(trg);
11637
11638 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11639 trg.SetPersistentPairID(persistentID);
11640 explosive.SetPersistentPairID(persistentID);
11641
11642 return true;
11643 }
11644 return false;
11645 }
11646
11649 {
11650 float ret = 1.0;
11653 ret *= GetHealth01();
11654
11655 return ret;
11656 }
11657
11658 #ifdef DEVELOPER
11659 override void SetDebugItem()
11660 {
11661 super.SetDebugItem();
11662 _itemBase = this;
11663 }
11664
11666 {
11667 string text = super.GetDebugText();
11668
11670 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11671
11672 return text;
11673 }
11674 #endif
11675
11677 {
11678 return true;
11679 }
11680
11682
11684
11686 {
11689 }
11690
11691
11699
11715
11716 [
Obsolete(
"Use ItemSoundHandler instead")]
11719 {
11720 if (!
g_Game.IsDedicatedServer())
11721 {
11722 if (ConfigIsExisting("attachSoundSet"))
11723 {
11724 string cfg_path = "";
11725 string soundset = "";
11726 string type_name =
GetType();
11727
11730 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11731 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11732
11733 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11734 {
11735 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11736 {
11737 if (cfg_slot_array[i] == slot_type)
11738 {
11739 soundset = cfg_soundset_array[i];
11740 break;
11741 }
11742 }
11743 }
11744
11745 if (soundset != "")
11746 {
11747 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11749 }
11750 }
11751 }
11752 }
11753
11755}
11756
11758{
11760 if (entity)
11761 {
11762 bool is_item = entity.IsInherited(
ItemBase);
11763 if (is_item && full_quantity)
11764 {
11767 }
11768 }
11769 else
11770 {
11772 return NULL;
11773 }
11774 return entity;
11775}
11776
11778{
11779 if (item)
11780 {
11781 if (health > 0)
11782 item.SetHealth("", "", health);
11783
11784 if (item.CanHaveTemperature())
11785 {
11787 if (item.CanFreeze())
11788 item.SetFrozen(false);
11789 }
11790
11791 if (item.HasEnergyManager())
11792 {
11793 if (quantity >= 0)
11794 {
11795 item.GetCompEM().SetEnergy0To1(quantity);
11796 }
11797 else
11798 {
11800 }
11801 }
11802 else if (item.IsMagazine())
11803 {
11804 Magazine mag = Magazine.Cast(item);
11805 if (quantity >= 0)
11806 {
11807 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11808 }
11809 else
11810 {
11812 }
11813
11814 }
11815 else
11816 {
11817 if (quantity >= 0)
11818 {
11819 item.SetQuantityNormalized(quantity, false);
11820 }
11821 else
11822 {
11824 }
11825
11826 }
11827 }
11828}
11829
11830#ifdef DEVELOPER
11832#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.