6828{
6830 {
6831 return true;
6832 }
6833};
6834
6836{
6837
6838};
6839
6840
6841
6843{
6847
6849
6852
6853
6854
6855
6856
6865
6871
6876
6881
6902 protected bool m_IsResultOfSplit
6903
6905
6910
6911
6912
6914
6918
6919
6920
6922
6925
6926
6927
6933
6934
6942
6945
6946
6948
6949
6951
6952
6957
6958
6963
6965
6966
6968
6969
6971 {
6976
6977 if (!
g_Game.IsDedicatedServer())
6978 {
6980 {
6982
6984 {
6986 }
6987 }
6988
6991 }
6992
6993 m_OldLocation = null;
6994
6996 {
6998 }
6999
7000 if (ConfigIsExisting("headSelectionsToHide"))
7001 {
7004 }
7005
7007 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7008 {
7010 }
7011
7013
7014 m_IsResultOfSplit = false;
7015
7017 }
7018
7020 {
7021 super.InitItemVariables();
7022
7028 m_Count = ConfigGetInt(
"count");
7029
7032
7037
7040
7045
7057
7061
7062
7065 if (ConfigIsExisting("canBeSplit"))
7066 {
7069 }
7070
7072 if (ConfigIsExisting("itemBehaviour"))
7074
7075
7078 RegisterNetSyncVariableInt("m_VarLiquidType");
7079 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7080
7081 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7082 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7083 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7084
7085 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7086 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7087 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7088 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7089
7090 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7091 RegisterNetSyncVariableBool("m_IsTakeable");
7092 RegisterNetSyncVariableBool("m_IsHologram");
7093
7096 {
7099 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7100 }
7101
7103
7105 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7107
7109 }
7110
7112 {
7114 }
7115
7117 {
7120 {
7125 }
7126 }
7127
7128 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7129 {
7131 {
7134 }
7135
7137 }
7138
7140 {
7146 }
7147
7149
7151 {
7153
7154 if (!action)
7155 {
7156 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7157 return;
7158 }
7159
7161 if (!ai)
7162 {
7164 return;
7165 }
7166
7168 if (!action_array)
7169 {
7170 action_array = new array<ActionBase_Basic>;
7172 }
7173 if (LogManager.IsActionLogEnable())
7174 {
7175 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7176 }
7177
7178 if (action_array.Find(action) != -1)
7179 {
7180 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7181 }
7182 else
7183 {
7184 action_array.Insert(action);
7185 }
7186 }
7187
7189 {
7190 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7191 ActionBase action = player.GetActionManager().GetAction(actionName);
7194
7195 if (action_array)
7196 {
7197 action_array.RemoveItem(action);
7198 }
7199 }
7200
7201
7202
7204 {
7205 ActionOverrideData overrideData = new ActionOverrideData();
7209
7211 if (!actionMap)
7212 {
7215 }
7216
7217 actionMap.Insert(this.
Type(), overrideData);
7218
7219 }
7220
7222
7224
7225
7227 {
7230
7233
7234 string config_to_search = "CfgVehicles";
7235 string muzzle_owner_config;
7236
7238 {
7239 if (IsInherited(Weapon))
7240 config_to_search = "CfgWeapons";
7241
7242 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7243
7244 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7245
7246 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7247
7248 if (config_OnFire_subclass_count > 0)
7249 {
7250 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7251
7252 for (int i = 0; i < config_OnFire_subclass_count; i++)
7253 {
7254 string particle_class = "";
7255 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7256 string config_OnFire_entry = config_OnFire_class + particle_class;
7257 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7258 WPOF_array.Insert(WPOF);
7259 }
7260
7261
7263 }
7264 }
7265
7267 {
7268 config_to_search = "CfgWeapons";
7269 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7270
7271 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7272
7273 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7274
7275 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7276 {
7277 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7278
7279 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7280 {
7281 string particle_class2 = "";
7282 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7283 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7284 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7285 WPOBE_array.Insert(WPOBE);
7286 }
7287
7288
7290 }
7291 }
7292 }
7293
7294
7296 {
7299
7301 {
7302 string config_to_search = "CfgVehicles";
7303
7304 if (IsInherited(Weapon))
7305 config_to_search = "CfgWeapons";
7306
7307 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7308 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7309
7310 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7311 {
7312
7314
7316 {
7318 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7320 return;
7321 }
7322
7325
7326
7327
7328 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7329 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7330
7331 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7332 {
7333 string particle_class = "";
7334 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7335 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7336 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7337
7338 if (entry_type == CT_CLASS)
7339 {
7340 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7341 WPOOH_array.Insert(WPOF);
7342 }
7343 }
7344
7345
7347 }
7348 }
7349 }
7350
7352 {
7354 }
7355
7357 {
7359 {
7361
7364
7367
7368 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7369 }
7370 }
7371
7373 {
7375 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7376
7378 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7379
7381 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7382
7384 {
7386 }
7387 }
7388
7390 {
7392 }
7393
7395 {
7398 else
7400
7402 {
7405 }
7406 else
7407 {
7410
7413 }
7414
7416 }
7417
7419 {
7421 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7422 }
7423
7425 {
7427 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7429 }
7430
7432 {
7434 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7435 }
7436
7438 {
7441
7442 OverheatingParticle OP = new OverheatingParticle();
7447
7449 }
7450
7452 {
7455
7456 return -1;
7457 }
7458
7460 {
7462 {
7465
7466 for (int i = count; i > 0; --i)
7467 {
7468 int id = i - 1;
7471
7474
7475 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7476 {
7477 if (p)
7478 {
7481 }
7482 }
7483 }
7484 }
7485 }
7486
7488 {
7490 {
7492 {
7493 int id = i - 1;
7495
7496 if (OP)
7497 {
7499
7500 if (p)
7501 {
7503 }
7504
7505 delete OP;
7506 }
7507 }
7508
7511 }
7512 }
7513
7516 {
7517 return 0.0;
7518 }
7519
7520
7522 {
7523 return 250;
7524 }
7525
7527 {
7528 return 0;
7529 }
7530
7533 {
7535 return true;
7536
7537 return false;
7538 }
7539
7542 {
7545
7547 {
7549 }
7550 else
7551 {
7552
7554 }
7555
7557 }
7558
7565 {
7566 return -1;
7567 }
7568
7569
7570
7571
7573 {
7575 {
7576 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7577 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7578
7579 if (r_index >= 0)
7580 {
7581 InventoryLocation r_il = new InventoryLocation;
7582 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7583
7584 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7587 {
7588 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7589 }
7591 {
7592 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7593 }
7594
7595 }
7596
7597 player.GetHumanInventory().ClearUserReservedLocation(this);
7598 }
7599
7602 }
7603
7604
7605
7606
7608 {
7609 return ItemBase.m_DebugActionsMask;
7610 }
7611
7613 {
7614 return ItemBase.m_DebugActionsMask & mask;
7615 }
7616
7618 {
7619 ItemBase.m_DebugActionsMask = mask;
7620 }
7621
7623 {
7624 ItemBase.m_DebugActionsMask |= mask;
7625 }
7626
7628 {
7629 ItemBase.m_DebugActionsMask &= ~mask;
7630 }
7631
7633 {
7635 {
7637 }
7638 else
7639 {
7641 }
7642 }
7643
7644
7646 {
7647 if (GetEconomyProfile())
7648 {
7649 float q_max = GetEconomyProfile().GetQuantityMax();
7650 if (q_max > 0)
7651 {
7652 float q_min = GetEconomyProfile().GetQuantityMin();
7653 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7654
7656 {
7657 ComponentEnergyManager comp = GetCompEM();
7659 {
7661 }
7662 }
7664 {
7666
7667 }
7668
7669 }
7670 }
7671 }
7672
7675 {
7676 EntityAI parent = GetHierarchyParent();
7677
7678 if (parent)
7679 {
7680 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7681 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7682 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7683 }
7684 }
7685
7688 {
7689 EntityAI parent = GetHierarchyParent();
7690
7691 if (parent)
7692 {
7693 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7694 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7695 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7696 }
7697 }
7698
7700 {
7701
7702
7703
7704
7706
7708 {
7709 if (ScriptInputUserData.CanStoreInputUserData())
7710 {
7711 ScriptInputUserData ctx = new ScriptInputUserData;
7717 ctx.
Write(use_stack_max);
7720
7722 {
7723 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7724 }
7725 }
7726 }
7727 else if (!
g_Game.IsMultiplayer())
7728 {
7730 }
7731 }
7732
7734 {
7736 }
7737
7739 {
7741 }
7742
7744 {
7746 }
7747
7749 {
7750
7751 return false;
7752 }
7753
7755 {
7756 return false;
7757 }
7758
7762 {
7763 return false;
7764 }
7765
7767 {
7768 return "";
7769 }
7770
7772
7774 {
7775 return false;
7776 }
7777
7779 {
7780 return true;
7781 }
7782
7783
7784
7786 {
7787 return true;
7788 }
7789
7791 {
7792 return true;
7793 }
7794
7796 {
7797 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7799 }
7800
7802 {
7804 }
7805
7807 {
7809 if (!is_being_placed)
7811 SetSynchDirty();
7812 }
7813
7814
7816
7818 {
7820 }
7821
7823 {
7825 }
7826
7828 {
7829 return 1;
7830 }
7831
7833 {
7834 return false;
7835 }
7836
7838 {
7840 SetSynchDirty();
7841 }
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7878 {
7879 super.OnMovedInsideCargo(container);
7880
7881 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7882 }
7883
7884 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7885 {
7886 super.EEItemLocationChanged(oldLoc, newLoc);
7887
7888 PlayerBase newPlayer = null;
7889 PlayerBase oldPlayer = null;
7890
7891 if (newLoc.GetParent())
7892 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7893
7894 if (oldLoc.GetParent())
7895 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7896
7898 {
7899 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7900
7901 if (rIndex >= 0)
7902 {
7903 InventoryLocation rIl = new InventoryLocation;
7904 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7905
7906 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7909 {
7910 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7911 }
7913 {
7915 }
7916
7917 }
7918 }
7919
7921 {
7922 if (newPlayer)
7923 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7924
7925 if (newPlayer == oldPlayer)
7926 {
7927 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7928 {
7930 {
7931 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7932 {
7933 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7934 }
7935 }
7936 else
7937 {
7938 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7939 }
7940 }
7941
7942 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7943 {
7944 int type = oldLoc.GetType();
7946 {
7947 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7948 }
7950 {
7951 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7952 }
7953 }
7954 if (!m_OldLocation)
7955 {
7956 m_OldLocation = new InventoryLocation;
7957 }
7958 m_OldLocation.Copy(oldLoc);
7959 }
7960 else
7961 {
7962 if (m_OldLocation)
7963 {
7964 m_OldLocation.Reset();
7965 }
7966 }
7967
7968 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7969 }
7970 else
7971 {
7972 if (newPlayer)
7973 {
7974 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7975 if (resIndex >= 0)
7976 {
7977 InventoryLocation il = new InventoryLocation;
7978 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7980 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7983 {
7984 il.
GetParent().GetOnReleaseLock().Invoke(it);
7985 }
7987 {
7989 }
7990
7991 }
7992 }
7994 {
7995
7997 }
7998
7999 if (m_OldLocation)
8000 {
8001 m_OldLocation.Reset();
8002 }
8003 }
8004
8006 {
8007 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8008 }
8009
8011 {
8012 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8013 }
8014 }
8015
8016 override void EOnContact(IEntity other, Contact extra)
8017 {
8019 {
8020 int liquidType = -1;
8022 if (impactSpeed > 0.0)
8023 {
8025 #ifndef SERVER
8027 #else
8029 SetSynchDirty();
8030 #endif
8032 }
8033 }
8034
8035 #ifdef SERVER
8036 if (GetCompEM() && GetCompEM().IsPlugged())
8037 {
8038 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8039 GetCompEM().UnplugThis();
8040 }
8041 #endif
8042 }
8043
8045
8047 {
8049 }
8050
8052 {
8053
8054 }
8055
8057 {
8058 super.OnItemLocationChanged(old_owner, new_owner);
8059
8060 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8061 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8062
8063 if (!relatedPlayer && playerNew)
8064 relatedPlayer = playerNew;
8065
8066 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8067 {
8069 if (actionMgr)
8070 {
8071 ActionBase currentAction = actionMgr.GetRunningAction();
8072 if (currentAction)
8074 }
8075 }
8076
8077 Man ownerPlayerOld = null;
8078 Man ownerPlayerNew = null;
8079
8080 if (old_owner)
8081 {
8082 if (old_owner.
IsMan())
8083 {
8084 ownerPlayerOld = Man.Cast(old_owner);
8085 }
8086 else
8087 {
8088 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8089 }
8090 }
8091 else
8092 {
8094 {
8096
8097 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8098 {
8099 GetCompEM().UnplugThis();
8100 }
8101 }
8102 }
8103
8104 if (new_owner)
8105 {
8106 if (new_owner.
IsMan())
8107 {
8108 ownerPlayerNew = Man.Cast(new_owner);
8109 }
8110 else
8111 {
8112 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8113 }
8114 }
8115
8116 if (ownerPlayerOld != ownerPlayerNew)
8117 {
8118 if (ownerPlayerOld)
8119 {
8120 array<EntityAI> subItemsExit = new array<EntityAI>;
8122 for (int i = 0; i < subItemsExit.Count(); i++)
8123 {
8126 }
8127 }
8128
8129 if (ownerPlayerNew)
8130 {
8131 array<EntityAI> subItemsEnter = new array<EntityAI>;
8133 for (int j = 0; j < subItemsEnter.Count(); j++)
8134 {
8137 }
8138 }
8139 }
8140 else if (ownerPlayerNew != null)
8141 {
8142 PlayerBase nplayer;
8143 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8144 {
8145 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8147 for (int k = 0; k < subItemsUpdate.Count(); k++)
8148 {
8150 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8151 }
8152 }
8153 }
8154
8155 if (old_owner)
8156 old_owner.OnChildItemRemoved(this);
8157 if (new_owner)
8158 new_owner.OnChildItemReceived(this);
8159 }
8160
8161
8163 {
8164 super.EEDelete(parent);
8165 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8166 if (player)
8167 {
8169
8170 if (player.IsAlive())
8171 {
8172 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8173 if (r_index >= 0)
8174 {
8175 InventoryLocation r_il = new InventoryLocation;
8176 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8177
8178 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8181 {
8182 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8183 }
8185 {
8186 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8187 }
8188
8189 }
8190
8191 player.RemoveQuickBarEntityShortcut(this);
8192 }
8193 }
8194 }
8195
8197 {
8198 super.EEKilled(killer);
8199
8202 {
8203 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8204 {
8205 if (IsMagazine())
8206 {
8207 if (Magazine.Cast(this).GetAmmoCount() > 0)
8208 {
8210 }
8211 }
8212 else
8213 {
8215 }
8216 }
8217 }
8218 }
8219
8221 {
8222 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8223
8224 super.OnWasAttached(parent, slot_id);
8225
8228
8231 }
8232
8234 {
8235 super.OnWasDetached(parent, slot_id);
8236
8239
8242 }
8243
8245 {
8246 int idx;
8249
8250 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8251 if (inventory_slots.Count() < 1)
8252 {
8253 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8254 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8255 }
8256 else
8257 {
8258 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8259 }
8260
8261 idx = inventory_slots.Find(slot);
8262 if (idx < 0)
8263 return "";
8264
8265 return attach_types.Get(idx);
8266 }
8267
8269 {
8270 int idx = -1;
8271 string slot;
8272
8275
8276 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8277 if (inventory_slots.Count() < 1)
8278 {
8279 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8280 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8281 }
8282 else
8283 {
8284 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8285 if (detach_types.Count() < 1)
8286 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8287 }
8288
8289 for (int i = 0; i < inventory_slots.Count(); i++)
8290 {
8291 slot = inventory_slots.Get(i);
8292 }
8293
8294 if (slot != "")
8295 {
8296 if (detach_types.Count() == 1)
8297 idx = 0;
8298 else
8299 idx = inventory_slots.Find(slot);
8300 }
8301 if (idx < 0)
8302 return "";
8303
8304 return detach_types.Get(idx);
8305 }
8306
8308 {
8309
8311
8312
8313 float min_time = 1;
8314 float max_time = 3;
8315 float delay = Math.RandomFloat(min_time, max_time);
8316
8317 explode_timer.Run(delay, this, "DoAmmoExplosion");
8318 }
8319
8321 {
8322 Magazine magazine = Magazine.Cast(this);
8323 int pop_sounds_count = 6;
8324 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8325
8326
8327 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8328 string sound_name = pop_sounds[ sound_idx ];
8329 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8330
8331
8332 magazine.ServerAddAmmoCount(-1);
8333
8334
8335 float min_temp_to_explode = 100;
8336
8337 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8338 {
8340 }
8341 }
8342
8343
8344 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8345 {
8346 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8347
8348 const int CHANCE_DAMAGE_CARGO = 4;
8349 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8350 const int CHANCE_DAMAGE_NOTHING = 2;
8351
8353 {
8354 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8355 int chances;
8356 int rnd;
8357
8358 if (GetInventory().GetCargo())
8359 {
8360 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8361 rnd = Math.RandomInt(0,chances);
8362
8363 if (rnd < CHANCE_DAMAGE_CARGO)
8364 {
8366 }
8367 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8368 {
8370 }
8371 }
8372 else
8373 {
8374 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8375 rnd = Math.RandomInt(0,chances);
8376
8377 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8378 {
8380 }
8381 }
8382 }
8383 }
8384
8386 {
8387 CargoBase cargo = GetInventory().GetCargo();
8388 if (cargo)
8389 {
8391 if (item_count > 0)
8392 {
8393 int random_pick = Math.RandomInt(0, item_count);
8395 if (!item.IsExplosive())
8396 {
8397 item.AddHealth("","",damage);
8398 return true;
8399 }
8400 }
8401 }
8402 return false;
8403 }
8404
8406 {
8407 GameInventory inventory = GetInventory();
8409 if (attachment_count > 0)
8410 {
8411 int random_pick = Math.RandomInt(0, attachment_count);
8413 if (!attachment.IsExplosive())
8414 {
8415 attachment.AddHealth("","",damage);
8416 return true;
8417 }
8418 }
8419 return false;
8420 }
8421
8423 {
8425 }
8426
8428 {
8430 return GetInventory().CanRemoveEntity();
8431
8432 return false;
8433 }
8434
8436 {
8437
8439 return false;
8440
8441
8443 return false;
8444
8445
8446
8448 if (delta == 0)
8449 return false;
8450
8451
8452 return true;
8453 }
8454
8456 {
8458 {
8459 if (ScriptInputUserData.CanStoreInputUserData())
8460 {
8461 ScriptInputUserData ctx = new ScriptInputUserData;
8466 ctx.
Write(destination_entity);
8470 }
8471 }
8472 else if (!
g_Game.IsMultiplayer())
8473 {
8475 }
8476 }
8477
8479 {
8480 float split_quantity_new;
8484 InventoryLocation loc = new InventoryLocation;
8485
8486 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8487 {
8489 split_quantity_new = stack_max;
8490 else
8492
8494 {
8495 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8496 if (new_item)
8497 {
8498 new_item.SetResultOfSplit(true);
8499 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8501 new_item.
SetQuantity(split_quantity_new,
false,
true);
8502 }
8503 }
8504 }
8505 else if (destination_entity && slot_id == -1)
8506 {
8507 if (quantity > stack_max)
8508 split_quantity_new = stack_max;
8509 else
8510 split_quantity_new = quantity;
8511
8513 {
8514 GameInventory destinationInventory = destination_entity.GetInventory();
8516 {
8519 }
8520
8521 if (new_item)
8522 {
8523 new_item.SetResultOfSplit(true);
8524 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8526 new_item.
SetQuantity(split_quantity_new,
false,
true);
8527 }
8528 }
8529 }
8530 else
8531 {
8532 if (stack_max != 0)
8533 {
8535 {
8537 }
8538
8539 if (split_quantity_new == 0)
8540 {
8541 if (!
g_Game.IsMultiplayer())
8542 player.PhysicalPredictiveDropItem(this);
8543 else
8544 player.ServerDropEntity(this);
8545 return;
8546 }
8547
8549 {
8551
8552 if (new_item)
8553 {
8554 new_item.SetResultOfSplit(true);
8555 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8558 new_item.PlaceOnSurface();
8559 }
8560 }
8561 }
8562 }
8563 }
8564
8566 {
8567 float split_quantity_new;
8571 InventoryLocation loc = new InventoryLocation;
8572
8573 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8574 {
8576 split_quantity_new = stack_max;
8577 else
8579
8581 {
8582 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8583 if (new_item)
8584 {
8585 new_item.SetResultOfSplit(true);
8586 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8588 new_item.
SetQuantity(split_quantity_new,
false,
true);
8589 }
8590 }
8591 }
8592 else if (destination_entity && slot_id == -1)
8593 {
8594 if (quantity > stack_max)
8595 split_quantity_new = stack_max;
8596 else
8597 split_quantity_new = quantity;
8598
8600 {
8601 GameInventory destinationInventory = destination_entity.GetInventory();
8603 {
8606 }
8607
8608 if (new_item)
8609 {
8610 new_item.SetResultOfSplit(true);
8611 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8613 new_item.
SetQuantity(split_quantity_new,
false,
true);
8614 }
8615 }
8616 }
8617 else
8618 {
8619 if (stack_max != 0)
8620 {
8622 {
8624 }
8625
8627 {
8629
8630 if (new_item)
8631 {
8632 new_item.SetResultOfSplit(true);
8633 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8636 new_item.PlaceOnSurface();
8637 }
8638 }
8639 }
8640 }
8641 }
8642
8644 {
8646 {
8647 if (ScriptInputUserData.CanStoreInputUserData())
8648 {
8649 ScriptInputUserData ctx = new ScriptInputUserData;
8654 dst.WriteToContext(ctx);
8656 }
8657 }
8658 else if (!
g_Game.IsMultiplayer())
8659 {
8661 }
8662 }
8663
8665 {
8667 {
8668 if (ScriptInputUserData.CanStoreInputUserData())
8669 {
8670 ScriptInputUserData ctx = new ScriptInputUserData;
8675 ctx.
Write(destination_entity);
8681 }
8682 }
8683 else if (!
g_Game.IsMultiplayer())
8684 {
8686 }
8687 }
8688
8690 {
8692 }
8693
8695 {
8697 float split_quantity_new;
8699 if (dst.IsValid())
8700 {
8701 int slot_id = dst.GetSlot();
8703
8704 if (quantity > stack_max)
8705 split_quantity_new = stack_max;
8706 else
8707 split_quantity_new = quantity;
8708
8710 {
8712
8713 if (new_item)
8714 {
8715 new_item.SetResultOfSplit(true);
8716 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8718 new_item.
SetQuantity(split_quantity_new,
false,
true);
8719 }
8720
8721 return new_item;
8722 }
8723 }
8724
8725 return null;
8726 }
8727
8729 {
8731 float split_quantity_new;
8733 if (destination_entity)
8734 {
8736 if (quantity > stackable)
8737 split_quantity_new = stackable;
8738 else
8739 split_quantity_new = quantity;
8740
8742 {
8743 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8744 if (new_item)
8745 {
8746 new_item.SetResultOfSplit(true);
8747 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8749 new_item.
SetQuantity(split_quantity_new,
false,
true);
8750 }
8751 }
8752 }
8753 }
8754
8756 {
8758 {
8759 if (ScriptInputUserData.CanStoreInputUserData())
8760 {
8761 ScriptInputUserData ctx = new ScriptInputUserData;
8766 ItemBase destination_entity =
this;
8767 ctx.
Write(destination_entity);
8771 }
8772 }
8773 else if (!
g_Game.IsMultiplayer())
8774 {
8776 }
8777 }
8778
8780 {
8782 float split_quantity_new;
8784 if (player)
8785 {
8787 if (quantity > stackable)
8788 split_quantity_new = stackable;
8789 else
8790 split_quantity_new = quantity;
8791
8793 {
8794 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8795 new_item =
ItemBase.Cast(in_hands);
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 float split_quantity_new = Math.Floor(quantity * 0.5);
8811
8813 return;
8814
8816
8817 if (new_item)
8818 {
8819 if (new_item.GetQuantityMax() < split_quantity_new)
8820 {
8821 split_quantity_new = new_item.GetQuantityMax();
8822 }
8823
8824 new_item.SetResultOfSplit(true);
8825 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8826
8828 {
8831 }
8832 else
8833 {
8835 new_item.
SetQuantity(split_quantity_new,
false,
true);
8836 }
8837 }
8838 }
8839
8841 {
8843 float split_quantity_new = Math.Floor(quantity / 2);
8844
8846 return;
8847
8848 InventoryLocation invloc = new InventoryLocation;
8850
8852 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8853
8854 if (new_item)
8855 {
8856 if (new_item.GetQuantityMax() < split_quantity_new)
8857 {
8858 split_quantity_new = new_item.GetQuantityMax();
8859 }
8861 {
8864 }
8865 else if (split_quantity_new > 1)
8866 {
8868 new_item.
SetQuantity(split_quantity_new,
false,
true);
8869 }
8870 }
8871 }
8872
8875 {
8876 SetWeightDirty();
8878
8879 if (parent)
8880 parent.OnAttachmentQuantityChangedEx(this, delta);
8881
8883 {
8885 {
8887 }
8889 {
8890 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8892 }
8893 }
8894 }
8895
8898 {
8899
8900 }
8901
8904 {
8906 }
8907
8909 {
8910 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8911
8913 {
8914 if (newLevel == GameConstants.STATE_RUINED)
8915 {
8917 EntityAI parent = GetHierarchyParent();
8918 if (parent && parent.IsFireplace())
8919 {
8920 CargoBase cargo = GetInventory().GetCargo();
8921 if (cargo)
8922 {
8924 {
8926 }
8927 }
8928 }
8929 }
8930
8932 {
8933
8935 return;
8936 }
8937
8938 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8939 {
8941 }
8942 }
8943 }
8944
8945
8947 {
8948 super.OnRightClick();
8949
8951 {
8953 {
8954 if (ScriptInputUserData.CanStoreInputUserData())
8955 {
8956 EntityAI root = GetHierarchyRoot();
8957 Man playerOwner = GetHierarchyRootPlayer();
8958 InventoryLocation dst = new InventoryLocation;
8959
8960
8961 if (!playerOwner && root && root == this)
8962 {
8964 }
8965 else
8966 {
8967
8968 GetInventory().GetCurrentInventoryLocation(dst);
8970 {
8971 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8973 {
8975 }
8976 else
8977 {
8979
8980
8981 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8982 {
8984 }
8985 else
8986 {
8987 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8988 }
8989 }
8990 }
8991 }
8992
8993 ScriptInputUserData ctx = new ScriptInputUserData;
9001 }
9002 }
9003 else if (!
g_Game.IsMultiplayer())
9004 {
9006 }
9007 }
9008 }
9009
9011 {
9012 if (root)
9013 {
9014 vector m4[4];
9015 root.GetTransform(m4);
9016 dst.SetGround(this, m4);
9017 }
9018 else
9019 {
9020 GetInventory().GetCurrentInventoryLocation(dst);
9021 }
9022 }
9023
9024 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9025 {
9026
9027 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9028 return false;
9029
9030 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9031 return false;
9032
9033
9035 return false;
9036
9037
9038 Magazine mag = Magazine.Cast(this);
9039 if (mag)
9040 {
9041 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9042 return false;
9043
9044 if (stack_max_limit)
9045 {
9046 Magazine other_mag = Magazine.Cast(other_item);
9047 if (other_item)
9048 {
9049 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9050 return false;
9051 }
9052
9053 }
9054 }
9055 else
9056 {
9057
9059 return false;
9060
9062 return false;
9063 }
9064
9065 PlayerBase player = null;
9066 if (CastTo(player, GetHierarchyRootPlayer()))
9067 {
9068 if (player.GetInventory().HasAttachment(this))
9069 return false;
9070
9071 if (player.IsItemsToDelete())
9072 return false;
9073 }
9074
9075 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9076 return false;
9077
9078 int slotID;
9080 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9081 return false;
9082
9083 return true;
9084 }
9085
9087 {
9089 }
9090
9092 {
9093 return m_IsResultOfSplit;
9094 }
9095
9097 {
9098 m_IsResultOfSplit = value;
9099 }
9100
9102 {
9104 }
9105
9107 {
9108 float other_item_quantity = other_item.GetQuantity();
9109 float this_free_space;
9110
9112
9114
9115 if (other_item_quantity > this_free_space)
9116 {
9117 return this_free_space;
9118 }
9119 else
9120 {
9121 return other_item_quantity;
9122 }
9123 }
9124
9126 {
9128 }
9129
9131 {
9133 return;
9134
9135 if (!IsMagazine() && other_item)
9136 {
9138 if (quantity_used != 0)
9139 {
9140 float hp1 = GetHealth01("","");
9141 float hp2 = other_item.GetHealth01("","");
9142 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9143 hpResult = hpResult / (
GetQuantity() + quantity_used);
9144
9145 hpResult *= GetMaxHealth();
9146 Math.Round(hpResult);
9147 SetHealth("", "Health", hpResult);
9148
9150 other_item.AddQuantity(-quantity_used);
9151 }
9152 }
9154 }
9155
9157 {
9158 #ifdef SERVER
9159 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9160 GetHierarchyParent().IncreaseLifetimeUp();
9161 #endif
9162 };
9163
9165 {
9166 PlayerBase p = PlayerBase.Cast(player);
9167
9168 array<int> recipesIds = p.m_Recipes;
9169 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9170 if (moduleRecipesManager)
9171 {
9172 EntityAI itemInHands = player.GetEntityInHands();
9173 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9174 }
9175
9176 for (int i = 0;i < recipesIds.Count(); i++)
9177 {
9178 int key = recipesIds.Get(i);
9179 string recipeName = moduleRecipesManager.GetRecipeName(key);
9181 }
9182 }
9183
9184
9185 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9186 {
9187 super.GetDebugActions(outputList);
9188
9189
9195
9196
9201
9206
9207
9211
9212
9214 {
9218 }
9219
9222
9223
9227
9229
9230 InventoryLocation loc = new InventoryLocation();
9231 GetInventory().GetCurrentInventoryLocation(loc);
9233 {
9234 if (Gizmo_IsSupported())
9237 }
9238
9240 }
9241
9242
9243
9244
9246 {
9247 super.OnAction(action_id, player, ctx);
9248
9250 {
9251 switch (action_id)
9252 {
9256 return true;
9260 return true;
9261 }
9262 }
9263
9265 {
9266 switch (action_id)
9267 {
9269 Delete();
9270 return true;
9271 }
9272 }
9273
9274 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9275 {
9276 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9277 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9278 PlayerBase p = PlayerBase.Cast(player);
9279 if (
EActions.RECIPES_RANGE_START < 1000)
9280 {
9281 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9282 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9283 }
9284 }
9285 #ifndef SERVER
9286 else if (action_id ==
EActions.WATCH_PLAYER)
9287 {
9288 PluginDeveloper.SetDeveloperItemClientEx(player);
9289 }
9290 #endif
9292 {
9293 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9294 {
9295 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9296 OnDebugButtonPressServer(id + 1);
9297 }
9298
9299 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9300 {
9301 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9303 }
9304
9305 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9306 {
9307 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9309 }
9310
9311 else if (action_id ==
EActions.ADD_QUANTITY)
9312 {
9313 if (IsMagazine())
9314 {
9315 Magazine mag = Magazine.Cast(this);
9316 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9317 }
9318 else
9319 {
9321 }
9322
9323 if (m_EM)
9324 {
9325 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9326 }
9327
9328 }
9329
9330 else if (action_id ==
EActions.REMOVE_QUANTITY)
9331 {
9332 if (IsMagazine())
9333 {
9334 Magazine mag2 = Magazine.Cast(this);
9335 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9336 }
9337 else
9338 {
9340 }
9341 if (m_EM)
9342 {
9343 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9344 }
9345
9346 }
9347
9348 else if (action_id ==
EActions.SET_QUANTITY_0)
9349 {
9351
9352 if (m_EM)
9353 {
9354 m_EM.SetEnergy(0);
9355 }
9356 }
9357
9358 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9359 {
9361
9362 if (m_EM)
9363 {
9364 m_EM.SetEnergy(m_EM.GetEnergyMax());
9365 }
9366 }
9367
9368 else if (action_id ==
EActions.ADD_HEALTH)
9369 {
9370 AddHealth("","",GetMaxHealth("","Health")/5);
9371 }
9372 else if (action_id ==
EActions.REMOVE_HEALTH)
9373 {
9374 AddHealth("","",-GetMaxHealth("","Health")/5);
9375 }
9376 else if (action_id ==
EActions.DESTROY_HEALTH)
9377 {
9378 SetHealth01("","",0);
9379 }
9380 else if (action_id ==
EActions.WATCH_ITEM)
9381 {
9383 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9384 #ifdef DEVELOPER
9385 SetDebugDeveloper_item(this);
9386 #endif
9387 }
9388
9389 else if (action_id ==
EActions.ADD_TEMPERATURE)
9390 {
9391 AddTemperature(20);
9392
9393 }
9394
9395 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9396 {
9397 AddTemperature(-20);
9398
9399 }
9400
9401 else if (action_id ==
EActions.FLIP_FROZEN)
9402 {
9403 SetFrozen(!GetIsFrozen());
9404
9405 }
9406
9407 else if (action_id ==
EActions.ADD_WETNESS)
9408 {
9410
9411 }
9412
9413 else if (action_id ==
EActions.REMOVE_WETNESS)
9414 {
9416
9417 }
9418
9419 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9420 {
9423
9424
9425 }
9426
9427 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9428 {
9431 }
9432
9433 else if (action_id ==
EActions.MAKE_SPECIAL)
9434 {
9435 auto debugParams = DebugSpawnParams.WithPlayer(player);
9436 OnDebugSpawnEx(debugParams);
9437 }
9438
9439 }
9440
9441
9442 return false;
9443 }
9444
9445
9446
9447
9451
9454
9455
9456
9458 {
9459 return false;
9460 }
9461
9462
9464 {
9465 return true;
9466 }
9467
9468
9470 {
9471 return true;
9472 }
9473
9474
9475
9477 {
9478 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9479 return g_Game.ConfigIsExisting(config_path);
9480 }
9481
9484 {
9485 return null;
9486 }
9487
9489 {
9490 return false;
9491 }
9492
9494 {
9495 return false;
9496 }
9497
9501
9502
9504 {
9505 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9506 return module_repairing.CanRepair(this, item_repair_kit);
9507 }
9508
9509
9510 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9511 {
9512 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9513 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9514 }
9515
9516
9518 {
9519
9520
9521
9522
9523
9524
9525
9526
9527 return 1;
9528 }
9529
9530
9531
9533 {
9535 }
9536
9537
9538
9540 {
9542 }
9543
9544
9553 {
9554 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9555
9556 if (player)
9557 {
9558 player.MessageStatus(text);
9559 }
9560 }
9561
9562
9571 {
9572 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9573
9574 if (player)
9575 {
9576 player.MessageAction(text);
9577 }
9578 }
9579
9580
9589 {
9590 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9591
9592 if (player)
9593 {
9594 player.MessageFriendly(text);
9595 }
9596 }
9597
9598
9607 {
9608 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9609
9610 if (player)
9611 {
9612 player.MessageImportant(text);
9613 }
9614 }
9615
9617 {
9618 return true;
9619 }
9620
9621
9622 override bool KindOf(
string tag)
9623 {
9624 bool found = false;
9625 string item_name = this.
GetType();
9627 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9628
9629 int array_size = item_tag_array.Count();
9630 for (int i = 0; i < array_size; i++)
9631 {
9632 if (item_tag_array.Get(i) == tag)
9633 {
9634 found = true;
9635 break;
9636 }
9637 }
9638 return found;
9639 }
9640
9641
9643 {
9644
9645 super.OnRPC(sender, rpc_type,ctx);
9646
9647
9648 switch (rpc_type)
9649 {
9650 #ifndef SERVER
9651 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9652 Param2<bool, string> p = new Param2<bool, string>(false, "");
9653
9655 return;
9656
9657 bool play = p.param1;
9658 string soundSet = p.param2;
9659
9660 if (play)
9661 {
9663 {
9665 {
9667 }
9668 }
9669 else
9670 {
9672 }
9673 }
9674 else
9675 {
9677 }
9678
9679 break;
9680 #endif
9681
9682 }
9683
9685 {
9687 }
9688 }
9689
9690
9691
9692
9694 {
9695 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9696 return plugin.GetID(
name);
9697 }
9698
9700 {
9701 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9702 return plugin.GetName(id);
9703 }
9704
9707 {
9708
9709
9710 int varFlags;
9711 if (!ctx.
Read(varFlags))
9712 return;
9713
9714 if (varFlags & ItemVariableFlags.FLOAT)
9715 {
9717 }
9718 }
9719
9721 {
9722
9723 super.SerializeNumericalVars(floats_out);
9724
9725
9726
9728 {
9730 }
9731
9733 {
9735 }
9736
9738 {
9740 }
9741
9743 {
9748 }
9749
9751 {
9753 }
9754 }
9755
9757 {
9758
9759 super.DeSerializeNumericalVars(floats);
9760
9761
9762 int index = 0;
9763 int mask = Math.Round(floats.Get(index));
9764
9765 index++;
9766
9768 {
9770 {
9772 }
9773 else
9774 {
9775 float quantity = floats.Get(index);
9777 }
9778 index++;
9779 }
9780
9782 {
9783 float wet = floats.Get(index);
9785 index++;
9786 }
9787
9789 {
9790 int liquidtype = Math.Round(floats.Get(index));
9792 index++;
9793 }
9794
9796 {
9798 index++;
9800 index++;
9802 index++;
9804 index++;
9805 }
9806
9808 {
9809 int cleanness = Math.Round(floats.Get(index));
9811 index++;
9812 }
9813 }
9814
9816 {
9817 super.WriteVarsToCTX(ctx);
9818
9819
9821 {
9823 }
9824
9826 {
9828 }
9829
9831 {
9833 }
9834
9836 {
9837 int r,g,b,a;
9843 }
9844
9846 {
9848 }
9849 }
9850
9852 {
9853 if (!super.ReadVarsFromCTX(ctx,version))
9854 return false;
9855
9856 int intValue;
9857 float value;
9858
9859 if (version < 140)
9860 {
9861 if (!ctx.
Read(intValue))
9862 return false;
9863
9864 m_VariablesMask = intValue;
9865 }
9866
9868 {
9869 if (!ctx.
Read(value))
9870 return false;
9871
9873 {
9875 }
9876 else
9877 {
9879 }
9880 }
9881
9882 if (version < 140)
9883 {
9885 {
9886 if (!ctx.
Read(value))
9887 return false;
9888 SetTemperatureDirect(value);
9889 }
9890 }
9891
9893 {
9894 if (!ctx.
Read(value))
9895 return false;
9897 }
9898
9900 {
9901 if (!ctx.
Read(intValue))
9902 return false;
9904 }
9905
9907 {
9908 int r,g,b,a;
9910 return false;
9912 return false;
9914 return false;
9916 return false;
9917
9919 }
9920
9922 {
9923 if (!ctx.
Read(intValue))
9924 return false;
9926 }
9927
9928 if (version >= 138 && version < 140)
9929 {
9931 {
9932 if (!ctx.
Read(intValue))
9933 return false;
9934 SetFrozen(intValue);
9935 }
9936 }
9937
9938 return true;
9939 }
9940
9941
9943 {
9946 {
9948 }
9949
9950 if (!super.OnStoreLoad(ctx, version))
9951 {
9953 return false;
9954 }
9955
9956 if (version >= 114)
9957 {
9958 bool hasQuickBarIndexSaved;
9959
9960 if (!ctx.
Read(hasQuickBarIndexSaved))
9961 {
9963 return false;
9964 }
9965
9966 if (hasQuickBarIndexSaved)
9967 {
9968 int itmQBIndex;
9969
9970
9971 if (!ctx.
Read(itmQBIndex))
9972 {
9974 return false;
9975 }
9976
9977 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9978 if (itmQBIndex != -1 && parentPlayer)
9979 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9980 }
9981 }
9982 else
9983 {
9984
9985 PlayerBase player;
9986 int itemQBIndex;
9987 if (version ==
int.
MAX)
9988 {
9989 if (!ctx.
Read(itemQBIndex))
9990 {
9992 return false;
9993 }
9994 }
9995 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9996 {
9997
9998 if (!ctx.
Read(itemQBIndex))
9999 {
10001 return false;
10002 }
10003 if (itemQBIndex != -1 && player)
10004 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10005 }
10006 }
10007
10008 if (version < 140)
10009 {
10010
10011 if (!LoadVariables(ctx, version))
10012 {
10014 return false;
10015 }
10016 }
10017
10018
10020 {
10022 return false;
10023 }
10024 if (version >= 132)
10025 {
10027 if (raib)
10028 {
10030 {
10032 return false;
10033 }
10034 }
10035 }
10036
10038 return true;
10039 }
10040
10041
10042
10044 {
10045 super.OnStoreSave(ctx);
10046
10047 PlayerBase player;
10048 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10049 {
10051
10052 int itemQBIndex = -1;
10053 itemQBIndex = player.FindQuickBarEntityIndex(this);
10054 ctx.
Write(itemQBIndex);
10055 }
10056 else
10057 {
10059 }
10060
10062
10064 if (raib)
10065 {
10067 }
10068 }
10069
10070
10072 {
10073 super.AfterStoreLoad();
10074
10076 {
10078 }
10079
10081 {
10084 }
10085 }
10086
10088 {
10089 super.EEOnAfterLoad();
10090
10092 {
10094 }
10095
10098 }
10099
10101 {
10102 return false;
10103 }
10104
10105
10106
10108 {
10110 {
10111 #ifdef PLATFORM_CONSOLE
10112
10114 {
10116 if (menu)
10117 {
10119 }
10120 }
10121 #endif
10122 }
10123
10125 {
10128 }
10129
10131 {
10132 SetWeightDirty();
10134 }
10136 {
10139 }
10140
10142 {
10145
10148 }
10150 {
10154 }
10155
10156 super.OnVariablesSynchronized();
10157 }
10158
10159
10160
10162 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10163 {
10164 if (!IsServerCheck(allow_client))
10165 return false;
10166
10168 return false;
10169
10172
10173 if (value <= (min + 0.001))
10174 value = min;
10175
10176 if (value == min)
10177 {
10178 if (destroy_config)
10179 {
10180 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10181 if (dstr)
10182 {
10184 this.Delete();
10185 return true;
10186 }
10187 }
10188 else if (destroy_forced)
10189 {
10191 this.Delete();
10192 return true;
10193 }
10194
10196 }
10197
10200
10202 {
10203 EntityAI parent = GetHierarchyRoot();
10204 InventoryLocation iLoc = new InventoryLocation();
10205 GetInventory().GetCurrentInventoryLocation(iLoc);
10207 {
10208 int iLocSlot = iLoc.
GetSlot();
10210 {
10212 }
10214 {
10216 }
10217 }
10218 }
10219
10221 {
10223
10224 if (delta)
10226 }
10227
10229
10230 return false;
10231 }
10232
10233
10235 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10236 {
10238 }
10239
10241 {
10244 }
10245
10247 {
10250 }
10251
10253 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10254 {
10255 float value_clamped = Math.Clamp(value, 0, 1);
10257 SetQuantity(result, destroy_config, destroy_forced);
10258 }
10259
10260
10263 {
10265 }
10266
10268 {
10270 }
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10282 {
10283 int slot = -1;
10284 GameInventory inventory = GetInventory();
10285 if (inventory)
10286 {
10287 InventoryLocation il = new InventoryLocation;
10290 }
10291
10293 }
10294
10296 {
10297 float quantity_max = 0;
10298
10300 {
10301 if (attSlotID != -1)
10302 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10303
10304 if (quantity_max <= 0)
10306 }
10307
10308 if (quantity_max <= 0)
10310
10311 return quantity_max;
10312 }
10313
10315 {
10317 }
10318
10320 {
10322 }
10323
10324
10326 {
10328 }
10329
10331 {
10333 }
10334
10336 {
10338 }
10339
10340
10342 {
10343
10344 float weightEx = GetWeightEx();
10345 float special = GetInventoryAndCargoWeight();
10346 return weightEx - special;
10347 }
10348
10349
10351 {
10353 }
10354
10356 {
10358 {
10359 #ifdef DEVELOPER
10360 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10361 {
10362 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10364 }
10365 #endif
10366
10367 return GetQuantity() * GetConfigWeightModified();
10368 }
10369 else if (HasEnergyManager())
10370 {
10371 #ifdef DEVELOPER
10372 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10373 {
10374 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10375 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10376 }
10377 #endif
10378 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10379 }
10380 else
10381 {
10382 #ifdef DEVELOPER
10383 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10384 {
10385 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10386 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10387 }
10388 #endif
10389 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10390 }
10391 }
10392
10395 {
10396 int item_count = 0;
10398
10399 GameInventory inventory = GetInventory();
10400 CargoBase cargo = inventory.
GetCargo();
10401 if (cargo != NULL)
10402 {
10404 }
10405
10407 for (int i = 0; i < nAttachments; ++i)
10408 {
10410 if (item)
10411 item_count += item.GetNumberOfItems();
10412 }
10413 return item_count;
10414 }
10415
10418 {
10419 float weight = 0;
10420 float wetness = 1;
10421 if (include_wetness)
10424 {
10425 weight = wetness * m_ConfigWeight;
10426 }
10428 {
10429 weight = 1;
10430 }
10431 return weight;
10432 }
10433
10434
10435
10437 {
10438 GameInventory inventory = GetInventory();
10439 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10440 {
10441 array<EntityAI> items = new array<EntityAI>;
10443 for (int i = 0; i < items.Count(); ++i)
10444 {
10446 if (item)
10447 {
10448 g_Game.ObjectDelete(item);
10449 }
10450 }
10451 }
10452 }
10453
10454
10455
10456
10458 {
10459 float energy = 0;
10460 if (HasEnergyManager())
10461 {
10462 energy = GetCompEM().GetEnergy();
10463 }
10464 return energy;
10465 }
10466
10467
10469 {
10470 super.OnEnergyConsumed();
10471
10473 }
10474
10476 {
10477 super.OnEnergyAdded();
10478
10480 }
10481
10482
10484 {
10485 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10486 {
10488 {
10489 float energy_0to1 = GetCompEM().GetEnergy0To1();
10491 }
10492 }
10493 }
10494
10495
10497 {
10498 return ConfigGetFloat("heatIsolation");
10499 }
10500
10502 {
10504 }
10505
10507 {
10508 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10509 if (
g_Game.ConfigIsExisting(paramPath))
10510 return g_Game.ConfigGetFloat(paramPath);
10511
10512 return 0.0;
10513 }
10514
10516 {
10517 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10518 if (
g_Game.ConfigIsExisting(paramPath))
10519 return g_Game.ConfigGetFloat(paramPath);
10520
10521 return 0.0;
10522 }
10523
10524 override void SetWet(
float value,
bool allow_client =
false)
10525 {
10526 if (!IsServerCheck(allow_client))
10527 return;
10528
10531
10533
10534 m_VarWet = Math.Clamp(value, min, max);
10535
10537 {
10540 }
10541 }
10542
10543 override void AddWet(
float value)
10544 {
10546 }
10547
10549 {
10551 }
10552
10554 {
10556 }
10557
10559 {
10561 }
10562
10564 {
10566 }
10567
10569 {
10571 }
10572
10573 override void OnWetChanged(
float newVal,
float oldVal)
10574 {
10577 if (newLevel != oldLevel)
10578 {
10580 }
10581 }
10582
10584 {
10585 SetWeightDirty();
10586 }
10587
10589 {
10590 return GetWetLevelInternal(
m_VarWet);
10591 }
10592
10593
10594
10596 {
10598 }
10599
10601 {
10603 }
10604
10606 {
10608 }
10609
10611 {
10613 }
10614
10615
10616
10618 {
10619 if (ConfigIsExisting("itemModelLength"))
10620 {
10621 return ConfigGetFloat("itemModelLength");
10622 }
10623 return 0;
10624 }
10625
10627 {
10628 if (ConfigIsExisting("itemAttachOffset"))
10629 {
10630 return ConfigGetFloat("itemAttachOffset");
10631 }
10632 return 0;
10633 }
10634
10635 override void SetCleanness(
int value,
bool allow_client =
false)
10636 {
10637 if (!IsServerCheck(allow_client))
10638 return;
10639
10641
10643
10646 }
10647
10649 {
10651 }
10652
10654 {
10655 return true;
10656 }
10657
10658
10659
10660
10662 {
10664 }
10665
10667 {
10669 }
10670
10671
10672
10673
10674 override void SetColor(
int r,
int g,
int b,
int a)
10675 {
10681 }
10683 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10684 {
10689 }
10690
10692 {
10694 }
10695
10698 {
10699 int r,g,b,a;
10701 r = r/255;
10702 g = g/255;
10703 b = b/255;
10704 a = a/255;
10705 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10706 }
10707
10708
10709
10710 override void SetLiquidType(
int value,
bool allow_client =
false)
10711 {
10712 if (!IsServerCheck(allow_client))
10713 return;
10714
10719 }
10720
10722 {
10723 return ConfigGetInt("varLiquidTypeInit");
10724 }
10725
10727 {
10729 }
10730
10732 {
10734 SetFrozen(false);
10735 }
10736
10739 {
10740 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10741 }
10742
10743
10746 {
10747 PlayerBase nplayer;
10748 if (PlayerBase.CastTo(nplayer, player))
10749 {
10751 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10752 }
10753 }
10754
10755
10758 {
10759 PlayerBase nplayer;
10760 if (PlayerBase.CastTo(nplayer,player))
10761 {
10762 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10763 }
10764
10765 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10766
10767 if (HasEnergyManager())
10768 {
10769 GetCompEM().UpdatePlugState();
10770 }
10771 }
10772
10773
10775 {
10776 super.OnPlacementStarted(player);
10777
10779 }
10780
10781 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10782 {
10784 {
10785 m_AdminLog.OnPlacementComplete(player,
this);
10786 }
10787
10788 super.OnPlacementComplete(player, position, orientation);
10789 }
10790
10791
10792
10793
10794
10796 {
10798 {
10799 return true;
10800 }
10801 else
10802 {
10803 return false;
10804 }
10805 }
10806
10807
10809 {
10811 {
10813 }
10814 }
10815
10816
10818 {
10820 }
10821
10823 {
10825 }
10826
10827 override void InsertAgent(
int agent,
float count = 1)
10828 {
10829 if (count < 1)
10830 return;
10831
10833 }
10834
10837 {
10839 }
10840
10841
10843 {
10845 }
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10889 {
10891 return false;
10892 return true;
10893 }
10894
10896 {
10897
10899 }
10900
10901
10904 {
10905 super.CheckForRoofLimited(timeTresholdMS);
10906
10907 float time =
g_Game.GetTime();
10908 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10909 {
10910 m_PreviousRoofTestTime = time;
10911 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10912 }
10913 }
10914
10915
10917 {
10919 {
10920 return 0;
10921 }
10922
10923 if (GetInventory().GetAttachmentSlotsCount() != 0)
10924 {
10925 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10926 if (filter)
10927 return filter.GetProtectionLevel(type, false, system);
10928 else
10929 return 0;
10930 }
10931
10932 string subclassPath, entryName;
10933
10934 switch (type)
10935 {
10937 entryName = "biological";
10938 break;
10940 entryName = "chemical";
10941 break;
10942 default:
10943 entryName = "biological";
10944 break;
10945 }
10946
10947 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10948
10949 return g_Game.ConfigGetFloat(subclassPath + entryName);
10950 }
10951
10952
10953
10956 {
10957 if (!IsMagazine())
10959
10961 }
10962
10963
10964
10965
10966
10971 {
10972 return true;
10973 }
10974
10976 {
10978 }
10979
10980
10981
10982
10983
10985 {
10986 if (parent)
10987 {
10988 if (parent.IsInherited(DayZInfected))
10989 return true;
10990
10991 if (!parent.IsRuined())
10992 return true;
10993 }
10994
10995 return true;
10996 }
10997
10999 {
11000 if (!super.CanPutAsAttachment(parent))
11001 {
11002 return false;
11003 }
11004
11005 if (!IsRuined() && !parent.IsRuined())
11006 {
11007 return true;
11008 }
11009
11010 return false;
11011 }
11012
11014 {
11015
11016
11017
11018
11019 return super.CanReceiveItemIntoCargo(item);
11020 }
11021
11023 {
11024
11025
11026
11027
11028 GameInventory attachmentInv = attachment.GetInventory();
11030 {
11031 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11032 return false;
11033 }
11034
11035 InventoryLocation loc = new InventoryLocation();
11036 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11037 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11038 return false;
11039
11040 return super.CanReceiveAttachment(attachment, slotId);
11041 }
11042
11044 {
11045 if (!super.CanReleaseAttachment(attachment))
11046 return false;
11047
11048 return GetInventory().AreChildrenAccessible();
11049 }
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11072 {
11073 int id = muzzle_owner.GetMuzzleID();
11074 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11075
11076 if (WPOF_array)
11077 {
11078 for (int i = 0; i < WPOF_array.Count(); i++)
11079 {
11080 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11081
11082 if (WPOF)
11083 {
11084 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11085 }
11086 }
11087 }
11088 }
11089
11090
11092 {
11093 int id = muzzle_owner.GetMuzzleID();
11095
11096 if (WPOBE_array)
11097 {
11098 for (int i = 0; i < WPOBE_array.Count(); i++)
11099 {
11100 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11101
11102 if (WPOBE)
11103 {
11104 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11105 }
11106 }
11107 }
11108 }
11109
11110
11112 {
11113 int id = muzzle_owner.GetMuzzleID();
11114 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11115
11116 if (WPOOH_array)
11117 {
11118 for (int i = 0; i < WPOOH_array.Count(); i++)
11119 {
11120 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11121
11122 if (WPOOH)
11123 {
11124 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11125 }
11126 }
11127 }
11128 }
11129
11130
11132 {
11133 int id = muzzle_owner.GetMuzzleID();
11134 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11135
11136 if (WPOOH_array)
11137 {
11138 for (int i = 0; i < WPOOH_array.Count(); i++)
11139 {
11140 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11141
11142 if (WPOOH)
11143 {
11144 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11145 }
11146 }
11147 }
11148 }
11149
11150
11152 {
11153 int id = muzzle_owner.GetMuzzleID();
11154 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11155
11156 if (WPOOH_array)
11157 {
11158 for (int i = 0; i < WPOOH_array.Count(); i++)
11159 {
11160 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11161
11162 if (WPOOH)
11163 {
11164 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11165 }
11166 }
11167 }
11168 }
11169
11170
11171
11173 {
11175 {
11176 return true;
11177 }
11178
11179 return false;
11180 }
11181
11183 {
11185 {
11186 return true;
11187 }
11188
11189 return false;
11190 }
11191
11193 {
11195 {
11196 return true;
11197 }
11198
11199 return false;
11200 }
11201
11203 {
11204 return false;
11205 }
11206
11209 {
11210 return UATimeSpent.DEFAULT_DEPLOY;
11211 }
11212
11213
11214
11215
11217 {
11219 SetSynchDirty();
11220 }
11221
11223 {
11225 }
11226
11227
11229 {
11230 return false;
11231 }
11232
11235 {
11236 string att_type = "None";
11237
11238 if (ConfigIsExisting("soundAttType"))
11239 {
11240 att_type = ConfigGetString("soundAttType");
11241 }
11242
11244 }
11245
11247 {
11249 }
11250
11251
11252
11253
11254
11260
11262 {
11265
11267 }
11268
11269
11271 {
11273 return;
11274
11276
11279
11282
11283 SoundParameters params = new SoundParameters();
11287 }
11288
11289
11291 {
11293 {
11296
11297 SetSynchDirty();
11298
11301 }
11302 }
11303
11305 {
11307 }
11308
11309
11311 {
11313 return;
11314
11316 SetSynchDirty();
11317
11320 }
11321
11323 {
11326 }
11327
11329 {
11331 }
11332
11333 void OnApply(PlayerBase player);
11334
11336 {
11337 return 1.0;
11338 };
11339
11341 {
11343 }
11344
11346 {
11348 }
11349
11351
11353 {
11354 SetDynamicPhysicsLifeTime(0.01);
11356 }
11357
11359 {
11360 array<string> zone_names = new array<string>;
11361 GetDamageZones(zone_names);
11362 for (int i = 0; i < zone_names.Count(); i++)
11363 {
11364 SetHealthMax(zone_names.Get(i),"Health");
11365 }
11366 SetHealthMax("","Health");
11367 }
11368
11371 {
11372 float global_health = GetHealth01("","Health");
11373 array<string> zones = new array<string>;
11374 GetDamageZones(zones);
11375
11376 for (int i = 0; i < zones.Count(); i++)
11377 {
11378 SetHealth01(zones.Get(i),"Health",global_health);
11379 }
11380 }
11381
11384 {
11385 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11386 }
11387
11389 {
11390 if (!hasRootAsPlayer)
11391 {
11392 if (refParentIB)
11393 {
11394
11395 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11396 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11397
11398 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11399 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11400
11403 }
11404 else
11405 {
11406
11409 }
11410 }
11411 }
11412
11414 {
11416 {
11417 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11418 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11419 {
11420 float heatPermCoef = 1.0;
11422 while (ent)
11423 {
11424 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11425 ent = ent.GetHierarchyParent();
11426 }
11427
11428 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11429 }
11430 }
11431 }
11432
11434 {
11435
11436 EntityAI parent = GetHierarchyParent();
11437 if (!parent)
11438 {
11439 hasParent = false;
11440 hasRootAsPlayer = false;
11441 }
11442 else
11443 {
11444 hasParent = true;
11445 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11446 refParentIB =
ItemBase.Cast(parent);
11447 }
11448 }
11449
11450 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11451 {
11452
11453 }
11454
11456 {
11457
11458 return false;
11459 }
11460
11462 {
11463
11464
11465 return false;
11466 }
11467
11469 {
11470
11471 return false;
11472 }
11473
11476 {
11477 return !GetIsFrozen() &&
IsOpen();
11478 }
11479
11481 {
11482 bool hasParent = false, hasRootAsPlayer = false;
11484
11485 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11486 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11487
11488 if (wwtu || foodDecay)
11489 {
11493
11494 if (processWetness || processTemperature || processDecay)
11495 {
11497
11498 if (processWetness)
11499 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11500
11501 if (processTemperature)
11503
11504 if (processDecay)
11505 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11506 }
11507 }
11508 }
11509
11512 {
11514 }
11515
11517 {
11520
11521 return super.GetTemperatureFreezeThreshold();
11522 }
11523
11525 {
11528
11529 return super.GetTemperatureThawThreshold();
11530 }
11531
11533 {
11536
11537 return super.GetItemOverheatThreshold();
11538 }
11539
11541 {
11543 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11544
11545 return super.GetTemperatureFreezeTime();
11546 }
11547
11549 {
11551 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11552
11553 return super.GetTemperatureThawTime();
11554 }
11555
11560
11562 {
11563 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11564 }
11565
11567 {
11568 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11569 }
11570
11573 {
11575 }
11576
11578 {
11580 }
11581
11583 {
11585 }
11586
11589 {
11590 return null;
11591 }
11592
11595 {
11596 return false;
11597 }
11598
11600 {
11602 {
11605 if (!trg)
11606 {
11608 explosive = this;
11609 }
11610
11611 explosive.PairRemote(trg);
11613
11614 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11615 trg.SetPersistentPairID(persistentID);
11616 explosive.SetPersistentPairID(persistentID);
11617
11618 return true;
11619 }
11620 return false;
11621 }
11622
11625 {
11626 float ret = 1.0;
11629 ret *= GetHealth01();
11630
11631 return ret;
11632 }
11633
11634 #ifdef DEVELOPER
11635 override void SetDebugItem()
11636 {
11637 super.SetDebugItem();
11638 _itemBase = this;
11639 }
11640
11642 {
11643 string text = super.GetDebugText();
11644
11646 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11647
11648 return text;
11649 }
11650 #endif
11651
11653 {
11654 return true;
11655 }
11656
11658
11660
11662 {
11665 }
11666
11667
11675
11691
11692 [
Obsolete(
"Use ItemSoundHandler instead")]
11695 {
11696 if (!
g_Game.IsDedicatedServer())
11697 {
11698 if (ConfigIsExisting("attachSoundSet"))
11699 {
11700 string cfg_path = "";
11701 string soundset = "";
11702 string type_name =
GetType();
11703
11706 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11707 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11708
11709 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11710 {
11711 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11712 {
11713 if (cfg_slot_array[i] == slot_type)
11714 {
11715 soundset = cfg_soundset_array[i];
11716 break;
11717 }
11718 }
11719 }
11720
11721 if (soundset != "")
11722 {
11723 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11725 }
11726 }
11727 }
11728 }
11729
11731}
11732
11734{
11736 if (entity)
11737 {
11738 bool is_item = entity.IsInherited(
ItemBase);
11739 if (is_item && full_quantity)
11740 {
11743 }
11744 }
11745 else
11746 {
11748 return NULL;
11749 }
11750 return entity;
11751}
11752
11754{
11755 if (item)
11756 {
11757 if (health > 0)
11758 item.SetHealth("", "", health);
11759
11760 if (item.CanHaveTemperature())
11761 {
11763 if (item.CanFreeze())
11764 item.SetFrozen(false);
11765 }
11766
11767 if (item.HasEnergyManager())
11768 {
11769 if (quantity >= 0)
11770 {
11771 item.GetCompEM().SetEnergy0To1(quantity);
11772 }
11773 else
11774 {
11776 }
11777 }
11778 else if (item.IsMagazine())
11779 {
11780 Magazine mag = Magazine.Cast(item);
11781 if (quantity >= 0)
11782 {
11783 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11784 }
11785 else
11786 {
11788 }
11789
11790 }
11791 else
11792 {
11793 if (quantity >= 0)
11794 {
11795 item.SetQuantityNormalized(quantity, false);
11796 }
11797 else
11798 {
11800 }
11801
11802 }
11803 }
11804}
11805
11806#ifdef DEVELOPER
11808#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.