6684{
6686 {
6687 return true;
6688 }
6689};
6690
6691
6692
6694{
6698
6700
6703
6704
6705
6706
6707
6716
6722
6727
6732
6753 protected bool m_IsResultOfSplit
6754
6756
6761
6762
6763
6765
6769
6770
6771
6773
6776
6777
6778
6784
6785
6793
6796
6797
6799
6800
6802
6803
6808
6809
6814
6815
6817
6818
6820 {
6825
6826 if (!
GetGame().IsDedicatedServer())
6827 {
6829 {
6831
6833 {
6835 }
6836 }
6837
6840 }
6841
6842 m_OldLocation = null;
6843
6845 {
6847 }
6848
6849 if (ConfigIsExisting("headSelectionsToHide"))
6850 {
6853 }
6854
6856 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6857 {
6859 }
6860
6862
6863 m_IsResultOfSplit = false;
6864
6866 }
6867
6869 {
6870 super.InitItemVariables();
6871
6877 m_Count = ConfigGetInt(
"count");
6878
6881
6886
6889
6894
6906
6910
6911
6914 if (ConfigIsExisting("canBeSplit"))
6915 {
6918 }
6919
6921 if (ConfigIsExisting("itemBehaviour"))
6923
6924
6927 RegisterNetSyncVariableInt("m_VarLiquidType");
6928 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6929
6930 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6931 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6932 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6933
6934 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6935 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6936 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6937 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6938
6939 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6940 RegisterNetSyncVariableBool("m_IsTakeable");
6941 RegisterNetSyncVariableBool("m_IsHologram");
6942
6945 {
6948 }
6949
6951
6953 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6955
6956 }
6957
6959 {
6961 }
6962
6964 {
6967 {
6972 }
6973 }
6974
6975 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6976 {
6978 {
6981 }
6982
6984 }
6985
6987 {
6993 }
6994
6996
6998 {
7000
7001 if (!action)
7002 {
7003 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7004 return;
7005 }
7006
7008 if (!ai)
7009 {
7011 return;
7012 }
7013
7015 if (!action_array)
7016 {
7017 action_array = new array<ActionBase_Basic>;
7019 }
7020 if (LogManager.IsActionLogEnable())
7021 {
7022 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7023 }
7024
7025 if (action_array.Find(action) != -1)
7026 {
7027 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7028 }
7029 else
7030 {
7031 action_array.Insert(action);
7032 }
7033 }
7034
7036 {
7038 ActionBase action = player.GetActionManager().GetAction(actionName);
7041
7042 if (action_array)
7043 {
7044 action_array.RemoveItem(action);
7045 }
7046 }
7047
7048
7049
7051 {
7052 ActionOverrideData overrideData = new ActionOverrideData();
7056
7058 if (!actionMap)
7059 {
7062 }
7063
7064 actionMap.Insert(this.
Type(), overrideData);
7065
7066 }
7067
7069
7071
7072
7074 {
7077
7080
7081 string config_to_search = "CfgVehicles";
7082 string muzzle_owner_config;
7083
7085 {
7086 if (IsInherited(Weapon))
7087 config_to_search = "CfgWeapons";
7088
7089 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7090
7091 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7092
7094
7095 if (config_OnFire_subclass_count > 0)
7096 {
7097 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7098
7099 for (int i = 0; i < config_OnFire_subclass_count; i++)
7100 {
7101 string particle_class = "";
7103 string config_OnFire_entry = config_OnFire_class + particle_class;
7104 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7105 WPOF_array.Insert(WPOF);
7106 }
7107
7108
7110 }
7111 }
7112
7114 {
7115 config_to_search = "CfgWeapons";
7116 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7117
7118 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7119
7121
7122 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7123 {
7124 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7125
7126 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7127 {
7128 string particle_class2 = "";
7130 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7131 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7132 WPOBE_array.Insert(WPOBE);
7133 }
7134
7135
7137 }
7138 }
7139 }
7140
7141
7143 {
7146
7148 {
7149 string config_to_search = "CfgVehicles";
7150
7151 if (IsInherited(Weapon))
7152 config_to_search = "CfgWeapons";
7153
7154 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7155 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7156
7157 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7158 {
7159
7161
7163 {
7165 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7167 return;
7168 }
7169
7172
7173
7174
7176 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7177
7178 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7179 {
7180 string particle_class = "";
7182 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7184
7185 if (entry_type == CT_CLASS)
7186 {
7187 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7188 WPOOH_array.Insert(WPOF);
7189 }
7190 }
7191
7192
7194 }
7195 }
7196 }
7197
7199 {
7201 }
7202
7204 {
7206 {
7208
7211
7214
7215 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7216 }
7217 }
7218
7220 {
7222 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7223
7225 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7226
7228 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7229
7231 {
7233 }
7234 }
7235
7237 {
7239 }
7240
7242 {
7245 else
7247
7249 {
7252 }
7253 else
7254 {
7257
7260 }
7261
7263 }
7264
7266 {
7268 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7269 }
7270
7272 {
7274 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7276 }
7277
7279 {
7281 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7282 }
7283
7285 {
7288
7289 OverheatingParticle OP = new OverheatingParticle();
7294
7296 }
7297
7299 {
7302
7303 return -1;
7304 }
7305
7307 {
7309 {
7312
7313 for (int i = count; i > 0; --i)
7314 {
7315 int id = i - 1;
7318
7321
7322 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7323 {
7324 if (p)
7325 {
7328 }
7329 }
7330 }
7331 }
7332 }
7333
7335 {
7337 {
7339 {
7340 int id = i - 1;
7342
7343 if (OP)
7344 {
7346
7347 if (p)
7348 {
7350 }
7351
7352 delete OP;
7353 }
7354 }
7355
7358 }
7359 }
7360
7363 {
7364 return 0.0;
7365 }
7366
7367
7369 {
7370 return 250;
7371 }
7372
7374 {
7375 return 0;
7376 }
7377
7380 {
7382 return true;
7383
7384 return false;
7385 }
7386
7389 {
7392
7394 {
7396 }
7397 else
7398 {
7399
7401 }
7402
7404 }
7405
7412 {
7413 return -1;
7414 }
7415
7416
7417
7418
7420 {
7422 {
7424 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7425
7426 if (r_index >= 0)
7427 {
7428 InventoryLocation r_il = new InventoryLocation;
7429 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7430
7431 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7434 {
7435 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7436 }
7438 {
7439 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7440 }
7441
7442 }
7443
7444 player.GetHumanInventory().ClearUserReservedLocation(this);
7445 }
7446
7449 }
7450
7451
7452
7453
7455 {
7456 return ItemBase.m_DebugActionsMask;
7457 }
7458
7460 {
7461 return ItemBase.m_DebugActionsMask & mask;
7462 }
7463
7465 {
7466 ItemBase.m_DebugActionsMask = mask;
7467 }
7468
7470 {
7471 ItemBase.m_DebugActionsMask |= mask;
7472 }
7473
7475 {
7476 ItemBase.m_DebugActionsMask &= ~mask;
7477 }
7478
7480 {
7482 {
7484 }
7485 else
7486 {
7488 }
7489 }
7490
7491
7493 {
7494 if (GetEconomyProfile())
7495 {
7496 float q_max = GetEconomyProfile().GetQuantityMax();
7497 if (q_max > 0)
7498 {
7499 float q_min = GetEconomyProfile().GetQuantityMin();
7500 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7501
7503 {
7504 ComponentEnergyManager comp = GetCompEM();
7506 {
7508 }
7509 }
7511 {
7513
7514 }
7515
7516 }
7517 }
7518 }
7519
7522 {
7523 EntityAI parent = GetHierarchyParent();
7524
7525 if (parent)
7526 {
7527 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7528 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7529 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7530 }
7531 }
7532
7535 {
7536 EntityAI parent = GetHierarchyParent();
7537
7538 if (parent)
7539 {
7540 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7541 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7542 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7543 }
7544 }
7545
7547 {
7548
7549
7550
7551
7553
7555 {
7556 if (ScriptInputUserData.CanStoreInputUserData())
7557 {
7558 ScriptInputUserData ctx = new ScriptInputUserData;
7564 ctx.
Write(use_stack_max);
7567
7569 {
7570 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7571 }
7572 }
7573 }
7574 else if (!
GetGame().IsMultiplayer())
7575 {
7577 }
7578 }
7579
7581 {
7583 }
7584
7586 {
7588 }
7589
7591 {
7593 }
7594
7596 {
7597
7598 return false;
7599 }
7600
7602 {
7603 return false;
7604 }
7605
7609 {
7610 return false;
7611 }
7612
7614 {
7615 return "";
7616 }
7617
7619
7621 {
7622 return false;
7623 }
7624
7626 {
7627 return true;
7628 }
7629
7630
7631
7633 {
7634 return true;
7635 }
7636
7638 {
7639 return true;
7640 }
7641
7643 {
7644 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7646 }
7647
7649 {
7651 }
7652
7654 {
7656 if (!is_being_placed)
7658 SetSynchDirty();
7659 }
7660
7661
7663
7665 {
7667 }
7668
7670 {
7672 }
7673
7675 {
7676 return 1;
7677 }
7678
7680 {
7681 return false;
7682 }
7683
7685 {
7687 SetSynchDirty();
7688 }
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7725 {
7726 super.OnMovedInsideCargo(container);
7727
7728 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7729 }
7730
7731 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7732 {
7733 super.EEItemLocationChanged(oldLoc,newLoc);
7734
7735 PlayerBase new_player = null;
7736 PlayerBase old_player = null;
7737
7738 if (newLoc.GetParent())
7739 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7740
7741 if (oldLoc.GetParent())
7742 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7743
7745 {
7746 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7747
7748 if (r_index >= 0)
7749 {
7750 InventoryLocation r_il = new InventoryLocation;
7751 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7752
7753 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7756 {
7757 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7758 }
7760 {
7761 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7762 }
7763
7764 }
7765 }
7766
7768 {
7769 if (new_player)
7770 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7771
7772 if (new_player == old_player)
7773 {
7774
7775 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7776 {
7778 {
7779 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7780 {
7781 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7782 }
7783 }
7784 else
7785 {
7786 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7787 }
7788 }
7789
7790 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7791 {
7792 int type = oldLoc.GetType();
7794 {
7795 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7796 }
7798 {
7799 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7800 }
7801 }
7802 if (!m_OldLocation)
7803 {
7804 m_OldLocation = new InventoryLocation;
7805 }
7806 m_OldLocation.Copy(oldLoc);
7807 }
7808 else
7809 {
7810 if (m_OldLocation)
7811 {
7812 m_OldLocation.Reset();
7813 }
7814 }
7815
7817 }
7818 else
7819 {
7820 if (new_player)
7821 {
7822 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7823 if (res_index >= 0)
7824 {
7825 InventoryLocation il = new InventoryLocation;
7826 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7828 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7831 {
7832 il.
GetParent().GetOnReleaseLock().Invoke(it);
7833 }
7835 {
7837 }
7838
7839 }
7840 }
7842 {
7843
7845 }
7846
7847 if (m_OldLocation)
7848 {
7849 m_OldLocation.Reset();
7850 }
7851 }
7852 }
7853
7854 override void EOnContact(IEntity other, Contact extra)
7855 {
7857 {
7858 int liquidType = -1;
7860 if (impactSpeed > 0.0)
7861 {
7863 #ifndef SERVER
7865 #else
7867 SetSynchDirty();
7868 #endif
7870 }
7871 }
7872
7873 #ifdef SERVER
7874 if (GetCompEM() && GetCompEM().IsPlugged())
7875 {
7876 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7877 GetCompEM().UnplugThis();
7878 }
7879 #endif
7880 }
7881
7883
7885 {
7887 }
7888
7890 {
7891
7892 }
7893
7895 {
7896 super.OnItemLocationChanged(old_owner, new_owner);
7897
7898 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7899 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7900
7901 if (!relatedPlayer && playerNew)
7902 relatedPlayer = playerNew;
7903
7904 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7905 {
7907 if (actionMgr)
7908 {
7909 ActionBase currentAction = actionMgr.GetRunningAction();
7910 if (currentAction)
7912 }
7913 }
7914
7915 Man ownerPlayerOld = null;
7916 Man ownerPlayerNew = null;
7917
7918 if (old_owner)
7919 {
7920 if (old_owner.
IsMan())
7921 {
7922 ownerPlayerOld = Man.Cast(old_owner);
7923 }
7924 else
7925 {
7926 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7927 }
7928 }
7929 else
7930 {
7932 {
7934
7935 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7936 {
7937 GetCompEM().UnplugThis();
7938 }
7939 }
7940 }
7941
7942 if (new_owner)
7943 {
7944 if (new_owner.
IsMan())
7945 {
7946 ownerPlayerNew = Man.Cast(new_owner);
7947 }
7948 else
7949 {
7950 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7951 }
7952 }
7953
7954 if (ownerPlayerOld != ownerPlayerNew)
7955 {
7956 if (ownerPlayerOld)
7957 {
7958 array<EntityAI> subItemsExit = new array<EntityAI>;
7960 for (int i = 0; i < subItemsExit.Count(); i++)
7961 {
7964 }
7965 }
7966
7967 if (ownerPlayerNew)
7968 {
7969 array<EntityAI> subItemsEnter = new array<EntityAI>;
7971 for (int j = 0; j < subItemsEnter.Count(); j++)
7972 {
7975 }
7976 }
7977 }
7978 else if (ownerPlayerNew != null)
7979 {
7980 PlayerBase nplayer;
7981 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7982 {
7983 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7985 for (int k = 0; k < subItemsUpdate.Count(); k++)
7986 {
7988 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7989 }
7990 }
7991 }
7992
7993 if (old_owner)
7994 old_owner.OnChildItemRemoved(this);
7995 if (new_owner)
7996 new_owner.OnChildItemReceived(this);
7997 }
7998
7999
8001 {
8002 super.EEDelete(parent);
8003 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8004 if (player)
8005 {
8007
8008 if (player.IsAlive())
8009 {
8010 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8011 if (r_index >= 0)
8012 {
8013 InventoryLocation r_il = new InventoryLocation;
8014 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8015
8016 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8019 {
8020 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8021 }
8023 {
8024 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8025 }
8026
8027 }
8028
8029 player.RemoveQuickBarEntityShortcut(this);
8030 }
8031 }
8032 }
8033
8035 {
8036 super.EEKilled(killer);
8037
8040 {
8041 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8042 {
8043 if (IsMagazine())
8044 {
8045 if (Magazine.Cast(this).GetAmmoCount() > 0)
8046 {
8048 }
8049 }
8050 else
8051 {
8053 }
8054 }
8055 }
8056 }
8057
8059 {
8060 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8061
8062 super.OnWasAttached(parent, slot_id);
8063
8066
8068 }
8069
8071 {
8072 super.OnWasDetached(parent, slot_id);
8073
8076 }
8077
8079 {
8080 int idx;
8083
8084 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8085 if (inventory_slots.Count() < 1)
8086 {
8087 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8088 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8089 }
8090 else
8091 {
8092 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8093 }
8094
8095 idx = inventory_slots.Find(slot);
8096 if (idx < 0)
8097 return "";
8098
8099 return attach_types.Get(idx);
8100 }
8101
8103 {
8104 int idx = -1;
8105 string slot;
8106
8109
8110 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8111 if (inventory_slots.Count() < 1)
8112 {
8113 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8114 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8115 }
8116 else
8117 {
8118 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8119 if (detach_types.Count() < 1)
8120 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8121 }
8122
8123 for (int i = 0; i < inventory_slots.Count(); i++)
8124 {
8125 slot = inventory_slots.Get(i);
8126 }
8127
8128 if (slot != "")
8129 {
8130 if (detach_types.Count() == 1)
8131 idx = 0;
8132 else
8133 idx = inventory_slots.Find(slot);
8134 }
8135 if (idx < 0)
8136 return "";
8137
8138 return detach_types.Get(idx);
8139 }
8140
8142 {
8143
8145
8146
8147 float min_time = 1;
8148 float max_time = 3;
8149 float delay = Math.RandomFloat(min_time, max_time);
8150
8151 explode_timer.Run(delay, this, "DoAmmoExplosion");
8152 }
8153
8155 {
8156 Magazine magazine = Magazine.Cast(this);
8157 int pop_sounds_count = 6;
8158 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8159
8160
8161 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8162 string sound_name = pop_sounds[ sound_idx ];
8164
8165
8166 magazine.ServerAddAmmoCount(-1);
8167
8168
8169 float min_temp_to_explode = 100;
8170
8171 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8172 {
8174 }
8175 }
8176
8177
8178 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8179 {
8180 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8181
8182 const int CHANCE_DAMAGE_CARGO = 4;
8183 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8184 const int CHANCE_DAMAGE_NOTHING = 2;
8185
8187 {
8188 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8189 int chances;
8190 int rnd;
8191
8192 if (GetInventory().GetCargo())
8193 {
8194 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8195 rnd = Math.RandomInt(0,chances);
8196
8197 if (rnd < CHANCE_DAMAGE_CARGO)
8198 {
8200 }
8201 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8202 {
8204 }
8205 }
8206 else
8207 {
8208 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8209 rnd = Math.RandomInt(0,chances);
8210
8211 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8212 {
8214 }
8215 }
8216 }
8217 }
8218
8220 {
8221 if (GetInventory().GetCargo())
8222 {
8223 int item_count = GetInventory().GetCargo().GetItemCount();
8224 if (item_count > 0)
8225 {
8226 int random_pick = Math.RandomInt(0, item_count);
8228 if (!item.IsExplosive())
8229 {
8230 item.AddHealth("","",damage);
8231 return true;
8232 }
8233 }
8234 }
8235 return false;
8236 }
8237
8239 {
8240 int attachment_count = GetInventory().AttachmentCount();
8241 if (attachment_count > 0)
8242 {
8243 int random_pick = Math.RandomInt(0, attachment_count);
8244 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8245 if (!attachment.IsExplosive())
8246 {
8247 attachment.AddHealth("","",damage);
8248 return true;
8249 }
8250 }
8251 return false;
8252 }
8253
8255 {
8257 }
8258
8260 {
8262 return GetInventory().CanRemoveEntity();
8263
8264 return false;
8265 }
8266
8268 {
8269
8271 return false;
8272
8273
8275 return false;
8276
8277
8278
8280 if (delta == 0)
8281 return false;
8282
8283
8284 return true;
8285 }
8286
8288 {
8290 {
8291 if (ScriptInputUserData.CanStoreInputUserData())
8292 {
8293 ScriptInputUserData ctx = new ScriptInputUserData;
8298 ctx.
Write(destination_entity);
8302 }
8303 }
8304 else if (!
GetGame().IsMultiplayer())
8305 {
8307 }
8308 }
8309
8311 {
8312 float split_quantity_new;
8316 InventoryLocation loc = new InventoryLocation;
8317
8318 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8319 {
8321 split_quantity_new = stack_max;
8322 else
8324
8326 {
8327 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8328 if (new_item)
8329 {
8330 new_item.SetResultOfSplit(true);
8331 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8333 new_item.
SetQuantity(split_quantity_new,
false,
true);
8334 }
8335 }
8336 }
8337 else if (destination_entity && slot_id == -1)
8338 {
8339 if (quantity > stack_max)
8340 split_quantity_new = stack_max;
8341 else
8342 split_quantity_new = quantity;
8343
8345 {
8347 {
8350 }
8351
8352 if (new_item)
8353 {
8354 new_item.SetResultOfSplit(true);
8355 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8357 new_item.
SetQuantity(split_quantity_new,
false,
true);
8358 }
8359 }
8360 }
8361 else
8362 {
8363 if (stack_max != 0)
8364 {
8366 {
8368 }
8369
8370 if (split_quantity_new == 0)
8371 {
8372 if (!
GetGame().IsMultiplayer())
8373 player.PhysicalPredictiveDropItem(this);
8374 else
8375 player.ServerDropEntity(this);
8376 return;
8377 }
8378
8380 {
8382
8383 if (new_item)
8384 {
8385 new_item.SetResultOfSplit(true);
8386 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8389 new_item.PlaceOnSurface();
8390 }
8391 }
8392 }
8393 }
8394 }
8395
8397 {
8398 float split_quantity_new;
8402 InventoryLocation loc = new InventoryLocation;
8403
8404 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8405 {
8407 split_quantity_new = stack_max;
8408 else
8410
8412 {
8413 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8414 if (new_item)
8415 {
8416 new_item.SetResultOfSplit(true);
8417 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8419 new_item.
SetQuantity(split_quantity_new,
false,
true);
8420 }
8421 }
8422 }
8423 else if (destination_entity && slot_id == -1)
8424 {
8425 if (quantity > stack_max)
8426 split_quantity_new = stack_max;
8427 else
8428 split_quantity_new = quantity;
8429
8431 {
8433 {
8436 }
8437
8438 if (new_item)
8439 {
8440 new_item.SetResultOfSplit(true);
8441 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8443 new_item.
SetQuantity(split_quantity_new,
false,
true);
8444 }
8445 }
8446 }
8447 else
8448 {
8449 if (stack_max != 0)
8450 {
8452 {
8454 }
8455
8457 {
8459
8460 if (new_item)
8461 {
8462 new_item.SetResultOfSplit(true);
8463 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8466 new_item.PlaceOnSurface();
8467 }
8468 }
8469 }
8470 }
8471 }
8472
8474 {
8476 {
8477 if (ScriptInputUserData.CanStoreInputUserData())
8478 {
8479 ScriptInputUserData ctx = new ScriptInputUserData;
8484 dst.WriteToContext(ctx);
8486 }
8487 }
8488 else if (!
GetGame().IsMultiplayer())
8489 {
8491 }
8492 }
8493
8495 {
8497 {
8498 if (ScriptInputUserData.CanStoreInputUserData())
8499 {
8500 ScriptInputUserData ctx = new ScriptInputUserData;
8505 ctx.
Write(destination_entity);
8511 }
8512 }
8513 else if (!
GetGame().IsMultiplayer())
8514 {
8516 }
8517 }
8518
8520 {
8522 }
8523
8525 {
8527 float split_quantity_new;
8529 if (dst.IsValid())
8530 {
8531 int slot_id = dst.GetSlot();
8533
8534 if (quantity > stack_max)
8535 split_quantity_new = stack_max;
8536 else
8537 split_quantity_new = quantity;
8538
8540 {
8542
8543 if (new_item)
8544 {
8545 new_item.SetResultOfSplit(true);
8546 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8548 new_item.
SetQuantity(split_quantity_new,
false,
true);
8549 }
8550
8551 return new_item;
8552 }
8553 }
8554
8555 return null;
8556 }
8557
8559 {
8561 float split_quantity_new;
8563 if (destination_entity)
8564 {
8566 if (quantity > stackable)
8567 split_quantity_new = stackable;
8568 else
8569 split_quantity_new = quantity;
8570
8572 {
8573 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8574 if (new_item)
8575 {
8576 new_item.SetResultOfSplit(true);
8577 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8579 new_item.
SetQuantity(split_quantity_new,
false,
true);
8580 }
8581 }
8582 }
8583 }
8584
8586 {
8588 {
8589 if (ScriptInputUserData.CanStoreInputUserData())
8590 {
8591 ScriptInputUserData ctx = new ScriptInputUserData;
8596 ItemBase destination_entity =
this;
8597 ctx.
Write(destination_entity);
8601 }
8602 }
8603 else if (!
GetGame().IsMultiplayer())
8604 {
8606 }
8607 }
8608
8610 {
8612 float split_quantity_new;
8614 if (player)
8615 {
8617 if (quantity > stackable)
8618 split_quantity_new = stackable;
8619 else
8620 split_quantity_new = quantity;
8621
8623 {
8624 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8625 new_item =
ItemBase.Cast(in_hands);
8626 if (new_item)
8627 {
8628 new_item.SetResultOfSplit(true);
8629 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8631 new_item.SetQuantity(split_quantity_new, false, true);
8632 }
8633 }
8634 }
8635 }
8636
8638 {
8640 float split_quantity_new = Math.Floor(quantity * 0.5);
8641
8643 return;
8644
8646
8647 if (new_item)
8648 {
8649 if (new_item.GetQuantityMax() < split_quantity_new)
8650 {
8651 split_quantity_new = new_item.GetQuantityMax();
8652 }
8653
8654 new_item.SetResultOfSplit(true);
8655 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8656
8658 {
8661 }
8662 else
8663 {
8665 new_item.
SetQuantity(split_quantity_new,
false,
true);
8666 }
8667 }
8668 }
8669
8671 {
8673 float split_quantity_new = Math.Floor(quantity / 2);
8674
8676 return;
8677
8678 InventoryLocation invloc = new InventoryLocation;
8680
8682 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8683
8684 if (new_item)
8685 {
8686 if (new_item.GetQuantityMax() < split_quantity_new)
8687 {
8688 split_quantity_new = new_item.GetQuantityMax();
8689 }
8691 {
8694 }
8695 else if (split_quantity_new > 1)
8696 {
8698 new_item.
SetQuantity(split_quantity_new,
false,
true);
8699 }
8700 }
8701 }
8702
8705 {
8706 SetWeightDirty();
8708
8709 if (parent)
8710 parent.OnAttachmentQuantityChangedEx(this, delta);
8711
8713 {
8715 {
8717 }
8719 {
8720 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8722 }
8723 }
8724
8725 }
8726
8729 {
8730
8731 }
8732
8735 {
8737 }
8738
8740 {
8741 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8742
8744 {
8745 if (newLevel == GameConstants.STATE_RUINED)
8746 {
8748 EntityAI parent = GetHierarchyParent();
8749 if (parent && parent.IsFireplace())
8750 {
8751 CargoBase cargo = GetInventory().GetCargo();
8752 if (cargo)
8753 {
8755 {
8757 }
8758 }
8759 }
8760 }
8761
8763 {
8764
8766 return;
8767 }
8768
8769 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8770 {
8772 }
8773 }
8774 }
8775
8776
8778 {
8779 super.OnRightClick();
8780
8782 {
8784 {
8785 if (ScriptInputUserData.CanStoreInputUserData())
8786 {
8787 EntityAI root = GetHierarchyRoot();
8788 Man playerOwner = GetHierarchyRootPlayer();
8789 InventoryLocation dst = new InventoryLocation;
8790
8791
8792 if (!playerOwner && root && root == this)
8793 {
8795 }
8796 else
8797 {
8798
8799 GetInventory().GetCurrentInventoryLocation(dst);
8801 {
8804 {
8806 }
8807 else
8808 {
8810
8811
8812 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8813 {
8815 }
8816 else
8817 {
8818 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8819 }
8820 }
8821 }
8822 }
8823
8824 ScriptInputUserData ctx = new ScriptInputUserData;
8832 }
8833 }
8834 else if (!
GetGame().IsMultiplayer())
8835 {
8837 }
8838 }
8839 }
8840
8842 {
8843 if (root)
8844 {
8845 vector m4[4];
8846 root.GetTransform(m4);
8847 dst.SetGround(this, m4);
8848 }
8849 else
8850 {
8851 GetInventory().GetCurrentInventoryLocation(dst);
8852 }
8853 }
8854
8855 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8856 {
8857
8858 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8859 return false;
8860
8861 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8862 return false;
8863
8864
8866 return false;
8867
8868
8869 Magazine mag = Magazine.Cast(this);
8870 if (mag)
8871 {
8872 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8873 return false;
8874
8875 if (stack_max_limit)
8876 {
8877 Magazine other_mag = Magazine.Cast(other_item);
8878 if (other_item)
8879 {
8880 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8881 return false;
8882 }
8883
8884 }
8885 }
8886 else
8887 {
8888
8890 return false;
8891
8893 return false;
8894 }
8895
8896 PlayerBase player = null;
8897 if (CastTo(player, GetHierarchyRootPlayer()))
8898 {
8899 if (player.GetInventory().HasAttachment(this))
8900 return false;
8901
8902 if (player.IsItemsToDelete())
8903 return false;
8904 }
8905
8906 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8907 return false;
8908
8909 int slotID;
8911 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8912 return false;
8913
8914 return true;
8915 }
8916
8918 {
8920 }
8921
8923 {
8924 return m_IsResultOfSplit;
8925 }
8926
8928 {
8929 m_IsResultOfSplit = value;
8930 }
8931
8933 {
8935 }
8936
8938 {
8939 float other_item_quantity = other_item.GetQuantity();
8940 float this_free_space;
8941
8943
8945
8946 if (other_item_quantity > this_free_space)
8947 {
8948 return this_free_space;
8949 }
8950 else
8951 {
8952 return other_item_quantity;
8953 }
8954 }
8955
8957 {
8959 }
8960
8962 {
8964 return;
8965
8966 if (!IsMagazine() && other_item)
8967 {
8969 if (quantity_used != 0)
8970 {
8971 float hp1 = GetHealth01("","");
8972 float hp2 = other_item.GetHealth01("","");
8973 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8974 hpResult = hpResult / (
GetQuantity() + quantity_used);
8975
8976 hpResult *= GetMaxHealth();
8977 Math.Round(hpResult);
8978 SetHealth("", "Health", hpResult);
8979
8981 other_item.AddQuantity(-quantity_used);
8982 }
8983 }
8985 }
8986
8988 {
8989 #ifdef SERVER
8990 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8991 GetHierarchyParent().IncreaseLifetimeUp();
8992 #endif
8993 };
8994
8996 {
8997 PlayerBase p = PlayerBase.Cast(player);
8998
8999 array<int> recipesIds = p.m_Recipes;
9000 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9001 if (moduleRecipesManager)
9002 {
9003 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9004 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9005 }
9006
9007 for (int i = 0;i < recipesIds.Count(); i++)
9008 {
9009 int key = recipesIds.Get(i);
9010 string recipeName = moduleRecipesManager.GetRecipeName(key);
9012 }
9013 }
9014
9015
9016 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9017 {
9018 super.GetDebugActions(outputList);
9019
9020
9026
9027
9032
9037
9038
9042
9043
9045 {
9049 }
9050
9053
9054
9058
9060
9061 InventoryLocation loc = new InventoryLocation();
9062 GetInventory().GetCurrentInventoryLocation(loc);
9064 {
9065 if (Gizmo_IsSupported())
9068 }
9069
9071 }
9072
9073
9074
9075
9077 {
9078 super.OnAction(action_id, player, ctx);
9079
9081 {
9082 switch (action_id)
9083 {
9086 return true;
9089 return true;
9090 }
9091 }
9092
9094 {
9095 switch (action_id)
9096 {
9098 Delete();
9099 return true;
9100 }
9101 }
9102
9103 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9104 {
9105 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9106 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9107 PlayerBase p = PlayerBase.Cast(player);
9108 if (
EActions.RECIPES_RANGE_START < 1000)
9109 {
9110 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9111 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9112 }
9113 }
9114 #ifndef SERVER
9115 else if (action_id ==
EActions.WATCH_PLAYER)
9116 {
9117 PluginDeveloper.SetDeveloperItemClientEx(player);
9118 }
9119 #endif
9121 {
9122 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9123 {
9124 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9125 OnDebugButtonPressServer(id + 1);
9126 }
9127
9128 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9129 {
9130 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9132 }
9133
9134 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9135 {
9136 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9138 }
9139
9140 else if (action_id ==
EActions.ADD_QUANTITY)
9141 {
9142 if (IsMagazine())
9143 {
9144 Magazine mag = Magazine.Cast(this);
9145 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9146 }
9147 else
9148 {
9150 }
9151
9152 if (m_EM)
9153 {
9154 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9155 }
9156
9157 }
9158
9159 else if (action_id ==
EActions.REMOVE_QUANTITY)
9160 {
9161 if (IsMagazine())
9162 {
9163 Magazine mag2 = Magazine.Cast(this);
9164 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9165 }
9166 else
9167 {
9169 }
9170 if (m_EM)
9171 {
9172 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9173 }
9174
9175 }
9176
9177 else if (action_id ==
EActions.SET_QUANTITY_0)
9178 {
9180
9181 if (m_EM)
9182 {
9183 m_EM.SetEnergy(0);
9184 }
9185 }
9186
9187 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9188 {
9190
9191 if (m_EM)
9192 {
9193 m_EM.SetEnergy(m_EM.GetEnergyMax());
9194 }
9195 }
9196
9197 else if (action_id ==
EActions.ADD_HEALTH)
9198 {
9199 AddHealth("","",GetMaxHealth("","Health")/5);
9200 }
9201 else if (action_id ==
EActions.REMOVE_HEALTH)
9202 {
9203 AddHealth("","",-GetMaxHealth("","Health")/5);
9204 }
9205 else if (action_id ==
EActions.DESTROY_HEALTH)
9206 {
9207 SetHealth01("","",0);
9208 }
9209 else if (action_id ==
EActions.WATCH_ITEM)
9210 {
9212 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9213 #ifdef DEVELOPER
9214 SetDebugDeveloper_item(this);
9215 #endif
9216 }
9217
9218 else if (action_id ==
EActions.ADD_TEMPERATURE)
9219 {
9220 AddTemperature(20);
9221
9222 }
9223
9224 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9225 {
9226 AddTemperature(-20);
9227
9228 }
9229
9230 else if (action_id ==
EActions.FLIP_FROZEN)
9231 {
9232 SetFrozen(!GetIsFrozen());
9233
9234 }
9235
9236 else if (action_id ==
EActions.ADD_WETNESS)
9237 {
9239
9240 }
9241
9242 else if (action_id ==
EActions.REMOVE_WETNESS)
9243 {
9245
9246 }
9247
9248 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9249 {
9252
9253
9254 }
9255
9256 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9257 {
9260 }
9261
9262 else if (action_id ==
EActions.MAKE_SPECIAL)
9263 {
9264 auto debugParams = DebugSpawnParams.WithPlayer(player);
9265 OnDebugSpawnEx(debugParams);
9266 }
9267
9268 }
9269
9270
9271 return false;
9272 }
9273
9274
9275
9276
9280
9283
9284
9285
9287 {
9288 return false;
9289 }
9290
9291
9293 {
9294 return true;
9295 }
9296
9297
9299 {
9300 return true;
9301 }
9302
9303
9304
9306 {
9307 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9309 }
9310
9313 {
9314 return null;
9315 }
9316
9318 {
9319 return false;
9320 }
9321
9323 {
9324 return false;
9325 }
9326
9330
9331
9333 {
9334 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9335 return module_repairing.CanRepair(this, item_repair_kit);
9336 }
9337
9338
9339 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9340 {
9341 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9342 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9343 }
9344
9345
9347 {
9348
9349
9350
9351
9352
9353
9354
9355
9356 return 1;
9357 }
9358
9359
9360
9362 {
9364 }
9365
9366
9367
9369 {
9371 }
9372
9373
9382 {
9383 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9384
9385 if (player)
9386 {
9387 player.MessageStatus(text);
9388 }
9389 }
9390
9391
9400 {
9401 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9402
9403 if (player)
9404 {
9405 player.MessageAction(text);
9406 }
9407 }
9408
9409
9418 {
9419 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9420
9421 if (player)
9422 {
9423 player.MessageFriendly(text);
9424 }
9425 }
9426
9427
9436 {
9437 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9438
9439 if (player)
9440 {
9441 player.MessageImportant(text);
9442 }
9443 }
9444
9446 {
9447 return true;
9448 }
9449
9450
9451 override bool KindOf(
string tag)
9452 {
9453 bool found = false;
9454 string item_name = this.
GetType();
9457
9458 int array_size = item_tag_array.Count();
9459 for (int i = 0; i < array_size; i++)
9460 {
9461 if (item_tag_array.Get(i) == tag)
9462 {
9463 found = true;
9464 break;
9465 }
9466 }
9467 return found;
9468 }
9469
9470
9472 {
9473
9474 super.OnRPC(sender, rpc_type,ctx);
9475
9476
9477 switch (rpc_type)
9478 {
9479 #ifndef SERVER
9480 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9481 Param2<bool, string> p = new Param2<bool, string>(false, "");
9482
9484 return;
9485
9486 bool play = p.param1;
9487 string soundSet = p.param2;
9488
9489 if (play)
9490 {
9492 {
9494 {
9496 }
9497 }
9498 else
9499 {
9501 }
9502 }
9503 else
9504 {
9506 }
9507
9508 break;
9509 #endif
9510
9511 }
9512
9514 {
9516 }
9517 }
9518
9519
9520
9521
9523 {
9524 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9525 return plugin.GetID(
name);
9526 }
9527
9529 {
9530 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9531 return plugin.GetName(id);
9532 }
9533
9536 {
9537
9538
9539 int varFlags;
9540 if (!ctx.
Read(varFlags))
9541 return;
9542
9543 if (varFlags & ItemVariableFlags.FLOAT)
9544 {
9546 }
9547 }
9548
9550 {
9551
9552 super.SerializeNumericalVars(floats_out);
9553
9554
9555
9557 {
9559 }
9560
9562 {
9564 }
9565
9567 {
9569 }
9570
9572 {
9577 }
9578
9580 {
9582 }
9583 }
9584
9586 {
9587
9588 super.DeSerializeNumericalVars(floats);
9589
9590
9591 int index = 0;
9592 int mask = Math.Round(floats.Get(index));
9593
9594 index++;
9595
9597 {
9599 {
9601 }
9602 else
9603 {
9604 float quantity = floats.Get(index);
9606 }
9607 index++;
9608 }
9609
9611 {
9612 float wet = floats.Get(index);
9614 index++;
9615 }
9616
9618 {
9619 int liquidtype = Math.Round(floats.Get(index));
9621 index++;
9622 }
9623
9625 {
9627 index++;
9629 index++;
9631 index++;
9633 index++;
9634 }
9635
9637 {
9638 int cleanness = Math.Round(floats.Get(index));
9640 index++;
9641 }
9642 }
9643
9645 {
9646 super.WriteVarsToCTX(ctx);
9647
9648
9650 {
9652 }
9653
9655 {
9657 }
9658
9660 {
9662 }
9663
9665 {
9666 int r,g,b,a;
9672 }
9673
9675 {
9677 }
9678 }
9679
9681 {
9682 if (!super.ReadVarsFromCTX(ctx,version))
9683 return false;
9684
9685 int intValue;
9686 float value;
9687
9688 if (version < 140)
9689 {
9690 if (!ctx.
Read(intValue))
9691 return false;
9692
9693 m_VariablesMask = intValue;
9694 }
9695
9697 {
9698 if (!ctx.
Read(value))
9699 return false;
9700
9702 {
9704 }
9705 else
9706 {
9708 }
9709 }
9710
9711 if (version < 140)
9712 {
9714 {
9715 if (!ctx.
Read(value))
9716 return false;
9717 SetTemperatureDirect(value);
9718 }
9719 }
9720
9722 {
9723 if (!ctx.
Read(value))
9724 return false;
9726 }
9727
9729 {
9730 if (!ctx.
Read(intValue))
9731 return false;
9733 }
9734
9736 {
9737 int r,g,b,a;
9739 return false;
9741 return false;
9743 return false;
9745 return false;
9746
9748 }
9749
9751 {
9752 if (!ctx.
Read(intValue))
9753 return false;
9755 }
9756
9757 if (version >= 138 && version < 140)
9758 {
9760 {
9761 if (!ctx.
Read(intValue))
9762 return false;
9763 SetFrozen(intValue);
9764 }
9765 }
9766
9767 return true;
9768 }
9769
9770
9772 {
9775 {
9777 }
9778
9779 if (!super.OnStoreLoad(ctx, version))
9780 {
9782 return false;
9783 }
9784
9785 if (version >= 114)
9786 {
9787 bool hasQuickBarIndexSaved;
9788
9789 if (!ctx.
Read(hasQuickBarIndexSaved))
9790 {
9792 return false;
9793 }
9794
9795 if (hasQuickBarIndexSaved)
9796 {
9797 int itmQBIndex;
9798
9799
9800 if (!ctx.
Read(itmQBIndex))
9801 {
9803 return false;
9804 }
9805
9806 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9807 if (itmQBIndex != -1 && parentPlayer)
9808 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9809 }
9810 }
9811 else
9812 {
9813
9814 PlayerBase player;
9815 int itemQBIndex;
9816 if (version ==
int.
MAX)
9817 {
9818 if (!ctx.
Read(itemQBIndex))
9819 {
9821 return false;
9822 }
9823 }
9824 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9825 {
9826
9827 if (!ctx.
Read(itemQBIndex))
9828 {
9830 return false;
9831 }
9832 if (itemQBIndex != -1 && player)
9833 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9834 }
9835 }
9836
9837 if (version < 140)
9838 {
9839
9840 if (!LoadVariables(ctx, version))
9841 {
9843 return false;
9844 }
9845 }
9846
9847
9849 {
9851 return false;
9852 }
9853 if (version >= 132)
9854 {
9856 if (raib)
9857 {
9859 {
9861 return false;
9862 }
9863 }
9864 }
9865
9867 return true;
9868 }
9869
9870
9871
9873 {
9874 super.OnStoreSave(ctx);
9875
9876 PlayerBase player;
9877 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9878 {
9880
9881 int itemQBIndex = -1;
9882 itemQBIndex = player.FindQuickBarEntityIndex(this);
9883 ctx.
Write(itemQBIndex);
9884 }
9885 else
9886 {
9888 }
9889
9891
9893 if (raib)
9894 {
9896 }
9897 }
9898
9899
9901 {
9902 super.AfterStoreLoad();
9903
9905 {
9907 }
9908
9910 {
9913 }
9914 }
9915
9917 {
9918 super.EEOnAfterLoad();
9919
9921 {
9923 }
9924
9927 }
9928
9930 {
9931 return false;
9932 }
9933
9934
9935
9937 {
9939 {
9940 #ifdef PLATFORM_CONSOLE
9941
9943 {
9945 if (menu)
9946 {
9948 }
9949 }
9950 #endif
9951 }
9952
9954 {
9957 }
9958
9960 {
9961 SetWeightDirty();
9963 }
9965 {
9968 }
9969
9971 {
9974 }
9976 {
9979 }
9980
9981 super.OnVariablesSynchronized();
9982 }
9983
9984
9985
9987 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9988 {
9989 if (!IsServerCheck(allow_client))
9990 return false;
9991
9993 return false;
9994
9997
9998 if (value <= (min + 0.001))
9999 value = min;
10000
10001 if (value == min)
10002 {
10003 if (destroy_config)
10004 {
10005 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10006 if (dstr)
10007 {
10009 this.Delete();
10010 return true;
10011 }
10012 }
10013 else if (destroy_forced)
10014 {
10016 this.Delete();
10017 return true;
10018 }
10019
10021 }
10022
10025
10027 {
10029
10030 if (delta)
10032 }
10033
10035
10036 return false;
10037 }
10038
10039
10041 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10042 {
10044 }
10045
10047 {
10050 }
10051
10053 {
10056 }
10057
10059 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10060 {
10061 float value_clamped = Math.Clamp(value, 0, 1);
10063 SetQuantity(result, destroy_config, destroy_forced);
10064 }
10065
10066
10069 {
10071 }
10072
10074 {
10076 }
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10088 {
10089 int slot = -1;
10090 if (GetInventory())
10091 {
10092 InventoryLocation il = new InventoryLocation;
10093 GetInventory().GetCurrentInventoryLocation(il);
10095 }
10096
10098 }
10099
10101 {
10102 float quantity_max = 0;
10103
10105 {
10106 if (attSlotID != -1)
10107 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10108
10109 if (quantity_max <= 0)
10111 }
10112
10113 if (quantity_max <= 0)
10115
10116 return quantity_max;
10117 }
10118
10120 {
10122 }
10123
10125 {
10127 }
10128
10129
10131 {
10133 }
10134
10136 {
10138 }
10139
10141 {
10143 }
10144
10145
10147 {
10148
10149 float weightEx = GetWeightEx();
10150 float special = GetInventoryAndCargoWeight();
10151 return weightEx - special;
10152 }
10153
10154
10156 {
10158 }
10159
10161 {
10163 {
10164 #ifdef DEVELOPER
10165 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10166 {
10167 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10169 }
10170 #endif
10171
10172 return GetQuantity() * GetConfigWeightModified();
10173 }
10174 else if (HasEnergyManager())
10175 {
10176 #ifdef DEVELOPER
10177 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10178 {
10179 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10180 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10181 }
10182 #endif
10183 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10184 }
10185 else
10186 {
10187 #ifdef DEVELOPER
10188 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10189 {
10190 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10191 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10192 }
10193 #endif
10194 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10195 }
10196 }
10197
10200 {
10201 int item_count = 0;
10203
10204 if (GetInventory().GetCargo() != NULL)
10205 {
10206 item_count = GetInventory().GetCargo().GetItemCount();
10207 }
10208
10209 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10210 {
10211 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10212 if (item)
10213 item_count += item.GetNumberOfItems();
10214 }
10215 return item_count;
10216 }
10217
10220 {
10221 float weight = 0;
10222 float wetness = 1;
10223 if (include_wetness)
10226 {
10227 weight = wetness * m_ConfigWeight;
10228 }
10230 {
10231 weight = 1;
10232 }
10233 return weight;
10234 }
10235
10236
10237
10239 {
10240 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10241 {
10242 GameInventory inv = GetInventory();
10243 array<EntityAI> items = new array<EntityAI>;
10245 for (int i = 0; i < items.Count(); i++)
10246 {
10248 if (item)
10249 {
10251 }
10252 }
10253 }
10254 }
10255
10256
10257
10258
10260 {
10261 float energy = 0;
10262 if (HasEnergyManager())
10263 {
10264 energy = GetCompEM().GetEnergy();
10265 }
10266 return energy;
10267 }
10268
10269
10271 {
10272 super.OnEnergyConsumed();
10273
10275 }
10276
10278 {
10279 super.OnEnergyAdded();
10280
10282 }
10283
10284
10286 {
10287 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10288 {
10290 {
10291 float energy_0to1 = GetCompEM().GetEnergy0To1();
10293 }
10294 }
10295 }
10296
10297
10299 {
10300 return ConfigGetFloat("heatIsolation");
10301 }
10302
10304 {
10306 }
10307
10309 {
10310 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10311 if (
GetGame().ConfigIsExisting(paramPath))
10313
10314 return 0.0;
10315 }
10316
10318 {
10319 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10320 if (
GetGame().ConfigIsExisting(paramPath))
10322
10323 return 0.0;
10324 }
10325
10326 override void SetWet(
float value,
bool allow_client =
false)
10327 {
10328 if (!IsServerCheck(allow_client))
10329 return;
10330
10333
10335
10336 m_VarWet = Math.Clamp(value, min, max);
10337
10339 {
10342 }
10343 }
10344
10345 override void AddWet(
float value)
10346 {
10348 }
10349
10351 {
10353 }
10354
10356 {
10358 }
10359
10361 {
10363 }
10364
10366 {
10368 }
10369
10371 {
10373 }
10374
10375 override void OnWetChanged(
float newVal,
float oldVal)
10376 {
10379 if (newLevel != oldLevel)
10380 {
10382 }
10383 }
10384
10386 {
10387 SetWeightDirty();
10388 }
10389
10391 {
10392 return GetWetLevelInternal(
m_VarWet);
10393 }
10394
10395
10396
10398 {
10400 }
10401
10403 {
10405 }
10406
10408 {
10410 }
10411
10413 {
10415 }
10416
10417
10418
10420 {
10421 if (ConfigIsExisting("itemModelLength"))
10422 {
10423 return ConfigGetFloat("itemModelLength");
10424 }
10425 return 0;
10426 }
10427
10429 {
10430 if (ConfigIsExisting("itemAttachOffset"))
10431 {
10432 return ConfigGetFloat("itemAttachOffset");
10433 }
10434 return 0;
10435 }
10436
10437 override void SetCleanness(
int value,
bool allow_client =
false)
10438 {
10439 if (!IsServerCheck(allow_client))
10440 return;
10441
10443
10445
10448 }
10449
10451 {
10453 }
10454
10456 {
10457 return true;
10458 }
10459
10460
10461
10462
10464 {
10466 }
10467
10469 {
10471 }
10472
10473
10474
10475
10476 override void SetColor(
int r,
int g,
int b,
int a)
10477 {
10483 }
10485 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10486 {
10491 }
10492
10494 {
10496 }
10497
10500 {
10501 int r,g,b,a;
10503 r = r/255;
10504 g = g/255;
10505 b = b/255;
10506 a = a/255;
10507 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10508 }
10509
10510
10511
10512 override void SetLiquidType(
int value,
bool allow_client =
false)
10513 {
10514 if (!IsServerCheck(allow_client))
10515 return;
10516
10521 }
10522
10524 {
10525 return ConfigGetInt("varLiquidTypeInit");
10526 }
10527
10529 {
10531 }
10532
10534 {
10536 SetFrozen(false);
10537 }
10538
10541 {
10542 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10543 }
10544
10545
10548 {
10549 PlayerBase nplayer;
10550 if (PlayerBase.CastTo(nplayer, player))
10551 {
10553
10554 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10555 }
10556 }
10557
10558
10561 {
10562 PlayerBase nplayer;
10563 if (PlayerBase.CastTo(nplayer,player))
10564 {
10565
10566 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10567
10568 }
10569
10570
10571 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10572
10573
10574 if (HasEnergyManager())
10575 {
10576 GetCompEM().UpdatePlugState();
10577 }
10578 }
10579
10580
10582 {
10583 super.OnPlacementStarted(player);
10584
10586 }
10587
10588 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10589 {
10591 {
10592 m_AdminLog.OnPlacementComplete(player,
this);
10593 }
10594
10595 super.OnPlacementComplete(player, position, orientation);
10596 }
10597
10598
10599
10600
10601
10603 {
10605 {
10606 return true;
10607 }
10608 else
10609 {
10610 return false;
10611 }
10612 }
10613
10614
10616 {
10618 {
10620 }
10621 }
10622
10623
10625 {
10627 }
10628
10630 {
10632 }
10633
10634 override void InsertAgent(
int agent,
float count = 1)
10635 {
10636 if (count < 1)
10637 return;
10638
10640 }
10641
10644 {
10646 }
10647
10648
10650 {
10652 }
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10696 {
10698 return false;
10699 return true;
10700 }
10701
10703 {
10704
10706 }
10707
10708
10711 {
10712 super.CheckForRoofLimited(timeTresholdMS);
10713
10715 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10716 {
10717 m_PreviousRoofTestTime = time;
10718 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10719 }
10720 }
10721
10722
10724 {
10726 {
10727 return 0;
10728 }
10729
10730 if (GetInventory().GetAttachmentSlotsCount() != 0)
10731 {
10732 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10733 if (filter)
10734 return filter.GetProtectionLevel(type, false, system);
10735 else
10736 return 0;
10737 }
10738
10739 string subclassPath, entryName;
10740
10741 switch (type)
10742 {
10744 entryName = "biological";
10745 break;
10747 entryName = "chemical";
10748 break;
10749 default:
10750 entryName = "biological";
10751 break;
10752 }
10753
10754 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10755
10757 }
10758
10759
10760
10763 {
10764 if (!IsMagazine())
10766
10768 }
10769
10770
10771
10772
10773
10778 {
10779 return true;
10780 }
10781
10783 {
10785 }
10786
10787
10788
10789
10790
10792 {
10793 if (parent)
10794 {
10795 if (parent.IsInherited(DayZInfected))
10796 return true;
10797
10798 if (!parent.IsRuined())
10799 return true;
10800 }
10801
10802 return true;
10803 }
10804
10806 {
10807 if (!super.CanPutAsAttachment(parent))
10808 {
10809 return false;
10810 }
10811
10812 if (!IsRuined() && !parent.IsRuined())
10813 {
10814 return true;
10815 }
10816
10817 return false;
10818 }
10819
10821 {
10822
10823
10824
10825
10826 return super.CanReceiveItemIntoCargo(item);
10827 }
10828
10830 {
10831
10832
10833
10834
10835 GameInventory attachmentInv = attachment.GetInventory();
10837 {
10838 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10839 return false;
10840 }
10841
10842 InventoryLocation loc = new InventoryLocation();
10843 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10844 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10845 return false;
10846
10847 return super.CanReceiveAttachment(attachment, slotId);
10848 }
10849
10851 {
10852 if (!super.CanReleaseAttachment(attachment))
10853 return false;
10854
10855 return GetInventory().AreChildrenAccessible();
10856 }
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10879 {
10880 int id = muzzle_owner.GetMuzzleID();
10881 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10882
10883 if (WPOF_array)
10884 {
10885 for (int i = 0; i < WPOF_array.Count(); i++)
10886 {
10887 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10888
10889 if (WPOF)
10890 {
10891 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10892 }
10893 }
10894 }
10895 }
10896
10897
10899 {
10900 int id = muzzle_owner.GetMuzzleID();
10902
10903 if (WPOBE_array)
10904 {
10905 for (int i = 0; i < WPOBE_array.Count(); i++)
10906 {
10907 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10908
10909 if (WPOBE)
10910 {
10911 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10912 }
10913 }
10914 }
10915 }
10916
10917
10919 {
10920 int id = muzzle_owner.GetMuzzleID();
10921 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10922
10923 if (WPOOH_array)
10924 {
10925 for (int i = 0; i < WPOOH_array.Count(); i++)
10926 {
10927 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10928
10929 if (WPOOH)
10930 {
10931 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10932 }
10933 }
10934 }
10935 }
10936
10937
10939 {
10940 int id = muzzle_owner.GetMuzzleID();
10941 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10942
10943 if (WPOOH_array)
10944 {
10945 for (int i = 0; i < WPOOH_array.Count(); i++)
10946 {
10947 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10948
10949 if (WPOOH)
10950 {
10951 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10952 }
10953 }
10954 }
10955 }
10956
10957
10959 {
10960 int id = muzzle_owner.GetMuzzleID();
10961 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10962
10963 if (WPOOH_array)
10964 {
10965 for (int i = 0; i < WPOOH_array.Count(); i++)
10966 {
10967 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10968
10969 if (WPOOH)
10970 {
10971 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10972 }
10973 }
10974 }
10975 }
10976
10977
10978
10980 {
10982 {
10983 return true;
10984 }
10985
10986 return false;
10987 }
10988
10990 {
10992 {
10993 return true;
10994 }
10995
10996 return false;
10997 }
10998
11000 {
11002 {
11003 return true;
11004 }
11005
11006 return false;
11007 }
11008
11010 {
11011 return false;
11012 }
11013
11016 {
11017 return UATimeSpent.DEFAULT_DEPLOY;
11018 }
11019
11020
11021
11022
11024 {
11026 SetSynchDirty();
11027 }
11028
11030 {
11032 }
11033
11034
11036 {
11037 return false;
11038 }
11039
11042 {
11043 string att_type = "None";
11044
11045 if (ConfigIsExisting("soundAttType"))
11046 {
11047 att_type = ConfigGetString("soundAttType");
11048 }
11049
11051 }
11052
11054 {
11056 }
11057
11058
11059
11060
11061
11067
11069 {
11072
11074 }
11075
11076
11078 {
11080 return;
11081
11083
11086
11089
11090 SoundParameters params = new SoundParameters();
11094 }
11095
11096
11098 {
11100 return;
11101
11103 SetSynchDirty();
11104
11107 }
11108
11109
11111 {
11113 return;
11114
11116 SetSynchDirty();
11117
11120 }
11121
11123 {
11125 }
11126
11128 {
11130 }
11131
11134 {
11135 if (!
GetGame().IsDedicatedServer())
11136 {
11137 if (ConfigIsExisting("attachSoundSet"))
11138 {
11139 string cfg_path = "";
11140 string soundset = "";
11141 string type_name =
GetType();
11142
11145 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11146 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11147
11148 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11149 {
11150 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11151 {
11152 if (cfg_slot_array[i] == slot_type)
11153 {
11154 soundset = cfg_soundset_array[i];
11155 break;
11156 }
11157 }
11158 }
11159
11160 if (soundset != "")
11161 {
11162 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11164 }
11165 }
11166 }
11167 }
11168
11170 {
11171
11172 }
11173
11174 void OnApply(PlayerBase player);
11175
11177 {
11178 return 1.0;
11179 };
11180
11182 {
11184 }
11185
11187 {
11189 }
11190
11192
11194 {
11195 SetDynamicPhysicsLifeTime(0.01);
11197 }
11198
11200 {
11201 array<string> zone_names = new array<string>;
11202 GetDamageZones(zone_names);
11203 for (int i = 0; i < zone_names.Count(); i++)
11204 {
11205 SetHealthMax(zone_names.Get(i),"Health");
11206 }
11207 SetHealthMax("","Health");
11208 }
11209
11212 {
11213 float global_health = GetHealth01("","Health");
11214 array<string> zones = new array<string>;
11215 GetDamageZones(zones);
11216
11217 for (int i = 0; i < zones.Count(); i++)
11218 {
11219 SetHealth01(zones.Get(i),"Health",global_health);
11220 }
11221 }
11222
11225 {
11226 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11227 }
11228
11230 {
11231 if (!hasRootAsPlayer)
11232 {
11233 if (refParentIB)
11234 {
11235
11236 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11237 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11238
11239 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11240 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11241
11244 }
11245 else
11246 {
11247
11250 }
11251 }
11252 }
11253
11255 {
11257 {
11258 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11259 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11260 {
11261 float heatPermCoef = 1.0;
11263 while (ent)
11264 {
11265 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11266 ent = ent.GetHierarchyParent();
11267 }
11268
11269 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11270 }
11271 }
11272 }
11273
11275 {
11276
11277 EntityAI parent = GetHierarchyParent();
11278 if (!parent)
11279 {
11280 hasParent = false;
11281 hasRootAsPlayer = false;
11282 }
11283 else
11284 {
11285 hasParent = true;
11286 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11287 refParentIB =
ItemBase.Cast(parent);
11288 }
11289 }
11290
11291 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11292 {
11293
11294 }
11295
11297 {
11298
11299 return false;
11300 }
11301
11303 {
11304
11305
11306 return false;
11307 }
11308
11310 {
11311
11312 return false;
11313 }
11314
11317 {
11318 return !GetIsFrozen() &&
IsOpen();
11319 }
11320
11322 {
11323 bool hasParent = false, hasRootAsPlayer = false;
11325
11326 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11327 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11328
11329 if (wwtu || foodDecay)
11330 {
11334
11335 if (processWetness || processTemperature || processDecay)
11336 {
11338
11339 if (processWetness)
11340 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11341
11342 if (processTemperature)
11344
11345 if (processDecay)
11346 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11347 }
11348 }
11349 }
11350
11353 {
11355 }
11356
11358 {
11361
11362 return super.GetTemperatureFreezeThreshold();
11363 }
11364
11366 {
11369
11370 return super.GetTemperatureThawThreshold();
11371 }
11372
11374 {
11377
11378 return super.GetItemOverheatThreshold();
11379 }
11380
11382 {
11384 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11385
11386 return super.GetTemperatureFreezeTime();
11387 }
11388
11390 {
11392 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11393
11394 return super.GetTemperatureThawTime();
11395 }
11396
11401
11403 {
11404 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11405 }
11406
11408 {
11409 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11410 }
11411
11414 {
11416 }
11417
11419 {
11421 }
11422
11424 {
11426 }
11427
11430 {
11431 return null;
11432 }
11433
11436 {
11437 return false;
11438 }
11439
11441 {
11443 {
11446 if (!trg)
11447 {
11449 explosive = this;
11450 }
11451
11452 explosive.PairRemote(trg);
11454
11455 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11456 trg.SetPersistentPairID(persistentID);
11457 explosive.SetPersistentPairID(persistentID);
11458
11459 return true;
11460 }
11461 return false;
11462 }
11463
11466 {
11467 float ret = 1.0;
11470 ret *= GetHealth01();
11471
11472 return ret;
11473 }
11474
11475 #ifdef DEVELOPER
11476 override void SetDebugItem()
11477 {
11478 super.SetDebugItem();
11479 _itemBase = this;
11480 }
11481
11483 {
11484 string text = super.GetDebugText();
11485
11487 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11488
11489 return text;
11490 }
11491 #endif
11492
11494 {
11495 return true;
11496 }
11497
11499
11501
11503 {
11506 }
11507
11508
11516
11532}
11533
11535{
11537 if (entity)
11538 {
11539 bool is_item = entity.IsInherited(
ItemBase);
11540 if (is_item && full_quantity)
11541 {
11544 }
11545 }
11546 else
11547 {
11549 return NULL;
11550 }
11551 return entity;
11552}
11553
11555{
11556 if (item)
11557 {
11558 if (health > 0)
11559 item.SetHealth("", "", health);
11560
11561 if (item.CanHaveTemperature())
11562 {
11564 if (item.CanFreeze())
11565 item.SetFrozen(false);
11566 }
11567
11568 if (item.HasEnergyManager())
11569 {
11570 if (quantity >= 0)
11571 {
11572 item.GetCompEM().SetEnergy0To1(quantity);
11573 }
11574 else
11575 {
11577 }
11578 }
11579 else if (item.IsMagazine())
11580 {
11581 Magazine mag = Magazine.Cast(item);
11582 if (quantity >= 0)
11583 {
11584 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11585 }
11586 else
11587 {
11589 }
11590
11591 }
11592 else
11593 {
11594 if (quantity >= 0)
11595 {
11596 item.SetQuantityNormalized(quantity, false);
11597 }
11598 else
11599 {
11601 }
11602
11603 }
11604 }
11605}
11606
11607#ifdef DEVELOPER
11609#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.