6774{
6776 {
6777 return true;
6778 }
6779};
6780
6781
6782
6784{
6788
6790
6793
6794
6795
6796
6797
6806
6812
6817
6822
6843 protected bool m_IsResultOfSplit
6844
6846
6851
6852
6853
6855
6859
6860
6861
6863
6866
6867
6868
6874
6875
6883
6886
6887
6889
6890
6892
6893
6898
6899
6904
6905
6907
6908
6910 {
6915
6916 if (!
GetGame().IsDedicatedServer())
6917 {
6919 {
6921
6923 {
6925 }
6926 }
6927
6930 }
6931
6932 m_OldLocation = null;
6933
6935 {
6937 }
6938
6939 if (ConfigIsExisting("headSelectionsToHide"))
6940 {
6943 }
6944
6946 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6947 {
6949 }
6950
6952
6953 m_IsResultOfSplit = false;
6954
6956 }
6957
6959 {
6960 super.InitItemVariables();
6961
6967 m_Count = ConfigGetInt(
"count");
6968
6971
6976
6979
6984
6996
7000
7001
7004 if (ConfigIsExisting("canBeSplit"))
7005 {
7008 }
7009
7011 if (ConfigIsExisting("itemBehaviour"))
7013
7014
7017 RegisterNetSyncVariableInt("m_VarLiquidType");
7018 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7019
7020 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7021 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7022 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7023
7024 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7025 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7026 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7027 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7028
7029 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7030 RegisterNetSyncVariableBool("m_IsTakeable");
7031 RegisterNetSyncVariableBool("m_IsHologram");
7032
7035 {
7038 }
7039
7041
7043 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7045
7046 }
7047
7049 {
7051 }
7052
7054 {
7057 {
7062 }
7063 }
7064
7065 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7066 {
7068 {
7071 }
7072
7074 }
7075
7077 {
7083 }
7084
7086
7088 {
7090
7091 if (!action)
7092 {
7093 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7094 return;
7095 }
7096
7098 if (!ai)
7099 {
7101 return;
7102 }
7103
7105 if (!action_array)
7106 {
7107 action_array = new array<ActionBase_Basic>;
7109 }
7110 if (LogManager.IsActionLogEnable())
7111 {
7112 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7113 }
7114
7115 if (action_array.Find(action) != -1)
7116 {
7117 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7118 }
7119 else
7120 {
7121 action_array.Insert(action);
7122 }
7123 }
7124
7126 {
7128 ActionBase action = player.GetActionManager().GetAction(actionName);
7131
7132 if (action_array)
7133 {
7134 action_array.RemoveItem(action);
7135 }
7136 }
7137
7138
7139
7141 {
7142 ActionOverrideData overrideData = new ActionOverrideData();
7146
7148 if (!actionMap)
7149 {
7152 }
7153
7154 actionMap.Insert(this.
Type(), overrideData);
7155
7156 }
7157
7159
7161
7162
7164 {
7167
7170
7171 string config_to_search = "CfgVehicles";
7172 string muzzle_owner_config;
7173
7175 {
7176 if (IsInherited(Weapon))
7177 config_to_search = "CfgWeapons";
7178
7179 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7180
7181 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7182
7184
7185 if (config_OnFire_subclass_count > 0)
7186 {
7187 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7188
7189 for (int i = 0; i < config_OnFire_subclass_count; i++)
7190 {
7191 string particle_class = "";
7193 string config_OnFire_entry = config_OnFire_class + particle_class;
7194 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7195 WPOF_array.Insert(WPOF);
7196 }
7197
7198
7200 }
7201 }
7202
7204 {
7205 config_to_search = "CfgWeapons";
7206 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7207
7208 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7209
7211
7212 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7213 {
7214 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7215
7216 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7217 {
7218 string particle_class2 = "";
7220 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7221 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7222 WPOBE_array.Insert(WPOBE);
7223 }
7224
7225
7227 }
7228 }
7229 }
7230
7231
7233 {
7236
7238 {
7239 string config_to_search = "CfgVehicles";
7240
7241 if (IsInherited(Weapon))
7242 config_to_search = "CfgWeapons";
7243
7244 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7245 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7246
7247 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7248 {
7249
7251
7253 {
7255 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7257 return;
7258 }
7259
7262
7263
7264
7266 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7267
7268 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7269 {
7270 string particle_class = "";
7272 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7274
7275 if (entry_type == CT_CLASS)
7276 {
7277 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7278 WPOOH_array.Insert(WPOF);
7279 }
7280 }
7281
7282
7284 }
7285 }
7286 }
7287
7289 {
7291 }
7292
7294 {
7296 {
7298
7301
7304
7305 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7306 }
7307 }
7308
7310 {
7312 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7313
7315 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7316
7318 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7319
7321 {
7323 }
7324 }
7325
7327 {
7329 }
7330
7332 {
7335 else
7337
7339 {
7342 }
7343 else
7344 {
7347
7350 }
7351
7353 }
7354
7356 {
7358 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7359 }
7360
7362 {
7364 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7366 }
7367
7369 {
7371 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7372 }
7373
7375 {
7378
7379 OverheatingParticle OP = new OverheatingParticle();
7384
7386 }
7387
7389 {
7392
7393 return -1;
7394 }
7395
7397 {
7399 {
7402
7403 for (int i = count; i > 0; --i)
7404 {
7405 int id = i - 1;
7408
7411
7412 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7413 {
7414 if (p)
7415 {
7418 }
7419 }
7420 }
7421 }
7422 }
7423
7425 {
7427 {
7429 {
7430 int id = i - 1;
7432
7433 if (OP)
7434 {
7436
7437 if (p)
7438 {
7440 }
7441
7442 delete OP;
7443 }
7444 }
7445
7448 }
7449 }
7450
7453 {
7454 return 0.0;
7455 }
7456
7457
7459 {
7460 return 250;
7461 }
7462
7464 {
7465 return 0;
7466 }
7467
7470 {
7472 return true;
7473
7474 return false;
7475 }
7476
7479 {
7482
7484 {
7486 }
7487 else
7488 {
7489
7491 }
7492
7494 }
7495
7502 {
7503 return -1;
7504 }
7505
7506
7507
7508
7510 {
7512 {
7514 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7515
7516 if (r_index >= 0)
7517 {
7518 InventoryLocation r_il = new InventoryLocation;
7519 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7520
7521 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7524 {
7525 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7526 }
7528 {
7529 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7530 }
7531
7532 }
7533
7534 player.GetHumanInventory().ClearUserReservedLocation(this);
7535 }
7536
7539 }
7540
7541
7542
7543
7545 {
7546 return ItemBase.m_DebugActionsMask;
7547 }
7548
7550 {
7551 return ItemBase.m_DebugActionsMask & mask;
7552 }
7553
7555 {
7556 ItemBase.m_DebugActionsMask = mask;
7557 }
7558
7560 {
7561 ItemBase.m_DebugActionsMask |= mask;
7562 }
7563
7565 {
7566 ItemBase.m_DebugActionsMask &= ~mask;
7567 }
7568
7570 {
7572 {
7574 }
7575 else
7576 {
7578 }
7579 }
7580
7581
7583 {
7584 if (GetEconomyProfile())
7585 {
7586 float q_max = GetEconomyProfile().GetQuantityMax();
7587 if (q_max > 0)
7588 {
7589 float q_min = GetEconomyProfile().GetQuantityMin();
7590 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7591
7593 {
7594 ComponentEnergyManager comp = GetCompEM();
7596 {
7598 }
7599 }
7601 {
7603
7604 }
7605
7606 }
7607 }
7608 }
7609
7612 {
7613 EntityAI parent = GetHierarchyParent();
7614
7615 if (parent)
7616 {
7617 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7618 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7619 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7620 }
7621 }
7622
7625 {
7626 EntityAI parent = GetHierarchyParent();
7627
7628 if (parent)
7629 {
7630 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7631 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7632 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7633 }
7634 }
7635
7637 {
7638
7639
7640
7641
7643
7645 {
7646 if (ScriptInputUserData.CanStoreInputUserData())
7647 {
7648 ScriptInputUserData ctx = new ScriptInputUserData;
7654 ctx.
Write(use_stack_max);
7657
7659 {
7660 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7661 }
7662 }
7663 }
7664 else if (!
GetGame().IsMultiplayer())
7665 {
7667 }
7668 }
7669
7671 {
7673 }
7674
7676 {
7678 }
7679
7681 {
7683 }
7684
7686 {
7687
7688 return false;
7689 }
7690
7692 {
7693 return false;
7694 }
7695
7699 {
7700 return false;
7701 }
7702
7704 {
7705 return "";
7706 }
7707
7709
7711 {
7712 return false;
7713 }
7714
7716 {
7717 return true;
7718 }
7719
7720
7721
7723 {
7724 return true;
7725 }
7726
7728 {
7729 return true;
7730 }
7731
7733 {
7734 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7736 }
7737
7739 {
7741 }
7742
7744 {
7746 if (!is_being_placed)
7748 SetSynchDirty();
7749 }
7750
7751
7753
7755 {
7757 }
7758
7760 {
7762 }
7763
7765 {
7766 return 1;
7767 }
7768
7770 {
7771 return false;
7772 }
7773
7775 {
7777 SetSynchDirty();
7778 }
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7815 {
7816 super.OnMovedInsideCargo(container);
7817
7818 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7819 }
7820
7821 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7822 {
7823 super.EEItemLocationChanged(oldLoc,newLoc);
7824
7825 PlayerBase new_player = null;
7826 PlayerBase old_player = null;
7827
7828 if (newLoc.GetParent())
7829 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7830
7831 if (oldLoc.GetParent())
7832 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7833
7835 {
7836 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7837
7838 if (r_index >= 0)
7839 {
7840 InventoryLocation r_il = new InventoryLocation;
7841 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7842
7843 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7846 {
7847 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7848 }
7850 {
7851 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7852 }
7853
7854 }
7855 }
7856
7858 {
7859 if (new_player)
7860 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7861
7862 if (new_player == old_player)
7863 {
7864
7865 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7866 {
7868 {
7869 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7870 {
7871 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7872 }
7873 }
7874 else
7875 {
7876 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7877 }
7878 }
7879
7880 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7881 {
7882 int type = oldLoc.GetType();
7884 {
7885 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7886 }
7888 {
7889 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7890 }
7891 }
7892 if (!m_OldLocation)
7893 {
7894 m_OldLocation = new InventoryLocation;
7895 }
7896 m_OldLocation.Copy(oldLoc);
7897 }
7898 else
7899 {
7900 if (m_OldLocation)
7901 {
7902 m_OldLocation.Reset();
7903 }
7904 }
7905
7907 }
7908 else
7909 {
7910 if (new_player)
7911 {
7912 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7913 if (res_index >= 0)
7914 {
7915 InventoryLocation il = new InventoryLocation;
7916 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7918 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7921 {
7922 il.
GetParent().GetOnReleaseLock().Invoke(it);
7923 }
7925 {
7927 }
7928
7929 }
7930 }
7932 {
7933
7935 }
7936
7937 if (m_OldLocation)
7938 {
7939 m_OldLocation.Reset();
7940 }
7941 }
7942 }
7943
7944 override void EOnContact(IEntity other, Contact extra)
7945 {
7947 {
7948 int liquidType = -1;
7950 if (impactSpeed > 0.0)
7951 {
7953 #ifndef SERVER
7955 #else
7957 SetSynchDirty();
7958 #endif
7960 }
7961 }
7962
7963 #ifdef SERVER
7964 if (GetCompEM() && GetCompEM().IsPlugged())
7965 {
7966 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7967 GetCompEM().UnplugThis();
7968 }
7969 #endif
7970 }
7971
7973
7975 {
7977 }
7978
7980 {
7981
7982 }
7983
7985 {
7986 super.OnItemLocationChanged(old_owner, new_owner);
7987
7988 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7989 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7990
7991 if (!relatedPlayer && playerNew)
7992 relatedPlayer = playerNew;
7993
7994 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7995 {
7997 if (actionMgr)
7998 {
7999 ActionBase currentAction = actionMgr.GetRunningAction();
8000 if (currentAction)
8002 }
8003 }
8004
8005 Man ownerPlayerOld = null;
8006 Man ownerPlayerNew = null;
8007
8008 if (old_owner)
8009 {
8010 if (old_owner.
IsMan())
8011 {
8012 ownerPlayerOld = Man.Cast(old_owner);
8013 }
8014 else
8015 {
8016 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8017 }
8018 }
8019 else
8020 {
8022 {
8024
8025 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8026 {
8027 GetCompEM().UnplugThis();
8028 }
8029 }
8030 }
8031
8032 if (new_owner)
8033 {
8034 if (new_owner.
IsMan())
8035 {
8036 ownerPlayerNew = Man.Cast(new_owner);
8037 }
8038 else
8039 {
8040 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8041 }
8042 }
8043
8044 if (ownerPlayerOld != ownerPlayerNew)
8045 {
8046 if (ownerPlayerOld)
8047 {
8048 array<EntityAI> subItemsExit = new array<EntityAI>;
8050 for (int i = 0; i < subItemsExit.Count(); i++)
8051 {
8054 }
8055 }
8056
8057 if (ownerPlayerNew)
8058 {
8059 array<EntityAI> subItemsEnter = new array<EntityAI>;
8061 for (int j = 0; j < subItemsEnter.Count(); j++)
8062 {
8065 }
8066 }
8067 }
8068 else if (ownerPlayerNew != null)
8069 {
8070 PlayerBase nplayer;
8071 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8072 {
8073 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8075 for (int k = 0; k < subItemsUpdate.Count(); k++)
8076 {
8078 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8079 }
8080 }
8081 }
8082
8083 if (old_owner)
8084 old_owner.OnChildItemRemoved(this);
8085 if (new_owner)
8086 new_owner.OnChildItemReceived(this);
8087 }
8088
8089
8091 {
8092 super.EEDelete(parent);
8093 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8094 if (player)
8095 {
8097
8098 if (player.IsAlive())
8099 {
8100 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8101 if (r_index >= 0)
8102 {
8103 InventoryLocation r_il = new InventoryLocation;
8104 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8105
8106 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8109 {
8110 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8111 }
8113 {
8114 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8115 }
8116
8117 }
8118
8119 player.RemoveQuickBarEntityShortcut(this);
8120 }
8121 }
8122 }
8123
8125 {
8126 super.EEKilled(killer);
8127
8130 {
8131 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8132 {
8133 if (IsMagazine())
8134 {
8135 if (Magazine.Cast(this).GetAmmoCount() > 0)
8136 {
8138 }
8139 }
8140 else
8141 {
8143 }
8144 }
8145 }
8146 }
8147
8149 {
8150 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8151
8152 super.OnWasAttached(parent, slot_id);
8153
8156
8158 }
8159
8161 {
8162 super.OnWasDetached(parent, slot_id);
8163
8166 }
8167
8169 {
8170 int idx;
8173
8174 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8175 if (inventory_slots.Count() < 1)
8176 {
8177 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8178 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8179 }
8180 else
8181 {
8182 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8183 }
8184
8185 idx = inventory_slots.Find(slot);
8186 if (idx < 0)
8187 return "";
8188
8189 return attach_types.Get(idx);
8190 }
8191
8193 {
8194 int idx = -1;
8195 string slot;
8196
8199
8200 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8201 if (inventory_slots.Count() < 1)
8202 {
8203 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8204 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8205 }
8206 else
8207 {
8208 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8209 if (detach_types.Count() < 1)
8210 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8211 }
8212
8213 for (int i = 0; i < inventory_slots.Count(); i++)
8214 {
8215 slot = inventory_slots.Get(i);
8216 }
8217
8218 if (slot != "")
8219 {
8220 if (detach_types.Count() == 1)
8221 idx = 0;
8222 else
8223 idx = inventory_slots.Find(slot);
8224 }
8225 if (idx < 0)
8226 return "";
8227
8228 return detach_types.Get(idx);
8229 }
8230
8232 {
8233
8235
8236
8237 float min_time = 1;
8238 float max_time = 3;
8239 float delay = Math.RandomFloat(min_time, max_time);
8240
8241 explode_timer.Run(delay, this, "DoAmmoExplosion");
8242 }
8243
8245 {
8246 Magazine magazine = Magazine.Cast(this);
8247 int pop_sounds_count = 6;
8248 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8249
8250
8251 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8252 string sound_name = pop_sounds[ sound_idx ];
8254
8255
8256 magazine.ServerAddAmmoCount(-1);
8257
8258
8259 float min_temp_to_explode = 100;
8260
8261 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8262 {
8264 }
8265 }
8266
8267
8268 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8269 {
8270 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8271
8272 const int CHANCE_DAMAGE_CARGO = 4;
8273 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8274 const int CHANCE_DAMAGE_NOTHING = 2;
8275
8277 {
8278 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8279 int chances;
8280 int rnd;
8281
8282 if (GetInventory().GetCargo())
8283 {
8284 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8285 rnd = Math.RandomInt(0,chances);
8286
8287 if (rnd < CHANCE_DAMAGE_CARGO)
8288 {
8290 }
8291 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8292 {
8294 }
8295 }
8296 else
8297 {
8298 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8299 rnd = Math.RandomInt(0,chances);
8300
8301 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8302 {
8304 }
8305 }
8306 }
8307 }
8308
8310 {
8311 if (GetInventory().GetCargo())
8312 {
8313 int item_count = GetInventory().GetCargo().GetItemCount();
8314 if (item_count > 0)
8315 {
8316 int random_pick = Math.RandomInt(0, item_count);
8318 if (!item.IsExplosive())
8319 {
8320 item.AddHealth("","",damage);
8321 return true;
8322 }
8323 }
8324 }
8325 return false;
8326 }
8327
8329 {
8330 int attachment_count = GetInventory().AttachmentCount();
8331 if (attachment_count > 0)
8332 {
8333 int random_pick = Math.RandomInt(0, attachment_count);
8334 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8335 if (!attachment.IsExplosive())
8336 {
8337 attachment.AddHealth("","",damage);
8338 return true;
8339 }
8340 }
8341 return false;
8342 }
8343
8345 {
8347 }
8348
8350 {
8352 return GetInventory().CanRemoveEntity();
8353
8354 return false;
8355 }
8356
8358 {
8359
8361 return false;
8362
8363
8365 return false;
8366
8367
8368
8370 if (delta == 0)
8371 return false;
8372
8373
8374 return true;
8375 }
8376
8378 {
8380 {
8381 if (ScriptInputUserData.CanStoreInputUserData())
8382 {
8383 ScriptInputUserData ctx = new ScriptInputUserData;
8388 ctx.
Write(destination_entity);
8392 }
8393 }
8394 else if (!
GetGame().IsMultiplayer())
8395 {
8397 }
8398 }
8399
8401 {
8402 float split_quantity_new;
8406 InventoryLocation loc = new InventoryLocation;
8407
8408 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8409 {
8411 split_quantity_new = stack_max;
8412 else
8414
8416 {
8417 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8418 if (new_item)
8419 {
8420 new_item.SetResultOfSplit(true);
8421 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8423 new_item.
SetQuantity(split_quantity_new,
false,
true);
8424 }
8425 }
8426 }
8427 else if (destination_entity && slot_id == -1)
8428 {
8429 if (quantity > stack_max)
8430 split_quantity_new = stack_max;
8431 else
8432 split_quantity_new = quantity;
8433
8435 {
8437 {
8440 }
8441
8442 if (new_item)
8443 {
8444 new_item.SetResultOfSplit(true);
8445 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8447 new_item.
SetQuantity(split_quantity_new,
false,
true);
8448 }
8449 }
8450 }
8451 else
8452 {
8453 if (stack_max != 0)
8454 {
8456 {
8458 }
8459
8460 if (split_quantity_new == 0)
8461 {
8462 if (!
GetGame().IsMultiplayer())
8463 player.PhysicalPredictiveDropItem(this);
8464 else
8465 player.ServerDropEntity(this);
8466 return;
8467 }
8468
8470 {
8472
8473 if (new_item)
8474 {
8475 new_item.SetResultOfSplit(true);
8476 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8479 new_item.PlaceOnSurface();
8480 }
8481 }
8482 }
8483 }
8484 }
8485
8487 {
8488 float split_quantity_new;
8492 InventoryLocation loc = new InventoryLocation;
8493
8494 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8495 {
8497 split_quantity_new = stack_max;
8498 else
8500
8502 {
8503 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8504 if (new_item)
8505 {
8506 new_item.SetResultOfSplit(true);
8507 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8509 new_item.
SetQuantity(split_quantity_new,
false,
true);
8510 }
8511 }
8512 }
8513 else if (destination_entity && slot_id == -1)
8514 {
8515 if (quantity > stack_max)
8516 split_quantity_new = stack_max;
8517 else
8518 split_quantity_new = quantity;
8519
8521 {
8523 {
8526 }
8527
8528 if (new_item)
8529 {
8530 new_item.SetResultOfSplit(true);
8531 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8533 new_item.
SetQuantity(split_quantity_new,
false,
true);
8534 }
8535 }
8536 }
8537 else
8538 {
8539 if (stack_max != 0)
8540 {
8542 {
8544 }
8545
8547 {
8549
8550 if (new_item)
8551 {
8552 new_item.SetResultOfSplit(true);
8553 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8556 new_item.PlaceOnSurface();
8557 }
8558 }
8559 }
8560 }
8561 }
8562
8564 {
8566 {
8567 if (ScriptInputUserData.CanStoreInputUserData())
8568 {
8569 ScriptInputUserData ctx = new ScriptInputUserData;
8574 dst.WriteToContext(ctx);
8576 }
8577 }
8578 else if (!
GetGame().IsMultiplayer())
8579 {
8581 }
8582 }
8583
8585 {
8587 {
8588 if (ScriptInputUserData.CanStoreInputUserData())
8589 {
8590 ScriptInputUserData ctx = new ScriptInputUserData;
8595 ctx.
Write(destination_entity);
8601 }
8602 }
8603 else if (!
GetGame().IsMultiplayer())
8604 {
8606 }
8607 }
8608
8610 {
8612 }
8613
8615 {
8617 float split_quantity_new;
8619 if (dst.IsValid())
8620 {
8621 int slot_id = dst.GetSlot();
8623
8624 if (quantity > stack_max)
8625 split_quantity_new = stack_max;
8626 else
8627 split_quantity_new = quantity;
8628
8630 {
8632
8633 if (new_item)
8634 {
8635 new_item.SetResultOfSplit(true);
8636 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8638 new_item.
SetQuantity(split_quantity_new,
false,
true);
8639 }
8640
8641 return new_item;
8642 }
8643 }
8644
8645 return null;
8646 }
8647
8649 {
8651 float split_quantity_new;
8653 if (destination_entity)
8654 {
8656 if (quantity > stackable)
8657 split_quantity_new = stackable;
8658 else
8659 split_quantity_new = quantity;
8660
8662 {
8663 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8664 if (new_item)
8665 {
8666 new_item.SetResultOfSplit(true);
8667 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8669 new_item.
SetQuantity(split_quantity_new,
false,
true);
8670 }
8671 }
8672 }
8673 }
8674
8676 {
8678 {
8679 if (ScriptInputUserData.CanStoreInputUserData())
8680 {
8681 ScriptInputUserData ctx = new ScriptInputUserData;
8686 ItemBase destination_entity =
this;
8687 ctx.
Write(destination_entity);
8691 }
8692 }
8693 else if (!
GetGame().IsMultiplayer())
8694 {
8696 }
8697 }
8698
8700 {
8702 float split_quantity_new;
8704 if (player)
8705 {
8707 if (quantity > stackable)
8708 split_quantity_new = stackable;
8709 else
8710 split_quantity_new = quantity;
8711
8713 {
8714 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8715 new_item =
ItemBase.Cast(in_hands);
8716 if (new_item)
8717 {
8718 new_item.SetResultOfSplit(true);
8719 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8721 new_item.SetQuantity(split_quantity_new, false, true);
8722 }
8723 }
8724 }
8725 }
8726
8728 {
8730 float split_quantity_new = Math.Floor(quantity * 0.5);
8731
8733 return;
8734
8736
8737 if (new_item)
8738 {
8739 if (new_item.GetQuantityMax() < split_quantity_new)
8740 {
8741 split_quantity_new = new_item.GetQuantityMax();
8742 }
8743
8744 new_item.SetResultOfSplit(true);
8745 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8746
8748 {
8751 }
8752 else
8753 {
8755 new_item.
SetQuantity(split_quantity_new,
false,
true);
8756 }
8757 }
8758 }
8759
8761 {
8763 float split_quantity_new = Math.Floor(quantity / 2);
8764
8766 return;
8767
8768 InventoryLocation invloc = new InventoryLocation;
8770
8772 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8773
8774 if (new_item)
8775 {
8776 if (new_item.GetQuantityMax() < split_quantity_new)
8777 {
8778 split_quantity_new = new_item.GetQuantityMax();
8779 }
8781 {
8784 }
8785 else if (split_quantity_new > 1)
8786 {
8788 new_item.
SetQuantity(split_quantity_new,
false,
true);
8789 }
8790 }
8791 }
8792
8795 {
8796 SetWeightDirty();
8798
8799 if (parent)
8800 parent.OnAttachmentQuantityChangedEx(this, delta);
8801
8803 {
8805 {
8807 }
8809 {
8810 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8812 }
8813 }
8814
8815 }
8816
8819 {
8820
8821 }
8822
8825 {
8827 }
8828
8830 {
8831 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8832
8834 {
8835 if (newLevel == GameConstants.STATE_RUINED)
8836 {
8838 EntityAI parent = GetHierarchyParent();
8839 if (parent && parent.IsFireplace())
8840 {
8841 CargoBase cargo = GetInventory().GetCargo();
8842 if (cargo)
8843 {
8845 {
8847 }
8848 }
8849 }
8850 }
8851
8853 {
8854
8856 return;
8857 }
8858
8859 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8860 {
8862 }
8863 }
8864 }
8865
8866
8868 {
8869 super.OnRightClick();
8870
8872 {
8874 {
8875 if (ScriptInputUserData.CanStoreInputUserData())
8876 {
8877 EntityAI root = GetHierarchyRoot();
8878 Man playerOwner = GetHierarchyRootPlayer();
8879 InventoryLocation dst = new InventoryLocation;
8880
8881
8882 if (!playerOwner && root && root == this)
8883 {
8885 }
8886 else
8887 {
8888
8889 GetInventory().GetCurrentInventoryLocation(dst);
8891 {
8894 {
8896 }
8897 else
8898 {
8900
8901
8902 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8903 {
8905 }
8906 else
8907 {
8908 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8909 }
8910 }
8911 }
8912 }
8913
8914 ScriptInputUserData ctx = new ScriptInputUserData;
8922 }
8923 }
8924 else if (!
GetGame().IsMultiplayer())
8925 {
8927 }
8928 }
8929 }
8930
8932 {
8933 if (root)
8934 {
8935 vector m4[4];
8936 root.GetTransform(m4);
8937 dst.SetGround(this, m4);
8938 }
8939 else
8940 {
8941 GetInventory().GetCurrentInventoryLocation(dst);
8942 }
8943 }
8944
8945 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8946 {
8947
8948 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8949 return false;
8950
8951 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8952 return false;
8953
8954
8956 return false;
8957
8958
8959 Magazine mag = Magazine.Cast(this);
8960 if (mag)
8961 {
8962 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8963 return false;
8964
8965 if (stack_max_limit)
8966 {
8967 Magazine other_mag = Magazine.Cast(other_item);
8968 if (other_item)
8969 {
8970 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8971 return false;
8972 }
8973
8974 }
8975 }
8976 else
8977 {
8978
8980 return false;
8981
8983 return false;
8984 }
8985
8986 PlayerBase player = null;
8987 if (CastTo(player, GetHierarchyRootPlayer()))
8988 {
8989 if (player.GetInventory().HasAttachment(this))
8990 return false;
8991
8992 if (player.IsItemsToDelete())
8993 return false;
8994 }
8995
8996 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8997 return false;
8998
8999 int slotID;
9001 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9002 return false;
9003
9004 return true;
9005 }
9006
9008 {
9010 }
9011
9013 {
9014 return m_IsResultOfSplit;
9015 }
9016
9018 {
9019 m_IsResultOfSplit = value;
9020 }
9021
9023 {
9025 }
9026
9028 {
9029 float other_item_quantity = other_item.GetQuantity();
9030 float this_free_space;
9031
9033
9035
9036 if (other_item_quantity > this_free_space)
9037 {
9038 return this_free_space;
9039 }
9040 else
9041 {
9042 return other_item_quantity;
9043 }
9044 }
9045
9047 {
9049 }
9050
9052 {
9054 return;
9055
9056 if (!IsMagazine() && other_item)
9057 {
9059 if (quantity_used != 0)
9060 {
9061 float hp1 = GetHealth01("","");
9062 float hp2 = other_item.GetHealth01("","");
9063 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9064 hpResult = hpResult / (
GetQuantity() + quantity_used);
9065
9066 hpResult *= GetMaxHealth();
9067 Math.Round(hpResult);
9068 SetHealth("", "Health", hpResult);
9069
9071 other_item.AddQuantity(-quantity_used);
9072 }
9073 }
9075 }
9076
9078 {
9079 #ifdef SERVER
9080 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9081 GetHierarchyParent().IncreaseLifetimeUp();
9082 #endif
9083 };
9084
9086 {
9087 PlayerBase p = PlayerBase.Cast(player);
9088
9089 array<int> recipesIds = p.m_Recipes;
9090 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9091 if (moduleRecipesManager)
9092 {
9093 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9094 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9095 }
9096
9097 for (int i = 0;i < recipesIds.Count(); i++)
9098 {
9099 int key = recipesIds.Get(i);
9100 string recipeName = moduleRecipesManager.GetRecipeName(key);
9102 }
9103 }
9104
9105
9106 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9107 {
9108 super.GetDebugActions(outputList);
9109
9110
9116
9117
9122
9127
9128
9132
9133
9135 {
9139 }
9140
9143
9144
9148
9150
9151 InventoryLocation loc = new InventoryLocation();
9152 GetInventory().GetCurrentInventoryLocation(loc);
9154 {
9155 if (Gizmo_IsSupported())
9158 }
9159
9161 }
9162
9163
9164
9165
9167 {
9168 super.OnAction(action_id, player, ctx);
9169
9171 {
9172 switch (action_id)
9173 {
9176 return true;
9179 return true;
9180 }
9181 }
9182
9184 {
9185 switch (action_id)
9186 {
9188 Delete();
9189 return true;
9190 }
9191 }
9192
9193 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9194 {
9195 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9196 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9197 PlayerBase p = PlayerBase.Cast(player);
9198 if (
EActions.RECIPES_RANGE_START < 1000)
9199 {
9200 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9201 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9202 }
9203 }
9204 #ifndef SERVER
9205 else if (action_id ==
EActions.WATCH_PLAYER)
9206 {
9207 PluginDeveloper.SetDeveloperItemClientEx(player);
9208 }
9209 #endif
9211 {
9212 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9213 {
9214 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9215 OnDebugButtonPressServer(id + 1);
9216 }
9217
9218 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9219 {
9220 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9222 }
9223
9224 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9225 {
9226 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9228 }
9229
9230 else if (action_id ==
EActions.ADD_QUANTITY)
9231 {
9232 if (IsMagazine())
9233 {
9234 Magazine mag = Magazine.Cast(this);
9235 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9236 }
9237 else
9238 {
9240 }
9241
9242 if (m_EM)
9243 {
9244 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9245 }
9246
9247 }
9248
9249 else if (action_id ==
EActions.REMOVE_QUANTITY)
9250 {
9251 if (IsMagazine())
9252 {
9253 Magazine mag2 = Magazine.Cast(this);
9254 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9255 }
9256 else
9257 {
9259 }
9260 if (m_EM)
9261 {
9262 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9263 }
9264
9265 }
9266
9267 else if (action_id ==
EActions.SET_QUANTITY_0)
9268 {
9270
9271 if (m_EM)
9272 {
9273 m_EM.SetEnergy(0);
9274 }
9275 }
9276
9277 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9278 {
9280
9281 if (m_EM)
9282 {
9283 m_EM.SetEnergy(m_EM.GetEnergyMax());
9284 }
9285 }
9286
9287 else if (action_id ==
EActions.ADD_HEALTH)
9288 {
9289 AddHealth("","",GetMaxHealth("","Health")/5);
9290 }
9291 else if (action_id ==
EActions.REMOVE_HEALTH)
9292 {
9293 AddHealth("","",-GetMaxHealth("","Health")/5);
9294 }
9295 else if (action_id ==
EActions.DESTROY_HEALTH)
9296 {
9297 SetHealth01("","",0);
9298 }
9299 else if (action_id ==
EActions.WATCH_ITEM)
9300 {
9302 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9303 #ifdef DEVELOPER
9304 SetDebugDeveloper_item(this);
9305 #endif
9306 }
9307
9308 else if (action_id ==
EActions.ADD_TEMPERATURE)
9309 {
9310 AddTemperature(20);
9311
9312 }
9313
9314 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9315 {
9316 AddTemperature(-20);
9317
9318 }
9319
9320 else if (action_id ==
EActions.FLIP_FROZEN)
9321 {
9322 SetFrozen(!GetIsFrozen());
9323
9324 }
9325
9326 else if (action_id ==
EActions.ADD_WETNESS)
9327 {
9329
9330 }
9331
9332 else if (action_id ==
EActions.REMOVE_WETNESS)
9333 {
9335
9336 }
9337
9338 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9339 {
9342
9343
9344 }
9345
9346 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9347 {
9350 }
9351
9352 else if (action_id ==
EActions.MAKE_SPECIAL)
9353 {
9354 auto debugParams = DebugSpawnParams.WithPlayer(player);
9355 OnDebugSpawnEx(debugParams);
9356 }
9357
9358 }
9359
9360
9361 return false;
9362 }
9363
9364
9365
9366
9370
9373
9374
9375
9377 {
9378 return false;
9379 }
9380
9381
9383 {
9384 return true;
9385 }
9386
9387
9389 {
9390 return true;
9391 }
9392
9393
9394
9396 {
9397 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9399 }
9400
9403 {
9404 return null;
9405 }
9406
9408 {
9409 return false;
9410 }
9411
9413 {
9414 return false;
9415 }
9416
9420
9421
9423 {
9424 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9425 return module_repairing.CanRepair(this, item_repair_kit);
9426 }
9427
9428
9429 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9430 {
9431 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9432 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9433 }
9434
9435
9437 {
9438
9439
9440
9441
9442
9443
9444
9445
9446 return 1;
9447 }
9448
9449
9450
9452 {
9454 }
9455
9456
9457
9459 {
9461 }
9462
9463
9472 {
9473 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9474
9475 if (player)
9476 {
9477 player.MessageStatus(text);
9478 }
9479 }
9480
9481
9490 {
9491 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9492
9493 if (player)
9494 {
9495 player.MessageAction(text);
9496 }
9497 }
9498
9499
9508 {
9509 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9510
9511 if (player)
9512 {
9513 player.MessageFriendly(text);
9514 }
9515 }
9516
9517
9526 {
9527 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9528
9529 if (player)
9530 {
9531 player.MessageImportant(text);
9532 }
9533 }
9534
9536 {
9537 return true;
9538 }
9539
9540
9541 override bool KindOf(
string tag)
9542 {
9543 bool found = false;
9544 string item_name = this.
GetType();
9547
9548 int array_size = item_tag_array.Count();
9549 for (int i = 0; i < array_size; i++)
9550 {
9551 if (item_tag_array.Get(i) == tag)
9552 {
9553 found = true;
9554 break;
9555 }
9556 }
9557 return found;
9558 }
9559
9560
9562 {
9563
9564 super.OnRPC(sender, rpc_type,ctx);
9565
9566
9567 switch (rpc_type)
9568 {
9569 #ifndef SERVER
9570 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9571 Param2<bool, string> p = new Param2<bool, string>(false, "");
9572
9574 return;
9575
9576 bool play = p.param1;
9577 string soundSet = p.param2;
9578
9579 if (play)
9580 {
9582 {
9584 {
9586 }
9587 }
9588 else
9589 {
9591 }
9592 }
9593 else
9594 {
9596 }
9597
9598 break;
9599 #endif
9600
9601 }
9602
9604 {
9606 }
9607 }
9608
9609
9610
9611
9613 {
9614 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9615 return plugin.GetID(
name);
9616 }
9617
9619 {
9620 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9621 return plugin.GetName(id);
9622 }
9623
9626 {
9627
9628
9629 int varFlags;
9630 if (!ctx.
Read(varFlags))
9631 return;
9632
9633 if (varFlags & ItemVariableFlags.FLOAT)
9634 {
9636 }
9637 }
9638
9640 {
9641
9642 super.SerializeNumericalVars(floats_out);
9643
9644
9645
9647 {
9649 }
9650
9652 {
9654 }
9655
9657 {
9659 }
9660
9662 {
9667 }
9668
9670 {
9672 }
9673 }
9674
9676 {
9677
9678 super.DeSerializeNumericalVars(floats);
9679
9680
9681 int index = 0;
9682 int mask = Math.Round(floats.Get(index));
9683
9684 index++;
9685
9687 {
9689 {
9691 }
9692 else
9693 {
9694 float quantity = floats.Get(index);
9696 }
9697 index++;
9698 }
9699
9701 {
9702 float wet = floats.Get(index);
9704 index++;
9705 }
9706
9708 {
9709 int liquidtype = Math.Round(floats.Get(index));
9711 index++;
9712 }
9713
9715 {
9717 index++;
9719 index++;
9721 index++;
9723 index++;
9724 }
9725
9727 {
9728 int cleanness = Math.Round(floats.Get(index));
9730 index++;
9731 }
9732 }
9733
9735 {
9736 super.WriteVarsToCTX(ctx);
9737
9738
9740 {
9742 }
9743
9745 {
9747 }
9748
9750 {
9752 }
9753
9755 {
9756 int r,g,b,a;
9762 }
9763
9765 {
9767 }
9768 }
9769
9771 {
9772 if (!super.ReadVarsFromCTX(ctx,version))
9773 return false;
9774
9775 int intValue;
9776 float value;
9777
9778 if (version < 140)
9779 {
9780 if (!ctx.
Read(intValue))
9781 return false;
9782
9783 m_VariablesMask = intValue;
9784 }
9785
9787 {
9788 if (!ctx.
Read(value))
9789 return false;
9790
9792 {
9794 }
9795 else
9796 {
9798 }
9799 }
9800
9801 if (version < 140)
9802 {
9804 {
9805 if (!ctx.
Read(value))
9806 return false;
9807 SetTemperatureDirect(value);
9808 }
9809 }
9810
9812 {
9813 if (!ctx.
Read(value))
9814 return false;
9816 }
9817
9819 {
9820 if (!ctx.
Read(intValue))
9821 return false;
9823 }
9824
9826 {
9827 int r,g,b,a;
9829 return false;
9831 return false;
9833 return false;
9835 return false;
9836
9838 }
9839
9841 {
9842 if (!ctx.
Read(intValue))
9843 return false;
9845 }
9846
9847 if (version >= 138 && version < 140)
9848 {
9850 {
9851 if (!ctx.
Read(intValue))
9852 return false;
9853 SetFrozen(intValue);
9854 }
9855 }
9856
9857 return true;
9858 }
9859
9860
9862 {
9865 {
9867 }
9868
9869 if (!super.OnStoreLoad(ctx, version))
9870 {
9872 return false;
9873 }
9874
9875 if (version >= 114)
9876 {
9877 bool hasQuickBarIndexSaved;
9878
9879 if (!ctx.
Read(hasQuickBarIndexSaved))
9880 {
9882 return false;
9883 }
9884
9885 if (hasQuickBarIndexSaved)
9886 {
9887 int itmQBIndex;
9888
9889
9890 if (!ctx.
Read(itmQBIndex))
9891 {
9893 return false;
9894 }
9895
9896 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9897 if (itmQBIndex != -1 && parentPlayer)
9898 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9899 }
9900 }
9901 else
9902 {
9903
9904 PlayerBase player;
9905 int itemQBIndex;
9906 if (version ==
int.
MAX)
9907 {
9908 if (!ctx.
Read(itemQBIndex))
9909 {
9911 return false;
9912 }
9913 }
9914 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9915 {
9916
9917 if (!ctx.
Read(itemQBIndex))
9918 {
9920 return false;
9921 }
9922 if (itemQBIndex != -1 && player)
9923 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9924 }
9925 }
9926
9927 if (version < 140)
9928 {
9929
9930 if (!LoadVariables(ctx, version))
9931 {
9933 return false;
9934 }
9935 }
9936
9937
9939 {
9941 return false;
9942 }
9943 if (version >= 132)
9944 {
9946 if (raib)
9947 {
9949 {
9951 return false;
9952 }
9953 }
9954 }
9955
9957 return true;
9958 }
9959
9960
9961
9963 {
9964 super.OnStoreSave(ctx);
9965
9966 PlayerBase player;
9967 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9968 {
9970
9971 int itemQBIndex = -1;
9972 itemQBIndex = player.FindQuickBarEntityIndex(this);
9973 ctx.
Write(itemQBIndex);
9974 }
9975 else
9976 {
9978 }
9979
9981
9983 if (raib)
9984 {
9986 }
9987 }
9988
9989
9991 {
9992 super.AfterStoreLoad();
9993
9995 {
9997 }
9998
10000 {
10003 }
10004 }
10005
10007 {
10008 super.EEOnAfterLoad();
10009
10011 {
10013 }
10014
10017 }
10018
10020 {
10021 return false;
10022 }
10023
10024
10025
10027 {
10029 {
10030 #ifdef PLATFORM_CONSOLE
10031
10033 {
10035 if (menu)
10036 {
10038 }
10039 }
10040 #endif
10041 }
10042
10044 {
10047 }
10048
10050 {
10051 SetWeightDirty();
10053 }
10055 {
10058 }
10059
10061 {
10064 }
10066 {
10069 }
10070
10071 super.OnVariablesSynchronized();
10072 }
10073
10074
10075
10077 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10078 {
10079 if (!IsServerCheck(allow_client))
10080 return false;
10081
10083 return false;
10084
10087
10088 if (value <= (min + 0.001))
10089 value = min;
10090
10091 if (value == min)
10092 {
10093 if (destroy_config)
10094 {
10095 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10096 if (dstr)
10097 {
10099 this.Delete();
10100 return true;
10101 }
10102 }
10103 else if (destroy_forced)
10104 {
10106 this.Delete();
10107 return true;
10108 }
10109
10111 }
10112
10115
10117 {
10119
10120 if (delta)
10122 }
10123
10125
10126 return false;
10127 }
10128
10129
10131 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10132 {
10134 }
10135
10137 {
10140 }
10141
10143 {
10146 }
10147
10149 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10150 {
10151 float value_clamped = Math.Clamp(value, 0, 1);
10153 SetQuantity(result, destroy_config, destroy_forced);
10154 }
10155
10156
10159 {
10161 }
10162
10164 {
10166 }
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10178 {
10179 int slot = -1;
10180 if (GetInventory())
10181 {
10182 InventoryLocation il = new InventoryLocation;
10183 GetInventory().GetCurrentInventoryLocation(il);
10185 }
10186
10188 }
10189
10191 {
10192 float quantity_max = 0;
10193
10195 {
10196 if (attSlotID != -1)
10197 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10198
10199 if (quantity_max <= 0)
10201 }
10202
10203 if (quantity_max <= 0)
10205
10206 return quantity_max;
10207 }
10208
10210 {
10212 }
10213
10215 {
10217 }
10218
10219
10221 {
10223 }
10224
10226 {
10228 }
10229
10231 {
10233 }
10234
10235
10237 {
10238
10239 float weightEx = GetWeightEx();
10240 float special = GetInventoryAndCargoWeight();
10241 return weightEx - special;
10242 }
10243
10244
10246 {
10248 }
10249
10251 {
10253 {
10254 #ifdef DEVELOPER
10255 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10256 {
10257 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10259 }
10260 #endif
10261
10262 return GetQuantity() * GetConfigWeightModified();
10263 }
10264 else if (HasEnergyManager())
10265 {
10266 #ifdef DEVELOPER
10267 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10268 {
10269 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10270 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10271 }
10272 #endif
10273 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10274 }
10275 else
10276 {
10277 #ifdef DEVELOPER
10278 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10279 {
10280 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10281 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10282 }
10283 #endif
10284 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10285 }
10286 }
10287
10290 {
10291 int item_count = 0;
10293
10294 if (GetInventory().GetCargo() != NULL)
10295 {
10296 item_count = GetInventory().GetCargo().GetItemCount();
10297 }
10298
10299 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10300 {
10301 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10302 if (item)
10303 item_count += item.GetNumberOfItems();
10304 }
10305 return item_count;
10306 }
10307
10310 {
10311 float weight = 0;
10312 float wetness = 1;
10313 if (include_wetness)
10316 {
10317 weight = wetness * m_ConfigWeight;
10318 }
10320 {
10321 weight = 1;
10322 }
10323 return weight;
10324 }
10325
10326
10327
10329 {
10330 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10331 {
10332 GameInventory inv = GetInventory();
10333 array<EntityAI> items = new array<EntityAI>;
10335 for (int i = 0; i < items.Count(); i++)
10336 {
10338 if (item)
10339 {
10341 }
10342 }
10343 }
10344 }
10345
10346
10347
10348
10350 {
10351 float energy = 0;
10352 if (HasEnergyManager())
10353 {
10354 energy = GetCompEM().GetEnergy();
10355 }
10356 return energy;
10357 }
10358
10359
10361 {
10362 super.OnEnergyConsumed();
10363
10365 }
10366
10368 {
10369 super.OnEnergyAdded();
10370
10372 }
10373
10374
10376 {
10377 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10378 {
10380 {
10381 float energy_0to1 = GetCompEM().GetEnergy0To1();
10383 }
10384 }
10385 }
10386
10387
10389 {
10390 return ConfigGetFloat("heatIsolation");
10391 }
10392
10394 {
10396 }
10397
10399 {
10400 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10401 if (
GetGame().ConfigIsExisting(paramPath))
10403
10404 return 0.0;
10405 }
10406
10408 {
10409 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10410 if (
GetGame().ConfigIsExisting(paramPath))
10412
10413 return 0.0;
10414 }
10415
10416 override void SetWet(
float value,
bool allow_client =
false)
10417 {
10418 if (!IsServerCheck(allow_client))
10419 return;
10420
10423
10425
10426 m_VarWet = Math.Clamp(value, min, max);
10427
10429 {
10432 }
10433 }
10434
10435 override void AddWet(
float value)
10436 {
10438 }
10439
10441 {
10443 }
10444
10446 {
10448 }
10449
10451 {
10453 }
10454
10456 {
10458 }
10459
10461 {
10463 }
10464
10465 override void OnWetChanged(
float newVal,
float oldVal)
10466 {
10469 if (newLevel != oldLevel)
10470 {
10472 }
10473 }
10474
10476 {
10477 SetWeightDirty();
10478 }
10479
10481 {
10482 return GetWetLevelInternal(
m_VarWet);
10483 }
10484
10485
10486
10488 {
10490 }
10491
10493 {
10495 }
10496
10498 {
10500 }
10501
10503 {
10505 }
10506
10507
10508
10510 {
10511 if (ConfigIsExisting("itemModelLength"))
10512 {
10513 return ConfigGetFloat("itemModelLength");
10514 }
10515 return 0;
10516 }
10517
10519 {
10520 if (ConfigIsExisting("itemAttachOffset"))
10521 {
10522 return ConfigGetFloat("itemAttachOffset");
10523 }
10524 return 0;
10525 }
10526
10527 override void SetCleanness(
int value,
bool allow_client =
false)
10528 {
10529 if (!IsServerCheck(allow_client))
10530 return;
10531
10533
10535
10538 }
10539
10541 {
10543 }
10544
10546 {
10547 return true;
10548 }
10549
10550
10551
10552
10554 {
10556 }
10557
10559 {
10561 }
10562
10563
10564
10565
10566 override void SetColor(
int r,
int g,
int b,
int a)
10567 {
10573 }
10575 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10576 {
10581 }
10582
10584 {
10586 }
10587
10590 {
10591 int r,g,b,a;
10593 r = r/255;
10594 g = g/255;
10595 b = b/255;
10596 a = a/255;
10597 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10598 }
10599
10600
10601
10602 override void SetLiquidType(
int value,
bool allow_client =
false)
10603 {
10604 if (!IsServerCheck(allow_client))
10605 return;
10606
10611 }
10612
10614 {
10615 return ConfigGetInt("varLiquidTypeInit");
10616 }
10617
10619 {
10621 }
10622
10624 {
10626 SetFrozen(false);
10627 }
10628
10631 {
10632 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10633 }
10634
10635
10638 {
10639 PlayerBase nplayer;
10640 if (PlayerBase.CastTo(nplayer, player))
10641 {
10643
10644 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10645 }
10646 }
10647
10648
10651 {
10652 PlayerBase nplayer;
10653 if (PlayerBase.CastTo(nplayer,player))
10654 {
10655
10656 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10657
10658 }
10659
10660
10661 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10662
10663
10664 if (HasEnergyManager())
10665 {
10666 GetCompEM().UpdatePlugState();
10667 }
10668 }
10669
10670
10672 {
10673 super.OnPlacementStarted(player);
10674
10676 }
10677
10678 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10679 {
10681 {
10682 m_AdminLog.OnPlacementComplete(player,
this);
10683 }
10684
10685 super.OnPlacementComplete(player, position, orientation);
10686 }
10687
10688
10689
10690
10691
10693 {
10695 {
10696 return true;
10697 }
10698 else
10699 {
10700 return false;
10701 }
10702 }
10703
10704
10706 {
10708 {
10710 }
10711 }
10712
10713
10715 {
10717 }
10718
10720 {
10722 }
10723
10724 override void InsertAgent(
int agent,
float count = 1)
10725 {
10726 if (count < 1)
10727 return;
10728
10730 }
10731
10734 {
10736 }
10737
10738
10740 {
10742 }
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10786 {
10788 return false;
10789 return true;
10790 }
10791
10793 {
10794
10796 }
10797
10798
10801 {
10802 super.CheckForRoofLimited(timeTresholdMS);
10803
10805 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10806 {
10807 m_PreviousRoofTestTime = time;
10808 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10809 }
10810 }
10811
10812
10814 {
10816 {
10817 return 0;
10818 }
10819
10820 if (GetInventory().GetAttachmentSlotsCount() != 0)
10821 {
10822 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10823 if (filter)
10824 return filter.GetProtectionLevel(type, false, system);
10825 else
10826 return 0;
10827 }
10828
10829 string subclassPath, entryName;
10830
10831 switch (type)
10832 {
10834 entryName = "biological";
10835 break;
10837 entryName = "chemical";
10838 break;
10839 default:
10840 entryName = "biological";
10841 break;
10842 }
10843
10844 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10845
10847 }
10848
10849
10850
10853 {
10854 if (!IsMagazine())
10856
10858 }
10859
10860
10861
10862
10863
10868 {
10869 return true;
10870 }
10871
10873 {
10875 }
10876
10877
10878
10879
10880
10882 {
10883 if (parent)
10884 {
10885 if (parent.IsInherited(DayZInfected))
10886 return true;
10887
10888 if (!parent.IsRuined())
10889 return true;
10890 }
10891
10892 return true;
10893 }
10894
10896 {
10897 if (!super.CanPutAsAttachment(parent))
10898 {
10899 return false;
10900 }
10901
10902 if (!IsRuined() && !parent.IsRuined())
10903 {
10904 return true;
10905 }
10906
10907 return false;
10908 }
10909
10911 {
10912
10913
10914
10915
10916 return super.CanReceiveItemIntoCargo(item);
10917 }
10918
10920 {
10921
10922
10923
10924
10925 GameInventory attachmentInv = attachment.GetInventory();
10927 {
10928 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10929 return false;
10930 }
10931
10932 InventoryLocation loc = new InventoryLocation();
10933 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10934 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10935 return false;
10936
10937 return super.CanReceiveAttachment(attachment, slotId);
10938 }
10939
10941 {
10942 if (!super.CanReleaseAttachment(attachment))
10943 return false;
10944
10945 return GetInventory().AreChildrenAccessible();
10946 }
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10969 {
10970 int id = muzzle_owner.GetMuzzleID();
10971 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10972
10973 if (WPOF_array)
10974 {
10975 for (int i = 0; i < WPOF_array.Count(); i++)
10976 {
10977 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10978
10979 if (WPOF)
10980 {
10981 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10982 }
10983 }
10984 }
10985 }
10986
10987
10989 {
10990 int id = muzzle_owner.GetMuzzleID();
10992
10993 if (WPOBE_array)
10994 {
10995 for (int i = 0; i < WPOBE_array.Count(); i++)
10996 {
10997 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10998
10999 if (WPOBE)
11000 {
11001 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11002 }
11003 }
11004 }
11005 }
11006
11007
11009 {
11010 int id = muzzle_owner.GetMuzzleID();
11011 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11012
11013 if (WPOOH_array)
11014 {
11015 for (int i = 0; i < WPOOH_array.Count(); i++)
11016 {
11017 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11018
11019 if (WPOOH)
11020 {
11021 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11022 }
11023 }
11024 }
11025 }
11026
11027
11029 {
11030 int id = muzzle_owner.GetMuzzleID();
11031 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11032
11033 if (WPOOH_array)
11034 {
11035 for (int i = 0; i < WPOOH_array.Count(); i++)
11036 {
11037 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11038
11039 if (WPOOH)
11040 {
11041 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11042 }
11043 }
11044 }
11045 }
11046
11047
11049 {
11050 int id = muzzle_owner.GetMuzzleID();
11051 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11052
11053 if (WPOOH_array)
11054 {
11055 for (int i = 0; i < WPOOH_array.Count(); i++)
11056 {
11057 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11058
11059 if (WPOOH)
11060 {
11061 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11062 }
11063 }
11064 }
11065 }
11066
11067
11068
11070 {
11072 {
11073 return true;
11074 }
11075
11076 return false;
11077 }
11078
11080 {
11082 {
11083 return true;
11084 }
11085
11086 return false;
11087 }
11088
11090 {
11092 {
11093 return true;
11094 }
11095
11096 return false;
11097 }
11098
11100 {
11101 return false;
11102 }
11103
11106 {
11107 return UATimeSpent.DEFAULT_DEPLOY;
11108 }
11109
11110
11111
11112
11114 {
11116 SetSynchDirty();
11117 }
11118
11120 {
11122 }
11123
11124
11126 {
11127 return false;
11128 }
11129
11132 {
11133 string att_type = "None";
11134
11135 if (ConfigIsExisting("soundAttType"))
11136 {
11137 att_type = ConfigGetString("soundAttType");
11138 }
11139
11141 }
11142
11144 {
11146 }
11147
11148
11149
11150
11151
11157
11159 {
11162
11164 }
11165
11166
11168 {
11170 return;
11171
11173
11176
11179
11180 SoundParameters params = new SoundParameters();
11184 }
11185
11186
11188 {
11190 return;
11191
11193 SetSynchDirty();
11194
11197 }
11198
11199
11201 {
11203 return;
11204
11206 SetSynchDirty();
11207
11210 }
11211
11213 {
11215 }
11216
11218 {
11220 }
11221
11224 {
11225 if (!
GetGame().IsDedicatedServer())
11226 {
11227 if (ConfigIsExisting("attachSoundSet"))
11228 {
11229 string cfg_path = "";
11230 string soundset = "";
11231 string type_name =
GetType();
11232
11235 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11236 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11237
11238 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11239 {
11240 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11241 {
11242 if (cfg_slot_array[i] == slot_type)
11243 {
11244 soundset = cfg_soundset_array[i];
11245 break;
11246 }
11247 }
11248 }
11249
11250 if (soundset != "")
11251 {
11252 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11254 }
11255 }
11256 }
11257 }
11258
11260 {
11261
11262 }
11263
11264 void OnApply(PlayerBase player);
11265
11267 {
11268 return 1.0;
11269 };
11270
11272 {
11274 }
11275
11277 {
11279 }
11280
11282
11284 {
11285 SetDynamicPhysicsLifeTime(0.01);
11287 }
11288
11290 {
11291 array<string> zone_names = new array<string>;
11292 GetDamageZones(zone_names);
11293 for (int i = 0; i < zone_names.Count(); i++)
11294 {
11295 SetHealthMax(zone_names.Get(i),"Health");
11296 }
11297 SetHealthMax("","Health");
11298 }
11299
11302 {
11303 float global_health = GetHealth01("","Health");
11304 array<string> zones = new array<string>;
11305 GetDamageZones(zones);
11306
11307 for (int i = 0; i < zones.Count(); i++)
11308 {
11309 SetHealth01(zones.Get(i),"Health",global_health);
11310 }
11311 }
11312
11315 {
11316 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11317 }
11318
11320 {
11321 if (!hasRootAsPlayer)
11322 {
11323 if (refParentIB)
11324 {
11325
11326 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11327 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11328
11329 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11330 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11331
11334 }
11335 else
11336 {
11337
11340 }
11341 }
11342 }
11343
11345 {
11347 {
11348 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11349 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11350 {
11351 float heatPermCoef = 1.0;
11353 while (ent)
11354 {
11355 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11356 ent = ent.GetHierarchyParent();
11357 }
11358
11359 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11360 }
11361 }
11362 }
11363
11365 {
11366
11367 EntityAI parent = GetHierarchyParent();
11368 if (!parent)
11369 {
11370 hasParent = false;
11371 hasRootAsPlayer = false;
11372 }
11373 else
11374 {
11375 hasParent = true;
11376 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11377 refParentIB =
ItemBase.Cast(parent);
11378 }
11379 }
11380
11381 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11382 {
11383
11384 }
11385
11387 {
11388
11389 return false;
11390 }
11391
11393 {
11394
11395
11396 return false;
11397 }
11398
11400 {
11401
11402 return false;
11403 }
11404
11407 {
11408 return !GetIsFrozen() &&
IsOpen();
11409 }
11410
11412 {
11413 bool hasParent = false, hasRootAsPlayer = false;
11415
11416 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11417 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11418
11419 if (wwtu || foodDecay)
11420 {
11424
11425 if (processWetness || processTemperature || processDecay)
11426 {
11428
11429 if (processWetness)
11430 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11431
11432 if (processTemperature)
11434
11435 if (processDecay)
11436 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11437 }
11438 }
11439 }
11440
11443 {
11445 }
11446
11448 {
11451
11452 return super.GetTemperatureFreezeThreshold();
11453 }
11454
11456 {
11459
11460 return super.GetTemperatureThawThreshold();
11461 }
11462
11464 {
11467
11468 return super.GetItemOverheatThreshold();
11469 }
11470
11472 {
11474 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11475
11476 return super.GetTemperatureFreezeTime();
11477 }
11478
11480 {
11482 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11483
11484 return super.GetTemperatureThawTime();
11485 }
11486
11491
11493 {
11494 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11495 }
11496
11498 {
11499 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11500 }
11501
11504 {
11506 }
11507
11509 {
11511 }
11512
11514 {
11516 }
11517
11520 {
11521 return null;
11522 }
11523
11526 {
11527 return false;
11528 }
11529
11531 {
11533 {
11536 if (!trg)
11537 {
11539 explosive = this;
11540 }
11541
11542 explosive.PairRemote(trg);
11544
11545 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11546 trg.SetPersistentPairID(persistentID);
11547 explosive.SetPersistentPairID(persistentID);
11548
11549 return true;
11550 }
11551 return false;
11552 }
11553
11556 {
11557 float ret = 1.0;
11560 ret *= GetHealth01();
11561
11562 return ret;
11563 }
11564
11565 #ifdef DEVELOPER
11566 override void SetDebugItem()
11567 {
11568 super.SetDebugItem();
11569 _itemBase = this;
11570 }
11571
11573 {
11574 string text = super.GetDebugText();
11575
11577 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11578
11579 return text;
11580 }
11581 #endif
11582
11584 {
11585 return true;
11586 }
11587
11589
11591
11593 {
11596 }
11597
11598
11606
11622}
11623
11625{
11627 if (entity)
11628 {
11629 bool is_item = entity.IsInherited(
ItemBase);
11630 if (is_item && full_quantity)
11631 {
11634 }
11635 }
11636 else
11637 {
11639 return NULL;
11640 }
11641 return entity;
11642}
11643
11645{
11646 if (item)
11647 {
11648 if (health > 0)
11649 item.SetHealth("", "", health);
11650
11651 if (item.CanHaveTemperature())
11652 {
11654 if (item.CanFreeze())
11655 item.SetFrozen(false);
11656 }
11657
11658 if (item.HasEnergyManager())
11659 {
11660 if (quantity >= 0)
11661 {
11662 item.GetCompEM().SetEnergy0To1(quantity);
11663 }
11664 else
11665 {
11667 }
11668 }
11669 else if (item.IsMagazine())
11670 {
11671 Magazine mag = Magazine.Cast(item);
11672 if (quantity >= 0)
11673 {
11674 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11675 }
11676 else
11677 {
11679 }
11680
11681 }
11682 else
11683 {
11684 if (quantity >= 0)
11685 {
11686 item.SetQuantityNormalized(quantity, false);
11687 }
11688 else
11689 {
11691 }
11692
11693 }
11694 }
11695}
11696
11697#ifdef DEVELOPER
11699#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.