6880{
6882 {
6883 return true;
6884 }
6885};
6886
6888{
6889
6890};
6891
6892
6893
6895{
6899
6901
6904
6905
6906
6907
6908
6917
6923
6928
6933
6954 protected bool m_IsResultOfSplit
6955
6957
6962
6963
6964
6966
6970
6971
6972
6974
6977
6978
6979
6985
6986
6994
6997
6998
7000
7001
7003
7004
7009
7010
7015
7017
7018
7020
7021
7023 {
7028
7029 if (!
g_Game.IsDedicatedServer())
7030 {
7032 {
7034
7036 {
7038 }
7039 }
7040
7043 }
7044
7045 m_OldLocation = null;
7046
7048 {
7050 }
7051
7052 if (ConfigIsExisting("headSelectionsToHide"))
7053 {
7056 }
7057
7059 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7060 {
7062 }
7063
7065
7066 m_IsResultOfSplit = false;
7067
7069 }
7070
7072 {
7073 super.InitItemVariables();
7074
7080 m_Count = ConfigGetInt(
"count");
7081
7084
7089
7092
7097
7109
7113
7114
7117 if (ConfigIsExisting("canBeSplit"))
7118 {
7121 }
7122
7124 if (ConfigIsExisting("itemBehaviour"))
7126
7127
7130 RegisterNetSyncVariableInt("m_VarLiquidType");
7131 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7132
7133 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7134 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7135 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7136
7137 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7138 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7139 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7140 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7141
7142 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7143 RegisterNetSyncVariableBool("m_IsTakeable");
7144 RegisterNetSyncVariableBool("m_IsHologram");
7145
7148 {
7151 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7152 }
7153
7155
7157 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7159
7161 }
7162
7164 {
7166 }
7167
7169 {
7172 {
7177 }
7178 }
7179
7180 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7181 {
7183 {
7186 }
7187
7189 }
7190
7192 {
7198 }
7199
7201
7203 {
7205
7206 if (!action)
7207 {
7208 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7209 return;
7210 }
7211
7213 if (!ai)
7214 {
7216 return;
7217 }
7218
7220 if (!action_array)
7221 {
7222 action_array = new array<ActionBase_Basic>;
7224 }
7225 if (LogManager.IsActionLogEnable())
7226 {
7227 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7228 }
7229
7230 if (action_array.Find(action) != -1)
7231 {
7232 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7233 }
7234 else
7235 {
7236 action_array.Insert(action);
7237 }
7238 }
7239
7241 {
7242 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7243 ActionBase action = player.GetActionManager().GetAction(actionName);
7246
7247 if (action_array)
7248 {
7249 action_array.RemoveItem(action);
7250 }
7251 }
7252
7253
7254
7256 {
7257 ActionOverrideData overrideData = new ActionOverrideData();
7261
7263 if (!actionMap)
7264 {
7267 }
7268
7269 actionMap.Insert(this.
Type(), overrideData);
7270
7271 }
7272
7274
7276
7277
7279 {
7282
7285
7286 string config_to_search = "CfgVehicles";
7287 string muzzle_owner_config;
7288
7290 {
7291 if (IsInherited(Weapon))
7292 config_to_search = "CfgWeapons";
7293
7294 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7295
7296 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7297
7298 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7299
7300 if (config_OnFire_subclass_count > 0)
7301 {
7302 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7303
7304 for (int i = 0; i < config_OnFire_subclass_count; i++)
7305 {
7306 string particle_class = "";
7307 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7308 string config_OnFire_entry = config_OnFire_class + particle_class;
7309 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7310 WPOF_array.Insert(WPOF);
7311 }
7312
7313
7315 }
7316 }
7317
7319 {
7320 config_to_search = "CfgWeapons";
7321 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7322
7323 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7324
7325 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7326
7327 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7328 {
7329 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7330
7331 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7332 {
7333 string particle_class2 = "";
7334 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7335 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7336 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7337 WPOBE_array.Insert(WPOBE);
7338 }
7339
7340
7342 }
7343 }
7344 }
7345
7346
7348 {
7351
7353 {
7354 string config_to_search = "CfgVehicles";
7355
7356 if (IsInherited(Weapon))
7357 config_to_search = "CfgWeapons";
7358
7359 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7360 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7361
7362 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7363 {
7364
7366
7368 {
7370 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7372 return;
7373 }
7374
7377
7378
7379
7380 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7381 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7382
7383 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7384 {
7385 string particle_class = "";
7386 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7387 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7388 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7389
7390 if (entry_type == CT_CLASS)
7391 {
7392 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7393 WPOOH_array.Insert(WPOF);
7394 }
7395 }
7396
7397
7399 }
7400 }
7401 }
7402
7404 {
7406 }
7407
7409 {
7411 {
7413
7416
7419
7420 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7421 }
7422 }
7423
7425 {
7427 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7428
7430 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7431
7433 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7434
7436 {
7438 }
7439 }
7440
7442 {
7444 }
7445
7447 {
7450 else
7452
7454 {
7457 }
7458 else
7459 {
7462
7465 }
7466
7468 }
7469
7471 {
7473 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7474 }
7475
7477 {
7479 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7481 }
7482
7484 {
7486 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7487 }
7488
7490 {
7493
7494 OverheatingParticle OP = new OverheatingParticle();
7499
7501 }
7502
7504 {
7507
7508 return -1;
7509 }
7510
7512 {
7514 {
7517
7518 for (int i = count; i > 0; --i)
7519 {
7520 int id = i - 1;
7523
7526
7527 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7528 {
7529 if (p)
7530 {
7533 }
7534 }
7535 }
7536 }
7537 }
7538
7540 {
7542 {
7544 {
7545 int id = i - 1;
7547
7548 if (OP)
7549 {
7551
7552 if (p)
7553 {
7555 }
7556
7557 delete OP;
7558 }
7559 }
7560
7563 }
7564 }
7565
7568 {
7569 return 0.0;
7570 }
7571
7572
7574 {
7575 return 250;
7576 }
7577
7579 {
7580 return 0;
7581 }
7582
7585 {
7587 return true;
7588
7589 return false;
7590 }
7591
7594 {
7597
7599 {
7601 }
7602 else
7603 {
7604
7606 }
7607
7609 }
7610
7617 {
7618 return -1;
7619 }
7620
7621
7622
7623
7625 {
7627 {
7628 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7629 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7630
7631 if (r_index >= 0)
7632 {
7633 InventoryLocation r_il = new InventoryLocation;
7634 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7635
7636 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7639 {
7640 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7641 }
7643 {
7644 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7645 }
7646
7647 }
7648
7649 player.GetHumanInventory().ClearUserReservedLocation(this);
7650 }
7651
7654 }
7655
7656
7657
7658
7660 {
7661 return ItemBase.m_DebugActionsMask;
7662 }
7663
7665 {
7666 return ItemBase.m_DebugActionsMask & mask;
7667 }
7668
7670 {
7671 ItemBase.m_DebugActionsMask = mask;
7672 }
7673
7675 {
7676 ItemBase.m_DebugActionsMask |= mask;
7677 }
7678
7680 {
7681 ItemBase.m_DebugActionsMask &= ~mask;
7682 }
7683
7685 {
7687 {
7689 }
7690 else
7691 {
7693 }
7694 }
7695
7696
7698 {
7699 if (GetEconomyProfile())
7700 {
7701 float q_max = GetEconomyProfile().GetQuantityMax();
7702 if (q_max > 0)
7703 {
7704 float q_min = GetEconomyProfile().GetQuantityMin();
7705 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7706
7708 {
7709 ComponentEnergyManager comp = GetCompEM();
7711 {
7713 }
7714 }
7716 {
7718
7719 }
7720
7721 }
7722 }
7723 }
7724
7727 {
7728 EntityAI parent = GetHierarchyParent();
7729
7730 if (parent)
7731 {
7732 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7733 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7734 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7735 }
7736 }
7737
7740 {
7741 EntityAI parent = GetHierarchyParent();
7742
7743 if (parent)
7744 {
7745 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7746 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7747 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7748 }
7749 }
7750
7752 {
7753
7754
7755
7756
7758
7760 {
7761 if (ScriptInputUserData.CanStoreInputUserData())
7762 {
7763 ScriptInputUserData ctx = new ScriptInputUserData;
7769 ctx.
Write(use_stack_max);
7772
7774 {
7775 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7776 }
7777 }
7778 }
7779 else if (!
g_Game.IsMultiplayer())
7780 {
7782 }
7783 }
7784
7786 {
7788 }
7789
7791 {
7793 }
7794
7796 {
7798 }
7799
7801 {
7802
7803 return false;
7804 }
7805
7807 {
7808 return false;
7809 }
7810
7814 {
7815 return false;
7816 }
7817
7819 {
7820 return "";
7821 }
7822
7824
7826 {
7827 return false;
7828 }
7829
7831 {
7832 return true;
7833 }
7834
7835
7836
7838 {
7839 return true;
7840 }
7841
7843 {
7844 return true;
7845 }
7846
7848 {
7849 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7851 }
7852
7854 {
7856 }
7857
7859 {
7861 if (!is_being_placed)
7863 SetSynchDirty();
7864 }
7865
7866
7868
7870 {
7872 }
7873
7875 {
7877 }
7878
7880 {
7881 return 1;
7882 }
7883
7885 {
7886 return false;
7887 }
7888
7890 {
7892 SetSynchDirty();
7893 }
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7930 {
7931 super.OnMovedInsideCargo(container);
7932
7933 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7934 }
7935
7936 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7937 {
7938 super.EEItemLocationChanged(oldLoc, newLoc);
7939
7940 PlayerBase newPlayer = null;
7941 PlayerBase oldPlayer = null;
7942
7943 if (newLoc.GetParent())
7944 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7945
7946 if (oldLoc.GetParent())
7947 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7948
7950 {
7951 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7952
7953 if (rIndex >= 0)
7954 {
7955 InventoryLocation rIl = new InventoryLocation;
7956 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7957
7958 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7961 {
7962 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7963 }
7965 {
7967 }
7968
7969 }
7970 }
7971
7973 {
7974 if (newPlayer)
7975 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7976
7977 if (newPlayer == oldPlayer)
7978 {
7979 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7980 {
7982 {
7983 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7984 {
7985 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7986 }
7987 }
7988 else
7989 {
7990 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7991 }
7992 }
7993
7994 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7995 {
7996 int type = oldLoc.GetType();
7998 {
7999 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8000 }
8002 {
8003 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8004 }
8005 }
8006 if (!m_OldLocation)
8007 {
8008 m_OldLocation = new InventoryLocation;
8009 }
8010 m_OldLocation.Copy(oldLoc);
8011 }
8012 else
8013 {
8014 if (m_OldLocation)
8015 {
8016 m_OldLocation.Reset();
8017 }
8018 }
8019
8020 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8021 }
8022 else
8023 {
8024 if (newPlayer)
8025 {
8026 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8027 if (resIndex >= 0)
8028 {
8029 InventoryLocation il = new InventoryLocation;
8030 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8032 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8035 {
8036 il.
GetParent().GetOnReleaseLock().Invoke(it);
8037 }
8039 {
8041 }
8042
8043 }
8044 }
8046 {
8047
8049 }
8050
8051 if (m_OldLocation)
8052 {
8053 m_OldLocation.Reset();
8054 }
8055 }
8056
8058 {
8059 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8060 }
8061
8063 {
8064 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8065 }
8066 }
8067
8068 override void EOnContact(IEntity other, Contact extra)
8069 {
8071 {
8072 int liquidType = -1;
8074 if (impactSpeed > 0.0)
8075 {
8077 #ifndef SERVER
8079 #else
8081 SetSynchDirty();
8082 #endif
8084 }
8085 }
8086
8087 #ifdef SERVER
8088 if (GetCompEM() && GetCompEM().IsPlugged())
8089 {
8090 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8091 GetCompEM().UnplugThis();
8092 }
8093 #endif
8094 }
8095
8097
8099 {
8101 }
8102
8104 {
8105
8106 }
8107
8109 {
8110 super.OnItemLocationChanged(old_owner, new_owner);
8111
8112 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8113 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8114
8115 if (!relatedPlayer && playerNew)
8116 relatedPlayer = playerNew;
8117
8118 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8119 {
8121 if (actionMgr)
8122 {
8123 ActionBase currentAction = actionMgr.GetRunningAction();
8124 if (currentAction)
8126 }
8127 }
8128
8129 Man ownerPlayerOld = null;
8130 Man ownerPlayerNew = null;
8131
8132 if (old_owner)
8133 {
8134 if (old_owner.
IsMan())
8135 {
8136 ownerPlayerOld = Man.Cast(old_owner);
8137 }
8138 else
8139 {
8140 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8141 }
8142 }
8143 else
8144 {
8146 {
8148
8149 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8150 {
8151 GetCompEM().UnplugThis();
8152 }
8153 }
8154 }
8155
8156 if (new_owner)
8157 {
8158 if (new_owner.
IsMan())
8159 {
8160 ownerPlayerNew = Man.Cast(new_owner);
8161 }
8162 else
8163 {
8164 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8165 }
8166 }
8167
8168 if (ownerPlayerOld != ownerPlayerNew)
8169 {
8170 if (ownerPlayerOld)
8171 {
8172 array<EntityAI> subItemsExit = new array<EntityAI>;
8174 for (int i = 0; i < subItemsExit.Count(); i++)
8175 {
8178 }
8179 }
8180
8181 if (ownerPlayerNew)
8182 {
8183 array<EntityAI> subItemsEnter = new array<EntityAI>;
8185 for (int j = 0; j < subItemsEnter.Count(); j++)
8186 {
8189 }
8190 }
8191 }
8192 else if (ownerPlayerNew != null)
8193 {
8194 PlayerBase nplayer;
8195 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8196 {
8197 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8199 for (int k = 0; k < subItemsUpdate.Count(); k++)
8200 {
8202 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8203 }
8204 }
8205 }
8206
8207 if (old_owner)
8208 old_owner.OnChildItemRemoved(this);
8209 if (new_owner)
8210 new_owner.OnChildItemReceived(this);
8211 }
8212
8213
8215 {
8216 super.EEDelete(parent);
8217 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8218 if (player)
8219 {
8221
8222 if (player.IsAlive())
8223 {
8224 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8225 if (r_index >= 0)
8226 {
8227 InventoryLocation r_il = new InventoryLocation;
8228 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8229
8230 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8233 {
8234 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8235 }
8237 {
8238 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8239 }
8240
8241 }
8242
8243 player.RemoveQuickBarEntityShortcut(this);
8244 }
8245 }
8246 }
8247
8249 {
8250 super.EEKilled(killer);
8251
8254 {
8255 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8256 {
8257 if (IsMagazine())
8258 {
8259 if (Magazine.Cast(this).GetAmmoCount() > 0)
8260 {
8262 }
8263 }
8264 else
8265 {
8267 }
8268 }
8269 }
8270 }
8271
8273 {
8274 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8275
8276 super.OnWasAttached(parent, slot_id);
8277
8280
8283 }
8284
8286 {
8287 super.OnWasDetached(parent, slot_id);
8288
8291
8294 }
8295
8297 {
8298 int idx;
8301
8302 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8303 if (inventory_slots.Count() < 1)
8304 {
8305 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8306 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8307 }
8308 else
8309 {
8310 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8311 }
8312
8313 idx = inventory_slots.Find(slot);
8314 if (idx < 0)
8315 return "";
8316
8317 return attach_types.Get(idx);
8318 }
8319
8321 {
8322 int idx = -1;
8323 string slot;
8324
8327
8328 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8329 if (inventory_slots.Count() < 1)
8330 {
8331 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8332 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8333 }
8334 else
8335 {
8336 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8337 if (detach_types.Count() < 1)
8338 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8339 }
8340
8341 for (int i = 0; i < inventory_slots.Count(); i++)
8342 {
8343 slot = inventory_slots.Get(i);
8344 }
8345
8346 if (slot != "")
8347 {
8348 if (detach_types.Count() == 1)
8349 idx = 0;
8350 else
8351 idx = inventory_slots.Find(slot);
8352 }
8353 if (idx < 0)
8354 return "";
8355
8356 return detach_types.Get(idx);
8357 }
8358
8360 {
8361
8363
8364
8365 float min_time = 1;
8366 float max_time = 3;
8367 float delay = Math.RandomFloat(min_time, max_time);
8368
8369 explode_timer.Run(delay, this, "DoAmmoExplosion");
8370 }
8371
8373 {
8374 Magazine magazine = Magazine.Cast(this);
8375 int pop_sounds_count = 6;
8376 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8377
8378
8379 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8380 string sound_name = pop_sounds[ sound_idx ];
8381 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8382
8383
8384 magazine.ServerAddAmmoCount(-1);
8385
8386
8387 float min_temp_to_explode = 100;
8388
8389 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8390 {
8392 }
8393 }
8394
8395
8396 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8397 {
8398 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8399
8400 const int CHANCE_DAMAGE_CARGO = 4;
8401 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8402 const int CHANCE_DAMAGE_NOTHING = 2;
8403
8405 {
8406 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8407 int chances;
8408 int rnd;
8409
8410 if (GetInventory().GetCargo())
8411 {
8412 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8413 rnd = Math.RandomInt(0,chances);
8414
8415 if (rnd < CHANCE_DAMAGE_CARGO)
8416 {
8418 }
8419 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8420 {
8422 }
8423 }
8424 else
8425 {
8426 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8427 rnd = Math.RandomInt(0,chances);
8428
8429 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8430 {
8432 }
8433 }
8434 }
8435 }
8436
8438 {
8439 CargoBase cargo = GetInventory().GetCargo();
8440 if (cargo)
8441 {
8443 if (item_count > 0)
8444 {
8445 int random_pick = Math.RandomInt(0, item_count);
8447 if (!item.IsExplosive())
8448 {
8449 item.AddHealth("","",damage);
8450 return true;
8451 }
8452 }
8453 }
8454 return false;
8455 }
8456
8458 {
8459 GameInventory inventory = GetInventory();
8461 if (attachment_count > 0)
8462 {
8463 int random_pick = Math.RandomInt(0, attachment_count);
8465 if (!attachment.IsExplosive())
8466 {
8467 attachment.AddHealth("","",damage);
8468 return true;
8469 }
8470 }
8471 return false;
8472 }
8473
8475 {
8477 }
8478
8480 {
8482 return GetInventory().CanRemoveEntity();
8483
8484 return false;
8485 }
8486
8488 {
8489
8491 return false;
8492
8493
8495 return false;
8496
8497
8498
8500 if (delta == 0)
8501 return false;
8502
8503
8504 return true;
8505 }
8506
8508 {
8510 {
8511 if (ScriptInputUserData.CanStoreInputUserData())
8512 {
8513 ScriptInputUserData ctx = new ScriptInputUserData;
8518 ctx.
Write(destination_entity);
8522 }
8523 }
8524 else if (!
g_Game.IsMultiplayer())
8525 {
8527 }
8528 }
8529
8531 {
8532 float split_quantity_new;
8536 InventoryLocation loc = new InventoryLocation;
8537
8538 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8539 {
8541 split_quantity_new = stack_max;
8542 else
8544
8546 {
8547 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8548 if (new_item)
8549 {
8550 new_item.SetResultOfSplit(true);
8551 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8553 new_item.
SetQuantity(split_quantity_new,
false,
true);
8554 }
8555 }
8556 }
8557 else if (destination_entity && slot_id == -1)
8558 {
8559 if (quantity > stack_max)
8560 split_quantity_new = stack_max;
8561 else
8562 split_quantity_new = quantity;
8563
8565 {
8566 GameInventory destinationInventory = destination_entity.GetInventory();
8568 {
8571 }
8572
8573 if (new_item)
8574 {
8575 new_item.SetResultOfSplit(true);
8576 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8578 new_item.
SetQuantity(split_quantity_new,
false,
true);
8579 }
8580 }
8581 }
8582 else
8583 {
8584 if (stack_max != 0)
8585 {
8587 {
8589 }
8590
8591 if (split_quantity_new == 0)
8592 {
8593 if (!
g_Game.IsMultiplayer())
8594 player.PhysicalPredictiveDropItem(this);
8595 else
8596 player.ServerDropEntity(this);
8597 return;
8598 }
8599
8601 {
8603
8604 if (new_item)
8605 {
8606 new_item.SetResultOfSplit(true);
8607 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8610 new_item.PlaceOnSurface();
8611 }
8612 }
8613 }
8614 }
8615 }
8616
8618 {
8619 float split_quantity_new;
8623 InventoryLocation loc = new InventoryLocation;
8624
8625 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8626 {
8628 split_quantity_new = stack_max;
8629 else
8631
8633 {
8634 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8635 if (new_item)
8636 {
8637 new_item.SetResultOfSplit(true);
8638 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8640 new_item.
SetQuantity(split_quantity_new,
false,
true);
8641 }
8642 }
8643 }
8644 else if (destination_entity && slot_id == -1)
8645 {
8646 if (quantity > stack_max)
8647 split_quantity_new = stack_max;
8648 else
8649 split_quantity_new = quantity;
8650
8652 {
8653 GameInventory destinationInventory = destination_entity.GetInventory();
8655 {
8658 }
8659
8660 if (new_item)
8661 {
8662 new_item.SetResultOfSplit(true);
8663 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8665 new_item.
SetQuantity(split_quantity_new,
false,
true);
8666 }
8667 }
8668 }
8669 else
8670 {
8671 if (stack_max != 0)
8672 {
8674 {
8676 }
8677
8679 {
8681
8682 if (new_item)
8683 {
8684 new_item.SetResultOfSplit(true);
8685 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8688 new_item.PlaceOnSurface();
8689 }
8690 }
8691 }
8692 }
8693 }
8694
8696 {
8698 {
8699 if (ScriptInputUserData.CanStoreInputUserData())
8700 {
8701 ScriptInputUserData ctx = new ScriptInputUserData;
8706 dst.WriteToContext(ctx);
8708 }
8709 }
8710 else if (!
g_Game.IsMultiplayer())
8711 {
8713 }
8714 }
8715
8717 {
8719 {
8720 if (ScriptInputUserData.CanStoreInputUserData())
8721 {
8722 ScriptInputUserData ctx = new ScriptInputUserData;
8727 ctx.
Write(destination_entity);
8733 }
8734 }
8735 else if (!
g_Game.IsMultiplayer())
8736 {
8738 }
8739 }
8740
8742 {
8744 }
8745
8747 {
8749 float split_quantity_new;
8751 if (dst.IsValid())
8752 {
8753 int slot_id = dst.GetSlot();
8755
8756 if (quantity > stack_max)
8757 split_quantity_new = stack_max;
8758 else
8759 split_quantity_new = quantity;
8760
8762 {
8764
8765 if (new_item)
8766 {
8767 new_item.SetResultOfSplit(true);
8768 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8770 new_item.
SetQuantity(split_quantity_new,
false,
true);
8771 }
8772
8773 return new_item;
8774 }
8775 }
8776
8777 return null;
8778 }
8779
8781 {
8783 float split_quantity_new;
8785 if (destination_entity)
8786 {
8788 if (quantity > stackable)
8789 split_quantity_new = stackable;
8790 else
8791 split_quantity_new = quantity;
8792
8794 {
8795 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8796 if (new_item)
8797 {
8798 new_item.SetResultOfSplit(true);
8799 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8801 new_item.
SetQuantity(split_quantity_new,
false,
true);
8802 }
8803 }
8804 }
8805 }
8806
8808 {
8810 {
8811 if (ScriptInputUserData.CanStoreInputUserData())
8812 {
8813 ScriptInputUserData ctx = new ScriptInputUserData;
8818 ItemBase destination_entity =
this;
8819 ctx.
Write(destination_entity);
8823 }
8824 }
8825 else if (!
g_Game.IsMultiplayer())
8826 {
8828 }
8829 }
8830
8832 {
8834 float split_quantity_new;
8836 if (player)
8837 {
8839 if (quantity > stackable)
8840 split_quantity_new = stackable;
8841 else
8842 split_quantity_new = quantity;
8843
8845 {
8846 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8847 new_item =
ItemBase.Cast(in_hands);
8848 if (new_item)
8849 {
8850 new_item.SetResultOfSplit(true);
8851 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8853 new_item.SetQuantity(split_quantity_new, false, true);
8854 }
8855 }
8856 }
8857 }
8858
8860 {
8862 float split_quantity_new = Math.Floor(quantity * 0.5);
8863
8865 return;
8866
8868
8869 if (new_item)
8870 {
8871 if (new_item.GetQuantityMax() < split_quantity_new)
8872 {
8873 split_quantity_new = new_item.GetQuantityMax();
8874 }
8875
8876 new_item.SetResultOfSplit(true);
8877 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8878
8880 {
8883 }
8884 else
8885 {
8887 new_item.
SetQuantity(split_quantity_new,
false,
true);
8888 }
8889 }
8890 }
8891
8893 {
8895 float split_quantity_new = Math.Floor(quantity / 2);
8896
8898 return;
8899
8900 InventoryLocation invloc = new InventoryLocation;
8902
8904 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8905
8906 if (new_item)
8907 {
8908 if (new_item.GetQuantityMax() < split_quantity_new)
8909 {
8910 split_quantity_new = new_item.GetQuantityMax();
8911 }
8913 {
8916 }
8917 else if (split_quantity_new > 1)
8918 {
8920 new_item.
SetQuantity(split_quantity_new,
false,
true);
8921 }
8922 }
8923 }
8924
8927 {
8928 SetWeightDirty();
8930
8931 if (parent)
8932 parent.OnAttachmentQuantityChangedEx(this, delta);
8933
8935 {
8937 {
8939 }
8941 {
8942 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8944 }
8945 }
8946 }
8947
8950 {
8951
8952 }
8953
8956 {
8958 }
8959
8961 {
8962 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8963
8965 {
8966 if (newLevel == GameConstants.STATE_RUINED)
8967 {
8969 EntityAI parent = GetHierarchyParent();
8970 if (parent && parent.IsFireplace())
8971 {
8972 CargoBase cargo = GetInventory().GetCargo();
8973 if (cargo)
8974 {
8976 {
8978 }
8979 }
8980 }
8981 }
8982
8984 {
8985
8987 return;
8988 }
8989
8990 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8991 {
8993 }
8994 }
8995 }
8996
8997
8999 {
9000 super.OnRightClick();
9001
9003 {
9005 {
9006 if (ScriptInputUserData.CanStoreInputUserData())
9007 {
9008 EntityAI root = GetHierarchyRoot();
9009 Man playerOwner = GetHierarchyRootPlayer();
9010 InventoryLocation dst = new InventoryLocation;
9011
9012
9013 if (!playerOwner && root && root == this)
9014 {
9016 }
9017 else
9018 {
9019
9020 GetInventory().GetCurrentInventoryLocation(dst);
9022 {
9023 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9025 {
9027 }
9028 else
9029 {
9031
9032
9033 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9034 {
9036 }
9037 else
9038 {
9039 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9040 }
9041 }
9042 }
9043 }
9044
9045 ScriptInputUserData ctx = new ScriptInputUserData;
9053 }
9054 }
9055 else if (!
g_Game.IsMultiplayer())
9056 {
9058 }
9059 }
9060 }
9061
9063 {
9064 if (root)
9065 {
9066 vector m4[4];
9067 root.GetTransform(m4);
9068 dst.SetGround(this, m4);
9069 }
9070 else
9071 {
9072 GetInventory().GetCurrentInventoryLocation(dst);
9073 }
9074 }
9075
9076 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9077 {
9078
9079 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9080 return false;
9081
9082 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9083 return false;
9084
9085
9087 return false;
9088
9089
9090 Magazine mag = Magazine.Cast(this);
9091 if (mag)
9092 {
9093 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9094 return false;
9095
9096 if (stack_max_limit)
9097 {
9098 Magazine other_mag = Magazine.Cast(other_item);
9099 if (other_item)
9100 {
9101 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9102 return false;
9103 }
9104
9105 }
9106 }
9107 else
9108 {
9109
9111 return false;
9112
9114 return false;
9115 }
9116
9117 PlayerBase player = null;
9118 if (CastTo(player, GetHierarchyRootPlayer()))
9119 {
9120 if (player.GetInventory().HasAttachment(this))
9121 return false;
9122
9123 if (player.IsItemsToDelete())
9124 return false;
9125 }
9126
9127 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9128 return false;
9129
9130 int slotID;
9132 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9133 return false;
9134
9135 return true;
9136 }
9137
9139 {
9141 }
9142
9144 {
9145 return m_IsResultOfSplit;
9146 }
9147
9149 {
9150 m_IsResultOfSplit = value;
9151 }
9152
9154 {
9156 }
9157
9159 {
9160 float other_item_quantity = other_item.GetQuantity();
9161 float this_free_space;
9162
9164
9166
9167 if (other_item_quantity > this_free_space)
9168 {
9169 return this_free_space;
9170 }
9171 else
9172 {
9173 return other_item_quantity;
9174 }
9175 }
9176
9178 {
9180 }
9181
9183 {
9185 return;
9186
9187 if (!IsMagazine() && other_item)
9188 {
9190 if (quantity_used != 0)
9191 {
9192 float hp1 = GetHealth01("","");
9193 float hp2 = other_item.GetHealth01("","");
9194 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9195 hpResult = hpResult / (
GetQuantity() + quantity_used);
9196
9197 hpResult *= GetMaxHealth();
9198 Math.Round(hpResult);
9199 SetHealth("", "Health", hpResult);
9200
9202 other_item.AddQuantity(-quantity_used);
9203 }
9204 }
9206 }
9207
9209 {
9210 #ifdef SERVER
9211 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9212 GetHierarchyParent().IncreaseLifetimeUp();
9213 #endif
9214 };
9215
9217 {
9218 PlayerBase p = PlayerBase.Cast(player);
9219
9220 array<int> recipesIds = p.m_Recipes;
9221 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9222 if (moduleRecipesManager)
9223 {
9224 EntityAI itemInHands = player.GetEntityInHands();
9225 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9226 }
9227
9228 for (int i = 0;i < recipesIds.Count(); i++)
9229 {
9230 int key = recipesIds.Get(i);
9231 string recipeName = moduleRecipesManager.GetRecipeName(key);
9233 }
9234 }
9235
9236
9237 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9238 {
9239 super.GetDebugActions(outputList);
9240
9241
9247
9248
9253
9258
9259
9263
9264
9266 {
9270 }
9271
9274
9275
9279
9281
9282 InventoryLocation loc = new InventoryLocation();
9283 GetInventory().GetCurrentInventoryLocation(loc);
9285 {
9286 if (Gizmo_IsSupported())
9289 }
9290
9292 }
9293
9294
9295
9296
9298 {
9299 super.OnAction(action_id, player, ctx);
9300
9302 {
9303 switch (action_id)
9304 {
9308 return true;
9312 return true;
9313 }
9314 }
9315
9317 {
9318 switch (action_id)
9319 {
9321 Delete();
9322 return true;
9323 }
9324 }
9325
9326 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9327 {
9328 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9329 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9330 PlayerBase p = PlayerBase.Cast(player);
9331 if (
EActions.RECIPES_RANGE_START < 1000)
9332 {
9333 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9334 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9335 }
9336 }
9337 #ifndef SERVER
9338 else if (action_id ==
EActions.WATCH_PLAYER)
9339 {
9340 PluginDeveloper.SetDeveloperItemClientEx(player);
9341 }
9342 #endif
9344 {
9345 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9346 {
9347 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9348 OnDebugButtonPressServer(id + 1);
9349 }
9350
9351 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9352 {
9353 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9355 }
9356
9357 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9358 {
9359 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9361 }
9362
9363 else if (action_id ==
EActions.ADD_QUANTITY)
9364 {
9365 if (IsMagazine())
9366 {
9367 Magazine mag = Magazine.Cast(this);
9368 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9369 }
9370 else
9371 {
9373 }
9374
9375 if (m_EM)
9376 {
9377 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9378 }
9379
9380 }
9381
9382 else if (action_id ==
EActions.REMOVE_QUANTITY)
9383 {
9384 if (IsMagazine())
9385 {
9386 Magazine mag2 = Magazine.Cast(this);
9387 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9388 }
9389 else
9390 {
9392 }
9393 if (m_EM)
9394 {
9395 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9396 }
9397
9398 }
9399
9400 else if (action_id ==
EActions.SET_QUANTITY_0)
9401 {
9403
9404 if (m_EM)
9405 {
9406 m_EM.SetEnergy(0);
9407 }
9408 }
9409
9410 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9411 {
9413
9414 if (m_EM)
9415 {
9416 m_EM.SetEnergy(m_EM.GetEnergyMax());
9417 }
9418 }
9419
9420 else if (action_id ==
EActions.ADD_HEALTH)
9421 {
9422 AddHealth("","",GetMaxHealth("","Health")/5);
9423 }
9424 else if (action_id ==
EActions.REMOVE_HEALTH)
9425 {
9426 AddHealth("","",-GetMaxHealth("","Health")/5);
9427 }
9428 else if (action_id ==
EActions.DESTROY_HEALTH)
9429 {
9430 SetHealth01("","",0);
9431 }
9432 else if (action_id ==
EActions.WATCH_ITEM)
9433 {
9435 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9436 #ifdef DEVELOPER
9437 SetDebugDeveloper_item(this);
9438 #endif
9439 }
9440
9441 else if (action_id ==
EActions.ADD_TEMPERATURE)
9442 {
9443 AddTemperature(20);
9444
9445 }
9446
9447 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9448 {
9449 AddTemperature(-20);
9450
9451 }
9452
9453 else if (action_id ==
EActions.FLIP_FROZEN)
9454 {
9455 SetFrozen(!GetIsFrozen());
9456
9457 }
9458
9459 else if (action_id ==
EActions.ADD_WETNESS)
9460 {
9462
9463 }
9464
9465 else if (action_id ==
EActions.REMOVE_WETNESS)
9466 {
9468
9469 }
9470
9471 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9472 {
9475
9476
9477 }
9478
9479 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9480 {
9483 }
9484
9485 else if (action_id ==
EActions.MAKE_SPECIAL)
9486 {
9487 auto debugParams = DebugSpawnParams.WithPlayer(player);
9488 OnDebugSpawnEx(debugParams);
9489 }
9490
9491 }
9492
9493
9494 return false;
9495 }
9496
9497
9498
9499
9503
9506
9507
9508
9510 {
9511 return false;
9512 }
9513
9514
9516 {
9517 return true;
9518 }
9519
9520
9522 {
9523 return true;
9524 }
9525
9526
9527
9529 {
9530 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9531 return g_Game.ConfigIsExisting(config_path);
9532 }
9533
9536 {
9537 return null;
9538 }
9539
9541 {
9542 return false;
9543 }
9544
9546 {
9547 return false;
9548 }
9549
9553
9554
9556 {
9557 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9558 return module_repairing.CanRepair(this, item_repair_kit);
9559 }
9560
9561
9562 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9563 {
9564 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9565 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9566 }
9567
9568
9570 {
9571
9572
9573
9574
9575
9576
9577
9578
9579 return 1;
9580 }
9581
9582
9583
9585 {
9587 }
9588
9589
9590
9592 {
9594 }
9595
9596
9605 {
9606 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9607
9608 if (player)
9609 {
9610 player.MessageStatus(text);
9611 }
9612 }
9613
9614
9623 {
9624 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9625
9626 if (player)
9627 {
9628 player.MessageAction(text);
9629 }
9630 }
9631
9632
9641 {
9642 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9643
9644 if (player)
9645 {
9646 player.MessageFriendly(text);
9647 }
9648 }
9649
9650
9659 {
9660 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9661
9662 if (player)
9663 {
9664 player.MessageImportant(text);
9665 }
9666 }
9667
9669 {
9670 return true;
9671 }
9672
9673
9674 override bool KindOf(
string tag)
9675 {
9676 bool found = false;
9677 string item_name = this.
GetType();
9679 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9680
9681 int array_size = item_tag_array.Count();
9682 for (int i = 0; i < array_size; i++)
9683 {
9684 if (item_tag_array.Get(i) == tag)
9685 {
9686 found = true;
9687 break;
9688 }
9689 }
9690 return found;
9691 }
9692
9693
9695 {
9696
9697 super.OnRPC(sender, rpc_type,ctx);
9698
9699
9700 switch (rpc_type)
9701 {
9702 #ifndef SERVER
9703 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9704 Param2<bool, string> p = new Param2<bool, string>(false, "");
9705
9707 return;
9708
9709 bool play = p.param1;
9710 string soundSet = p.param2;
9711
9712 if (play)
9713 {
9715 {
9717 {
9719 }
9720 }
9721 else
9722 {
9724 }
9725 }
9726 else
9727 {
9729 }
9730
9731 break;
9732 #endif
9733
9734 }
9735
9737 {
9739 }
9740 }
9741
9742
9743
9744
9746 {
9747 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9748 return plugin.GetID(
name);
9749 }
9750
9752 {
9753 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9754 return plugin.GetName(id);
9755 }
9756
9759 {
9760
9761
9762 int varFlags;
9763 if (!ctx.
Read(varFlags))
9764 return;
9765
9766 if (varFlags & ItemVariableFlags.FLOAT)
9767 {
9769 }
9770 }
9771
9773 {
9774
9775 super.SerializeNumericalVars(floats_out);
9776
9777
9778
9780 {
9782 }
9783
9785 {
9787 }
9788
9790 {
9792 }
9793
9795 {
9800 }
9801
9803 {
9805 }
9806 }
9807
9809 {
9810
9811 super.DeSerializeNumericalVars(floats);
9812
9813
9814 int index = 0;
9815 int mask = Math.Round(floats.Get(index));
9816
9817 index++;
9818
9820 {
9822 {
9824 }
9825 else
9826 {
9827 float quantity = floats.Get(index);
9829 }
9830 index++;
9831 }
9832
9834 {
9835 float wet = floats.Get(index);
9837 index++;
9838 }
9839
9841 {
9842 int liquidtype = Math.Round(floats.Get(index));
9844 index++;
9845 }
9846
9848 {
9850 index++;
9852 index++;
9854 index++;
9856 index++;
9857 }
9858
9860 {
9861 int cleanness = Math.Round(floats.Get(index));
9863 index++;
9864 }
9865 }
9866
9868 {
9869 super.WriteVarsToCTX(ctx);
9870
9871
9873 {
9875 }
9876
9878 {
9880 }
9881
9883 {
9885 }
9886
9888 {
9889 int r,g,b,a;
9895 }
9896
9898 {
9900 }
9901 }
9902
9904 {
9905 if (!super.ReadVarsFromCTX(ctx,version))
9906 return false;
9907
9908 int intValue;
9909 float value;
9910
9911 if (version < 140)
9912 {
9913 if (!ctx.
Read(intValue))
9914 return false;
9915
9916 m_VariablesMask = intValue;
9917 }
9918
9920 {
9921 if (!ctx.
Read(value))
9922 return false;
9923
9925 {
9927 }
9928 else
9929 {
9931 }
9932 }
9933
9934 if (version < 140)
9935 {
9937 {
9938 if (!ctx.
Read(value))
9939 return false;
9940 SetTemperatureDirect(value);
9941 }
9942 }
9943
9945 {
9946 if (!ctx.
Read(value))
9947 return false;
9949 }
9950
9952 {
9953 if (!ctx.
Read(intValue))
9954 return false;
9956 }
9957
9959 {
9960 int r,g,b,a;
9962 return false;
9964 return false;
9966 return false;
9968 return false;
9969
9971 }
9972
9974 {
9975 if (!ctx.
Read(intValue))
9976 return false;
9978 }
9979
9980 if (version >= 138 && version < 140)
9981 {
9983 {
9984 if (!ctx.
Read(intValue))
9985 return false;
9986 SetFrozen(intValue);
9987 }
9988 }
9989
9990 return true;
9991 }
9992
9993
9995 {
9998 {
10000 }
10001
10002 if (!super.OnStoreLoad(ctx, version))
10003 {
10005 return false;
10006 }
10007
10008 if (version >= 114)
10009 {
10010 bool hasQuickBarIndexSaved;
10011
10012 if (!ctx.
Read(hasQuickBarIndexSaved))
10013 {
10015 return false;
10016 }
10017
10018 if (hasQuickBarIndexSaved)
10019 {
10020 int itmQBIndex;
10021
10022
10023 if (!ctx.
Read(itmQBIndex))
10024 {
10026 return false;
10027 }
10028
10029 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10030 if (itmQBIndex != -1 && parentPlayer)
10031 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10032 }
10033 }
10034 else
10035 {
10036
10037 PlayerBase player;
10038 int itemQBIndex;
10039 if (version ==
int.
MAX)
10040 {
10041 if (!ctx.
Read(itemQBIndex))
10042 {
10044 return false;
10045 }
10046 }
10047 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10048 {
10049
10050 if (!ctx.
Read(itemQBIndex))
10051 {
10053 return false;
10054 }
10055 if (itemQBIndex != -1 && player)
10056 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10057 }
10058 }
10059
10060 if (version < 140)
10061 {
10062
10063 if (!LoadVariables(ctx, version))
10064 {
10066 return false;
10067 }
10068 }
10069
10070
10072 {
10074 return false;
10075 }
10076 if (version >= 132)
10077 {
10079 if (raib)
10080 {
10082 {
10084 return false;
10085 }
10086 }
10087 }
10088
10090 return true;
10091 }
10092
10093
10094
10096 {
10097 super.OnStoreSave(ctx);
10098
10099 PlayerBase player;
10100 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10101 {
10103
10104 int itemQBIndex = -1;
10105 itemQBIndex = player.FindQuickBarEntityIndex(this);
10106 ctx.
Write(itemQBIndex);
10107 }
10108 else
10109 {
10111 }
10112
10114
10116 if (raib)
10117 {
10119 }
10120 }
10121
10122
10124 {
10125 super.AfterStoreLoad();
10126
10128 {
10130 }
10131
10133 {
10136 }
10137 }
10138
10140 {
10141 super.EEOnAfterLoad();
10142
10144 {
10146 }
10147
10150 }
10151
10153 {
10154 return false;
10155 }
10156
10157
10158
10160 {
10162 {
10163 #ifdef PLATFORM_CONSOLE
10164
10166 {
10168 if (menu)
10169 {
10171 }
10172 }
10173 #endif
10174 }
10175
10177 {
10180 }
10181
10183 {
10184 SetWeightDirty();
10186 }
10188 {
10191 }
10192
10194 {
10197
10200 }
10202 {
10206 }
10207
10208 super.OnVariablesSynchronized();
10209 }
10210
10211
10212
10214 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10215 {
10216 if (!IsServerCheck(allow_client))
10217 return false;
10218
10220 return false;
10221
10224
10225 if (value <= (min + 0.001))
10226 value = min;
10227
10228 if (value == min)
10229 {
10230 if (destroy_config)
10231 {
10232 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10233 if (dstr)
10234 {
10236 this.Delete();
10237 return true;
10238 }
10239 }
10240 else if (destroy_forced)
10241 {
10243 this.Delete();
10244 return true;
10245 }
10246
10248 }
10249
10252
10254 {
10255 EntityAI parent = GetHierarchyRoot();
10256 InventoryLocation iLoc = new InventoryLocation();
10257 GetInventory().GetCurrentInventoryLocation(iLoc);
10259 {
10260 int iLocSlot = iLoc.
GetSlot();
10262 {
10264 }
10266 {
10268 }
10269 }
10270 }
10271
10273 {
10275
10276 if (delta)
10278 }
10279
10281
10282 return false;
10283 }
10284
10285
10287 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10288 {
10290 }
10291
10293 {
10296 }
10297
10299 {
10302 }
10303
10305 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10306 {
10307 float value_clamped = Math.Clamp(value, 0, 1);
10309 SetQuantity(result, destroy_config, destroy_forced);
10310 }
10311
10312
10315 {
10317 }
10318
10320 {
10322 }
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10334 {
10335 int slot = -1;
10336 GameInventory inventory = GetInventory();
10337 if (inventory)
10338 {
10339 InventoryLocation il = new InventoryLocation;
10342 }
10343
10345 }
10346
10348 {
10349 float quantity_max = 0;
10350
10352 {
10353 if (attSlotID != -1)
10354 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10355
10356 if (quantity_max <= 0)
10358 }
10359
10360 if (quantity_max <= 0)
10362
10363 return quantity_max;
10364 }
10365
10367 {
10369 }
10370
10372 {
10374 }
10375
10376
10378 {
10380 }
10381
10383 {
10385 }
10386
10388 {
10390 }
10391
10392
10394 {
10395
10396 float weightEx = GetWeightEx();
10397 float special = GetInventoryAndCargoWeight();
10398 return weightEx - special;
10399 }
10400
10401
10403 {
10405 }
10406
10408 {
10410 {
10411 #ifdef DEVELOPER
10412 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10413 {
10414 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10416 }
10417 #endif
10418
10419 return GetQuantity() * GetConfigWeightModified();
10420 }
10421 else if (HasEnergyManager())
10422 {
10423 #ifdef DEVELOPER
10424 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10425 {
10426 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10427 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10428 }
10429 #endif
10430 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10431 }
10432 else
10433 {
10434 #ifdef DEVELOPER
10435 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10436 {
10437 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10438 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10439 }
10440 #endif
10441 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10442 }
10443 }
10444
10447 {
10448 int item_count = 0;
10450
10451 GameInventory inventory = GetInventory();
10452 CargoBase cargo = inventory.
GetCargo();
10453 if (cargo != NULL)
10454 {
10456 }
10457
10459 for (int i = 0; i < nAttachments; ++i)
10460 {
10462 if (item)
10463 item_count += item.GetNumberOfItems();
10464 }
10465 return item_count;
10466 }
10467
10470 {
10471 float weight = 0;
10472 float wetness = 1;
10473 if (include_wetness)
10476 {
10477 weight = wetness * m_ConfigWeight;
10478 }
10480 {
10481 weight = 1;
10482 }
10483 return weight;
10484 }
10485
10486
10487
10489 {
10490 GameInventory inventory = GetInventory();
10491 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10492 {
10493 array<EntityAI> items = new array<EntityAI>;
10495 for (int i = 0; i < items.Count(); ++i)
10496 {
10498 if (item)
10499 {
10500 g_Game.ObjectDelete(item);
10501 }
10502 }
10503 }
10504 }
10505
10506
10507
10508
10510 {
10511 float energy = 0;
10512 if (HasEnergyManager())
10513 {
10514 energy = GetCompEM().GetEnergy();
10515 }
10516 return energy;
10517 }
10518
10519
10521 {
10522 super.OnEnergyConsumed();
10523
10525 }
10526
10528 {
10529 super.OnEnergyAdded();
10530
10532 }
10533
10534
10536 {
10537 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10538 {
10540 {
10541 float energy_0to1 = GetCompEM().GetEnergy0To1();
10543 }
10544 }
10545 }
10546
10547
10549 {
10550 return ConfigGetFloat("heatIsolation");
10551 }
10552
10554 {
10556 }
10557
10559 {
10560 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10561 if (
g_Game.ConfigIsExisting(paramPath))
10562 return g_Game.ConfigGetFloat(paramPath);
10563
10564 return 0.0;
10565 }
10566
10568 {
10569 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10570 if (
g_Game.ConfigIsExisting(paramPath))
10571 return g_Game.ConfigGetFloat(paramPath);
10572
10573 return 0.0;
10574 }
10575
10576 override void SetWet(
float value,
bool allow_client =
false)
10577 {
10578 if (!IsServerCheck(allow_client))
10579 return;
10580
10583
10585
10586 m_VarWet = Math.Clamp(value, min, max);
10587
10589 {
10592 }
10593 }
10594
10595 override void AddWet(
float value)
10596 {
10598 }
10599
10601 {
10603 }
10604
10606 {
10608 }
10609
10611 {
10613 }
10614
10616 {
10618 }
10619
10621 {
10623 }
10624
10625 override void OnWetChanged(
float newVal,
float oldVal)
10626 {
10629 if (newLevel != oldLevel)
10630 {
10632 }
10633 }
10634
10636 {
10637 SetWeightDirty();
10638 }
10639
10641 {
10642 return GetWetLevelInternal(
m_VarWet);
10643 }
10644
10645
10646
10648 {
10650 }
10651
10653 {
10655 }
10656
10658 {
10660 }
10661
10663 {
10665 }
10666
10667
10668
10670 {
10671 if (ConfigIsExisting("itemModelLength"))
10672 {
10673 return ConfigGetFloat("itemModelLength");
10674 }
10675 return 0;
10676 }
10677
10679 {
10680 if (ConfigIsExisting("itemAttachOffset"))
10681 {
10682 return ConfigGetFloat("itemAttachOffset");
10683 }
10684 return 0;
10685 }
10686
10687 override void SetCleanness(
int value,
bool allow_client =
false)
10688 {
10689 if (!IsServerCheck(allow_client))
10690 return;
10691
10693
10695
10698 }
10699
10701 {
10703 }
10704
10706 {
10707 return true;
10708 }
10709
10710
10711
10712
10714 {
10716 }
10717
10719 {
10721 }
10722
10723
10724
10725
10726 override void SetColor(
int r,
int g,
int b,
int a)
10727 {
10733 }
10735 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10736 {
10741 }
10742
10744 {
10746 }
10747
10750 {
10751 int r,g,b,a;
10753 r = r/255;
10754 g = g/255;
10755 b = b/255;
10756 a = a/255;
10757 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10758 }
10759
10760
10761
10762 override void SetLiquidType(
int value,
bool allow_client =
false)
10763 {
10764 if (!IsServerCheck(allow_client))
10765 return;
10766
10771 }
10772
10774 {
10775 return ConfigGetInt("varLiquidTypeInit");
10776 }
10777
10779 {
10781 }
10782
10784 {
10786 SetFrozen(false);
10787 }
10788
10791 {
10792 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10793 }
10794
10795
10798 {
10799 PlayerBase nplayer;
10800 if (PlayerBase.CastTo(nplayer, player))
10801 {
10803 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10804 }
10805 }
10806
10807
10810 {
10811 PlayerBase nplayer;
10812 if (PlayerBase.CastTo(nplayer,player))
10813 {
10814 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10815 }
10816
10817 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10818
10819 if (HasEnergyManager())
10820 {
10821 GetCompEM().UpdatePlugState();
10822 }
10823 }
10824
10825
10827 {
10828 super.OnPlacementStarted(player);
10829
10831 }
10832
10833 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10834 {
10836 {
10837 m_AdminLog.OnPlacementComplete(player,
this);
10838 }
10839
10840 super.OnPlacementComplete(player, position, orientation);
10841 }
10842
10843
10844
10845
10846
10848 {
10850 {
10851 return true;
10852 }
10853 else
10854 {
10855 return false;
10856 }
10857 }
10858
10859
10861 {
10863 {
10865 }
10866 }
10867
10868
10870 {
10872 }
10873
10875 {
10877 }
10878
10879 override void InsertAgent(
int agent,
float count = 1)
10880 {
10881 if (count < 1)
10882 return;
10883
10885 }
10886
10889 {
10891 }
10892
10893
10895 {
10897 }
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10941 {
10943 return false;
10944 return true;
10945 }
10946
10948 {
10949
10951 }
10952
10953
10956 {
10957 super.CheckForRoofLimited(timeTresholdMS);
10958
10959 float time =
g_Game.GetTime();
10960 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10961 {
10962 m_PreviousRoofTestTime = time;
10963 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10964 }
10965 }
10966
10967
10969 {
10971 {
10972 return 0;
10973 }
10974
10975 if (GetInventory().GetAttachmentSlotsCount() != 0)
10976 {
10977 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10978 if (filter)
10979 return filter.GetProtectionLevel(type, false, system);
10980 else
10981 return 0;
10982 }
10983
10984 string subclassPath, entryName;
10985
10986 switch (type)
10987 {
10989 entryName = "biological";
10990 break;
10992 entryName = "chemical";
10993 break;
10994 default:
10995 entryName = "biological";
10996 break;
10997 }
10998
10999 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11000
11001 return g_Game.ConfigGetFloat(subclassPath + entryName);
11002 }
11003
11004
11005
11008 {
11009 if (!IsMagazine())
11011
11013 }
11014
11015
11016
11017
11018
11023 {
11024 return true;
11025 }
11026
11028 {
11030 }
11031
11032
11033
11034
11035
11037 {
11038 if (parent)
11039 {
11040 if (parent.IsInherited(DayZInfected))
11041 return true;
11042
11043 if (!parent.IsRuined())
11044 return true;
11045 }
11046
11047 return true;
11048 }
11049
11051 {
11052 if (!super.CanPutAsAttachment(parent))
11053 {
11054 return false;
11055 }
11056
11057 if (!IsRuined() && !parent.IsRuined())
11058 {
11059 return true;
11060 }
11061
11062 return false;
11063 }
11064
11066 {
11067
11068
11069
11070
11071 return super.CanReceiveItemIntoCargo(item);
11072 }
11073
11075 {
11076
11077
11078
11079
11080 GameInventory attachmentInv = attachment.GetInventory();
11082 {
11083 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11084 return false;
11085 }
11086
11087 InventoryLocation loc = new InventoryLocation();
11088 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11089 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11090 return false;
11091
11092 return super.CanReceiveAttachment(attachment, slotId);
11093 }
11094
11096 {
11097 if (!super.CanReleaseAttachment(attachment))
11098 return false;
11099
11100 return GetInventory().AreChildrenAccessible();
11101 }
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11124 {
11125 int id = muzzle_owner.GetMuzzleID();
11126 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11127
11128 if (WPOF_array)
11129 {
11130 for (int i = 0; i < WPOF_array.Count(); i++)
11131 {
11132 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11133
11134 if (WPOF)
11135 {
11136 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11137 }
11138 }
11139 }
11140 }
11141
11142
11144 {
11145 int id = muzzle_owner.GetMuzzleID();
11147
11148 if (WPOBE_array)
11149 {
11150 for (int i = 0; i < WPOBE_array.Count(); i++)
11151 {
11152 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11153
11154 if (WPOBE)
11155 {
11156 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11157 }
11158 }
11159 }
11160 }
11161
11162
11164 {
11165 int id = muzzle_owner.GetMuzzleID();
11166 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11167
11168 if (WPOOH_array)
11169 {
11170 for (int i = 0; i < WPOOH_array.Count(); i++)
11171 {
11172 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11173
11174 if (WPOOH)
11175 {
11176 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11177 }
11178 }
11179 }
11180 }
11181
11182
11184 {
11185 int id = muzzle_owner.GetMuzzleID();
11186 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11187
11188 if (WPOOH_array)
11189 {
11190 for (int i = 0; i < WPOOH_array.Count(); i++)
11191 {
11192 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11193
11194 if (WPOOH)
11195 {
11196 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11197 }
11198 }
11199 }
11200 }
11201
11202
11204 {
11205 int id = muzzle_owner.GetMuzzleID();
11206 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11207
11208 if (WPOOH_array)
11209 {
11210 for (int i = 0; i < WPOOH_array.Count(); i++)
11211 {
11212 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11213
11214 if (WPOOH)
11215 {
11216 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11217 }
11218 }
11219 }
11220 }
11221
11222
11223
11225 {
11227 {
11228 return true;
11229 }
11230
11231 return false;
11232 }
11233
11235 {
11237 {
11238 return true;
11239 }
11240
11241 return false;
11242 }
11243
11245 {
11247 {
11248 return true;
11249 }
11250
11251 return false;
11252 }
11253
11255 {
11256 return false;
11257 }
11258
11261 {
11262 return UATimeSpent.DEFAULT_DEPLOY;
11263 }
11264
11265
11266
11267
11269 {
11271 SetSynchDirty();
11272 }
11273
11275 {
11277 }
11278
11279
11281 {
11282 return false;
11283 }
11284
11287 {
11288 string att_type = "None";
11289
11290 if (ConfigIsExisting("soundAttType"))
11291 {
11292 att_type = ConfigGetString("soundAttType");
11293 }
11294
11296 }
11297
11299 {
11301 }
11302
11303
11304
11305
11306
11312
11314 {
11317
11319 }
11320
11321
11323 {
11325 return;
11326
11328
11331
11334
11335 SoundParameters params = new SoundParameters();
11339 }
11340
11341
11343 {
11345 {
11348
11349 SetSynchDirty();
11350
11353 }
11354 }
11355
11357 {
11359 }
11360
11361
11363 {
11365 return;
11366
11368 SetSynchDirty();
11369
11372 }
11373
11375 {
11378 }
11379
11381 {
11383 }
11384
11385 void OnApply(PlayerBase player);
11386
11388 {
11389 return 1.0;
11390 };
11391
11393 {
11395 }
11396
11398 {
11400 }
11401
11403
11405 {
11406 SetDynamicPhysicsLifeTime(0.01);
11408 }
11409
11411 {
11412 array<string> zone_names = new array<string>;
11413 GetDamageZones(zone_names);
11414 for (int i = 0; i < zone_names.Count(); i++)
11415 {
11416 SetHealthMax(zone_names.Get(i),"Health");
11417 }
11418 SetHealthMax("","Health");
11419 }
11420
11423 {
11424 float global_health = GetHealth01("","Health");
11425 array<string> zones = new array<string>;
11426 GetDamageZones(zones);
11427
11428 for (int i = 0; i < zones.Count(); i++)
11429 {
11430 SetHealth01(zones.Get(i),"Health",global_health);
11431 }
11432 }
11433
11436 {
11437 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11438 }
11439
11441 {
11442 if (!hasRootAsPlayer)
11443 {
11444 if (refParentIB)
11445 {
11446
11447 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11448 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11449
11450 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11451 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11452
11455 }
11456 else
11457 {
11458
11461 }
11462 }
11463 }
11464
11466 {
11468 {
11469 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11470 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11471 {
11472 float heatPermCoef = 1.0;
11474 while (ent)
11475 {
11476 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11477 ent = ent.GetHierarchyParent();
11478 }
11479
11480 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11481 }
11482 }
11483 }
11484
11486 {
11487
11488 EntityAI parent = GetHierarchyParent();
11489 if (!parent)
11490 {
11491 hasParent = false;
11492 hasRootAsPlayer = false;
11493 }
11494 else
11495 {
11496 hasParent = true;
11497 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11498 refParentIB =
ItemBase.Cast(parent);
11499 }
11500 }
11501
11502 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11503 {
11504
11505 }
11506
11508 {
11509
11510 return false;
11511 }
11512
11514 {
11515
11516
11517 return false;
11518 }
11519
11521 {
11522
11523 return false;
11524 }
11525
11528 {
11529 return !GetIsFrozen() &&
IsOpen();
11530 }
11531
11533 {
11534 bool hasParent = false, hasRootAsPlayer = false;
11536
11537 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11538 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11539
11540 if (wwtu || foodDecay)
11541 {
11545
11546 if (processWetness || processTemperature || processDecay)
11547 {
11549
11550 if (processWetness)
11551 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11552
11553 if (processTemperature)
11555
11556 if (processDecay)
11557 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11558 }
11559 }
11560 }
11561
11564 {
11566 }
11567
11569 {
11572
11573 return super.GetTemperatureFreezeThreshold();
11574 }
11575
11577 {
11580
11581 return super.GetTemperatureThawThreshold();
11582 }
11583
11585 {
11588
11589 return super.GetItemOverheatThreshold();
11590 }
11591
11593 {
11595 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11596
11597 return super.GetTemperatureFreezeTime();
11598 }
11599
11601 {
11603 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11604
11605 return super.GetTemperatureThawTime();
11606 }
11607
11612
11614 {
11615 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11616 }
11617
11619 {
11620 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11621 }
11622
11625 {
11627 }
11628
11630 {
11632 }
11633
11635 {
11637 }
11638
11641 {
11642 return null;
11643 }
11644
11647 {
11648 return false;
11649 }
11650
11652 {
11654 {
11657 if (!trg)
11658 {
11660 explosive = this;
11661 }
11662
11663 explosive.PairRemote(trg);
11665
11666 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11667 trg.SetPersistentPairID(persistentID);
11668 explosive.SetPersistentPairID(persistentID);
11669
11670 return true;
11671 }
11672 return false;
11673 }
11674
11677 {
11678 float ret = 1.0;
11681 ret *= GetHealth01();
11682
11683 return ret;
11684 }
11685
11686 #ifdef DEVELOPER
11687 override void SetDebugItem()
11688 {
11689 super.SetDebugItem();
11690 _itemBase = this;
11691 }
11692
11694 {
11695 string text = super.GetDebugText();
11696
11698 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11699
11700 return text;
11701 }
11702 #endif
11703
11705 {
11706 return true;
11707 }
11708
11710
11712
11714 {
11717 }
11718
11719
11727
11743
11744 [
Obsolete(
"Use ItemSoundHandler instead")]
11747 {
11748 if (!
g_Game.IsDedicatedServer())
11749 {
11750 if (ConfigIsExisting("attachSoundSet"))
11751 {
11752 string cfg_path = "";
11753 string soundset = "";
11754 string type_name =
GetType();
11755
11758 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11759 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11760
11761 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11762 {
11763 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11764 {
11765 if (cfg_slot_array[i] == slot_type)
11766 {
11767 soundset = cfg_soundset_array[i];
11768 break;
11769 }
11770 }
11771 }
11772
11773 if (soundset != "")
11774 {
11775 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11777 }
11778 }
11779 }
11780 }
11781
11783}
11784
11786{
11788 if (entity)
11789 {
11790 bool is_item = entity.IsInherited(
ItemBase);
11791 if (is_item && full_quantity)
11792 {
11795 }
11796 }
11797 else
11798 {
11800 return NULL;
11801 }
11802 return entity;
11803}
11804
11806{
11807 if (item)
11808 {
11809 if (health > 0)
11810 item.SetHealth("", "", health);
11811
11812 if (item.CanHaveTemperature())
11813 {
11815 if (item.CanFreeze())
11816 item.SetFrozen(false);
11817 }
11818
11819 if (item.HasEnergyManager())
11820 {
11821 if (quantity >= 0)
11822 {
11823 item.GetCompEM().SetEnergy0To1(quantity);
11824 }
11825 else
11826 {
11828 }
11829 }
11830 else if (item.IsMagazine())
11831 {
11832 Magazine mag = Magazine.Cast(item);
11833 if (quantity >= 0)
11834 {
11835 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11836 }
11837 else
11838 {
11840 }
11841
11842 }
11843 else
11844 {
11845 if (quantity >= 0)
11846 {
11847 item.SetQuantityNormalized(quantity, false);
11848 }
11849 else
11850 {
11852 }
11853
11854 }
11855 }
11856}
11857
11858#ifdef DEVELOPER
11860#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.