6638{
6640 {
6641 return true;
6642 }
6643};
6644
6645
6646
6648{
6652
6654
6657
6658
6659
6660
6661
6670
6676
6681
6686
6707 protected bool m_IsResultOfSplit
6708
6710
6715
6716
6717
6719
6723
6724
6725
6727
6730
6731
6732
6738
6739
6747
6750
6751
6753
6754
6756
6757
6762
6763
6768
6769
6771
6772
6774 {
6779
6780 if (!
GetGame().IsDedicatedServer())
6781 {
6783 {
6785
6787 {
6789 }
6790 }
6791
6794 }
6795
6796 m_OldLocation = null;
6797
6799 {
6801 }
6802
6803 if (ConfigIsExisting("headSelectionsToHide"))
6804 {
6807 }
6808
6810 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6811 {
6813 }
6814
6816
6817 m_IsResultOfSplit = false;
6818
6820 }
6821
6823 {
6824 super.InitItemVariables();
6825
6831 m_Count = ConfigGetInt(
"count");
6832
6835
6840
6843
6848
6860
6864
6865
6868 if (ConfigIsExisting("canBeSplit"))
6869 {
6872 }
6873
6875 if (ConfigIsExisting("itemBehaviour"))
6877
6878
6881 RegisterNetSyncVariableInt("m_VarLiquidType");
6882 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6883
6884 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6885 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6886 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6887
6888 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6889 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6890 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6891 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6892
6893 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6894 RegisterNetSyncVariableBool("m_IsTakeable");
6895 RegisterNetSyncVariableBool("m_IsHologram");
6896
6899 {
6902 }
6903
6905
6907 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6909
6910 }
6911
6913 {
6915 }
6916
6918 {
6921 {
6926 }
6927 }
6928
6929 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6930 {
6932 {
6935 }
6936
6938 }
6939
6941 {
6947 }
6948
6950
6952 {
6954
6955 if (!action)
6956 {
6957 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6958 return;
6959 }
6960
6962 if (!ai)
6963 {
6965 return;
6966 }
6967
6969 if (!action_array)
6970 {
6971 action_array = new array<ActionBase_Basic>;
6973 }
6974 if (LogManager.IsActionLogEnable())
6975 {
6976 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6977 }
6978
6979 if (action_array.Find(action) != -1)
6980 {
6981 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6982 }
6983 else
6984 {
6985 action_array.Insert(action);
6986 }
6987 }
6988
6990 {
6992 ActionBase action = player.GetActionManager().GetAction(actionName);
6995
6996 if (action_array)
6997 {
6998 action_array.RemoveItem(action);
6999 }
7000 }
7001
7002
7003
7005 {
7006 ActionOverrideData overrideData = new ActionOverrideData();
7010
7012 if (!actionMap)
7013 {
7016 }
7017
7018 actionMap.Insert(this.
Type(), overrideData);
7019
7020 }
7021
7023
7025
7026
7028 {
7031
7034
7035 string config_to_search = "CfgVehicles";
7036 string muzzle_owner_config;
7037
7039 {
7040 if (IsInherited(Weapon))
7041 config_to_search = "CfgWeapons";
7042
7043 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7044
7045 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7046
7048
7049 if (config_OnFire_subclass_count > 0)
7050 {
7051 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7052
7053 for (int i = 0; i < config_OnFire_subclass_count; i++)
7054 {
7055 string particle_class = "";
7057 string config_OnFire_entry = config_OnFire_class + particle_class;
7058 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7059 WPOF_array.Insert(WPOF);
7060 }
7061
7062
7064 }
7065 }
7066
7068 {
7069 config_to_search = "CfgWeapons";
7070 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7071
7072 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7073
7075
7076 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7077 {
7078 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7079
7080 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7081 {
7082 string particle_class2 = "";
7084 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7085 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7086 WPOBE_array.Insert(WPOBE);
7087 }
7088
7089
7091 }
7092 }
7093 }
7094
7095
7097 {
7100
7102 {
7103 string config_to_search = "CfgVehicles";
7104
7105 if (IsInherited(Weapon))
7106 config_to_search = "CfgWeapons";
7107
7108 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7109 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7110
7111 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7112 {
7113
7115
7117 {
7119 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7121 return;
7122 }
7123
7126
7127
7128
7130 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7131
7132 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7133 {
7134 string particle_class = "";
7136 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7138
7139 if (entry_type == CT_CLASS)
7140 {
7141 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7142 WPOOH_array.Insert(WPOF);
7143 }
7144 }
7145
7146
7148 }
7149 }
7150 }
7151
7153 {
7155 }
7156
7158 {
7160 {
7162
7165
7168
7169 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7170 }
7171 }
7172
7174 {
7176 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7177
7179 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7180
7182 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7183
7185 {
7187 }
7188 }
7189
7191 {
7193 }
7194
7196 {
7199 else
7201
7203 {
7206 }
7207 else
7208 {
7211
7214 }
7215
7217 }
7218
7220 {
7222 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7223 }
7224
7226 {
7228 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7230 }
7231
7233 {
7235 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7236 }
7237
7239 {
7242
7243 OverheatingParticle OP = new OverheatingParticle();
7248
7250 }
7251
7253 {
7256
7257 return -1;
7258 }
7259
7261 {
7263 {
7266
7267 for (int i = count; i > 0; --i)
7268 {
7269 int id = i - 1;
7272
7275
7276 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7277 {
7278 if (p)
7279 {
7282 }
7283 }
7284 }
7285 }
7286 }
7287
7289 {
7291 {
7293 {
7294 int id = i - 1;
7296
7297 if (OP)
7298 {
7300
7301 if (p)
7302 {
7304 }
7305
7306 delete OP;
7307 }
7308 }
7309
7312 }
7313 }
7314
7317 {
7318 return 0.0;
7319 }
7320
7321
7323 {
7324 return 250;
7325 }
7326
7328 {
7329 return 0;
7330 }
7331
7334 {
7336 return true;
7337
7338 return false;
7339 }
7340
7343 {
7346
7348 {
7350 }
7351 else
7352 {
7353
7355 }
7356
7358 }
7359
7366 {
7367 return -1;
7368 }
7369
7370
7371
7372
7374 {
7376 {
7378 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7379
7380 if (r_index >= 0)
7381 {
7382 InventoryLocation r_il = new InventoryLocation;
7383 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7384
7385 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7388 {
7389 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7390 }
7392 {
7393 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7394 }
7395
7396 }
7397
7398 player.GetHumanInventory().ClearUserReservedLocation(this);
7399 }
7400
7403 }
7404
7405
7406
7407
7409 {
7410 return ItemBase.m_DebugActionsMask;
7411 }
7412
7414 {
7415 return ItemBase.m_DebugActionsMask & mask;
7416 }
7417
7419 {
7420 ItemBase.m_DebugActionsMask = mask;
7421 }
7422
7424 {
7425 ItemBase.m_DebugActionsMask |= mask;
7426 }
7427
7429 {
7430 ItemBase.m_DebugActionsMask &= ~mask;
7431 }
7432
7434 {
7436 {
7438 }
7439 else
7440 {
7442 }
7443 }
7444
7445
7447 {
7448 if (GetEconomyProfile())
7449 {
7450 float q_max = GetEconomyProfile().GetQuantityMax();
7451 if (q_max > 0)
7452 {
7453 float q_min = GetEconomyProfile().GetQuantityMin();
7454 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7455
7457 {
7458 ComponentEnergyManager comp = GetCompEM();
7460 {
7462 }
7463 }
7465 {
7467
7468 }
7469
7470 }
7471 }
7472 }
7473
7476 {
7477 EntityAI parent = GetHierarchyParent();
7478
7479 if (parent)
7480 {
7481 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7482 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7483 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7484 }
7485 }
7486
7489 {
7490 EntityAI parent = GetHierarchyParent();
7491
7492 if (parent)
7493 {
7494 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7495 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7496 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7497 }
7498 }
7499
7501 {
7502
7503
7504
7505
7507
7509 {
7510 if (ScriptInputUserData.CanStoreInputUserData())
7511 {
7512 ScriptInputUserData ctx = new ScriptInputUserData;
7518 ctx.
Write(use_stack_max);
7521
7523 {
7524 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7525 }
7526 }
7527 }
7528 else if (!
GetGame().IsMultiplayer())
7529 {
7531 }
7532 }
7533
7535 {
7537 }
7538
7540 {
7542 }
7543
7545 {
7547 }
7548
7550 {
7551
7552 return false;
7553 }
7554
7556 {
7557 return false;
7558 }
7559
7563 {
7564 return false;
7565 }
7566
7568 {
7569 return "";
7570 }
7571
7573
7575 {
7576 return false;
7577 }
7578
7580 {
7581 return true;
7582 }
7583
7584
7585
7587 {
7588 return true;
7589 }
7590
7592 {
7593 return true;
7594 }
7595
7597 {
7598 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7600 }
7601
7603 {
7605 }
7606
7608 {
7610 if (!is_being_placed)
7612 SetSynchDirty();
7613 }
7614
7615
7617
7619 {
7621 }
7622
7624 {
7626 }
7627
7629 {
7630 return 1;
7631 }
7632
7634 {
7635 return false;
7636 }
7637
7639 {
7641 SetSynchDirty();
7642 }
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7679 {
7680 super.OnMovedInsideCargo(container);
7681
7682 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7683 }
7684
7685 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7686 {
7687 super.EEItemLocationChanged(oldLoc,newLoc);
7688
7689 PlayerBase new_player = null;
7690 PlayerBase old_player = null;
7691
7692 if (newLoc.GetParent())
7693 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7694
7695 if (oldLoc.GetParent())
7696 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7697
7699 {
7700 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7701
7702 if (r_index >= 0)
7703 {
7704 InventoryLocation r_il = new InventoryLocation;
7705 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7706
7707 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7710 {
7711 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7712 }
7714 {
7715 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7716 }
7717
7718 }
7719 }
7720
7722 {
7723 if (new_player)
7724 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7725
7726 if (new_player == old_player)
7727 {
7728
7729 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7730 {
7732 {
7733 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7734 {
7735 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7736 }
7737 }
7738 else
7739 {
7740 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7741 }
7742 }
7743
7744 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7745 {
7746 int type = oldLoc.GetType();
7748 {
7749 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7750 }
7752 {
7753 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7754 }
7755 }
7756 if (!m_OldLocation)
7757 {
7758 m_OldLocation = new InventoryLocation;
7759 }
7760 m_OldLocation.Copy(oldLoc);
7761 }
7762 else
7763 {
7764 if (m_OldLocation)
7765 {
7766 m_OldLocation.Reset();
7767 }
7768 }
7769
7771 }
7772 else
7773 {
7774 if (new_player)
7775 {
7776 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7777 if (res_index >= 0)
7778 {
7779 InventoryLocation il = new InventoryLocation;
7780 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7782 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7785 {
7786 il.
GetParent().GetOnReleaseLock().Invoke(it);
7787 }
7789 {
7791 }
7792
7793 }
7794 }
7796 {
7797
7799 }
7800
7801 if (m_OldLocation)
7802 {
7803 m_OldLocation.Reset();
7804 }
7805 }
7806 }
7807
7808 override void EOnContact(IEntity other, Contact extra)
7809 {
7811 {
7812 int liquidType = -1;
7814 if (impactSpeed > 0.0)
7815 {
7817 #ifndef SERVER
7819 #else
7821 SetSynchDirty();
7822 #endif
7824 }
7825 }
7826
7827 #ifdef SERVER
7828 if (GetCompEM() && GetCompEM().IsPlugged())
7829 {
7830 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7831 GetCompEM().UnplugThis();
7832 }
7833 #endif
7834 }
7835
7837
7839 {
7841 }
7842
7844 {
7845
7846 }
7847
7849 {
7850 super.OnItemLocationChanged(old_owner, new_owner);
7851
7852 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7853 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7854
7855 if (!relatedPlayer && playerNew)
7856 relatedPlayer = playerNew;
7857
7858 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7859 {
7861 if (actionMgr)
7862 {
7863 ActionBase currentAction = actionMgr.GetRunningAction();
7864 if (currentAction)
7866 }
7867 }
7868
7869 Man ownerPlayerOld = null;
7870 Man ownerPlayerNew = null;
7871
7872 if (old_owner)
7873 {
7874 if (old_owner.
IsMan())
7875 {
7876 ownerPlayerOld = Man.Cast(old_owner);
7877 }
7878 else
7879 {
7880 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7881 }
7882 }
7883 else
7884 {
7886 {
7888
7889 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7890 {
7891 GetCompEM().UnplugThis();
7892 }
7893 }
7894 }
7895
7896 if (new_owner)
7897 {
7898 if (new_owner.
IsMan())
7899 {
7900 ownerPlayerNew = Man.Cast(new_owner);
7901 }
7902 else
7903 {
7904 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7905 }
7906 }
7907
7908 if (ownerPlayerOld != ownerPlayerNew)
7909 {
7910 if (ownerPlayerOld)
7911 {
7912 array<EntityAI> subItemsExit = new array<EntityAI>;
7914 for (int i = 0; i < subItemsExit.Count(); i++)
7915 {
7918 }
7919 }
7920
7921 if (ownerPlayerNew)
7922 {
7923 array<EntityAI> subItemsEnter = new array<EntityAI>;
7925 for (int j = 0; j < subItemsEnter.Count(); j++)
7926 {
7929 }
7930 }
7931 }
7932 else if (ownerPlayerNew != null)
7933 {
7934 PlayerBase nplayer;
7935 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7936 {
7937 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7939 for (int k = 0; k < subItemsUpdate.Count(); k++)
7940 {
7942 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7943 }
7944 }
7945 }
7946
7947 if (old_owner)
7948 old_owner.OnChildItemRemoved(this);
7949 if (new_owner)
7950 new_owner.OnChildItemReceived(this);
7951 }
7952
7953
7955 {
7956 super.EEDelete(parent);
7957 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7958 if (player)
7959 {
7961
7962 if (player.IsAlive())
7963 {
7964 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7965 if (r_index >= 0)
7966 {
7967 InventoryLocation r_il = new InventoryLocation;
7968 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7969
7970 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7973 {
7974 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7975 }
7977 {
7978 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7979 }
7980
7981 }
7982
7983 player.RemoveQuickBarEntityShortcut(this);
7984 }
7985 }
7986 }
7987
7989 {
7990 super.EEKilled(killer);
7991
7994 {
7995 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7996 {
7997 if (IsMagazine())
7998 {
7999 if (Magazine.Cast(this).GetAmmoCount() > 0)
8000 {
8002 }
8003 }
8004 else
8005 {
8007 }
8008 }
8009 }
8010 }
8011
8013 {
8014 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8015
8016 super.OnWasAttached(parent, slot_id);
8017
8020
8022 }
8023
8025 {
8026 super.OnWasDetached(parent, slot_id);
8027
8030 }
8031
8033 {
8034 int idx;
8037
8038 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8039 if (inventory_slots.Count() < 1)
8040 {
8041 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8042 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8043 }
8044 else
8045 {
8046 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8047 }
8048
8049 idx = inventory_slots.Find(slot);
8050 if (idx < 0)
8051 return "";
8052
8053 return attach_types.Get(idx);
8054 }
8055
8057 {
8058 int idx = -1;
8059 string slot;
8060
8063
8064 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8065 if (inventory_slots.Count() < 1)
8066 {
8067 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8068 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8069 }
8070 else
8071 {
8072 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8073 if (detach_types.Count() < 1)
8074 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8075 }
8076
8077 for (int i = 0; i < inventory_slots.Count(); i++)
8078 {
8079 slot = inventory_slots.Get(i);
8080 }
8081
8082 if (slot != "")
8083 {
8084 if (detach_types.Count() == 1)
8085 idx = 0;
8086 else
8087 idx = inventory_slots.Find(slot);
8088 }
8089 if (idx < 0)
8090 return "";
8091
8092 return detach_types.Get(idx);
8093 }
8094
8096 {
8097
8099
8100
8101 float min_time = 1;
8102 float max_time = 3;
8103 float delay = Math.RandomFloat(min_time, max_time);
8104
8105 explode_timer.Run(delay, this, "DoAmmoExplosion");
8106 }
8107
8109 {
8110 Magazine magazine = Magazine.Cast(this);
8111 int pop_sounds_count = 6;
8112 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8113
8114
8115 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8116 string sound_name = pop_sounds[ sound_idx ];
8118
8119
8120 magazine.ServerAddAmmoCount(-1);
8121
8122
8123 float min_temp_to_explode = 100;
8124
8125 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8126 {
8128 }
8129 }
8130
8131
8132 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8133 {
8134 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8135
8136 const int CHANCE_DAMAGE_CARGO = 4;
8137 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8138 const int CHANCE_DAMAGE_NOTHING = 2;
8139
8141 {
8142 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8143 int chances;
8144 int rnd;
8145
8146 if (GetInventory().GetCargo())
8147 {
8148 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8149 rnd = Math.RandomInt(0,chances);
8150
8151 if (rnd < CHANCE_DAMAGE_CARGO)
8152 {
8154 }
8155 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8156 {
8158 }
8159 }
8160 else
8161 {
8162 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8163 rnd = Math.RandomInt(0,chances);
8164
8165 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8166 {
8168 }
8169 }
8170 }
8171 }
8172
8174 {
8175 if (GetInventory().GetCargo())
8176 {
8177 int item_count = GetInventory().GetCargo().GetItemCount();
8178 if (item_count > 0)
8179 {
8180 int random_pick = Math.RandomInt(0, item_count);
8182 if (!item.IsExplosive())
8183 {
8184 item.AddHealth("","",damage);
8185 return true;
8186 }
8187 }
8188 }
8189 return false;
8190 }
8191
8193 {
8194 int attachment_count = GetInventory().AttachmentCount();
8195 if (attachment_count > 0)
8196 {
8197 int random_pick = Math.RandomInt(0, attachment_count);
8198 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8199 if (!attachment.IsExplosive())
8200 {
8201 attachment.AddHealth("","",damage);
8202 return true;
8203 }
8204 }
8205 return false;
8206 }
8207
8209 {
8211 }
8212
8214 {
8216 return GetInventory().CanRemoveEntity();
8217
8218 return false;
8219 }
8220
8222 {
8223
8225 return false;
8226
8227
8229 return false;
8230
8231
8232
8234 if (delta == 0)
8235 return false;
8236
8237
8238 return true;
8239 }
8240
8242 {
8244 {
8245 if (ScriptInputUserData.CanStoreInputUserData())
8246 {
8247 ScriptInputUserData ctx = new ScriptInputUserData;
8252 ctx.
Write(destination_entity);
8256 }
8257 }
8258 else if (!
GetGame().IsMultiplayer())
8259 {
8261 }
8262 }
8263
8265 {
8266 float split_quantity_new;
8270 InventoryLocation loc = new InventoryLocation;
8271
8272 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8273 {
8275 split_quantity_new = stack_max;
8276 else
8278
8280 {
8281 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8282 if (new_item)
8283 {
8284 new_item.SetResultOfSplit(true);
8285 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8287 new_item.
SetQuantity(split_quantity_new,
false,
true);
8288 }
8289 }
8290 }
8291 else if (destination_entity && slot_id == -1)
8292 {
8293 if (quantity > stack_max)
8294 split_quantity_new = stack_max;
8295 else
8296 split_quantity_new = quantity;
8297
8299 {
8301 {
8304 }
8305
8306 if (new_item)
8307 {
8308 new_item.SetResultOfSplit(true);
8309 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8311 new_item.
SetQuantity(split_quantity_new,
false,
true);
8312 }
8313 }
8314 }
8315 else
8316 {
8317 if (stack_max != 0)
8318 {
8320 {
8322 }
8323
8324 if (split_quantity_new == 0)
8325 {
8326 if (!
GetGame().IsMultiplayer())
8327 player.PhysicalPredictiveDropItem(this);
8328 else
8329 player.ServerDropEntity(this);
8330 return;
8331 }
8332
8334 {
8336
8337 if (new_item)
8338 {
8339 new_item.SetResultOfSplit(true);
8340 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8343 new_item.PlaceOnSurface();
8344 }
8345 }
8346 }
8347 }
8348 }
8349
8351 {
8352 float split_quantity_new;
8356 InventoryLocation loc = new InventoryLocation;
8357
8358 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8359 {
8361 split_quantity_new = stack_max;
8362 else
8364
8366 {
8367 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8368 if (new_item)
8369 {
8370 new_item.SetResultOfSplit(true);
8371 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8373 new_item.
SetQuantity(split_quantity_new,
false,
true);
8374 }
8375 }
8376 }
8377 else if (destination_entity && slot_id == -1)
8378 {
8379 if (quantity > stack_max)
8380 split_quantity_new = stack_max;
8381 else
8382 split_quantity_new = quantity;
8383
8385 {
8387 {
8390 }
8391
8392 if (new_item)
8393 {
8394 new_item.SetResultOfSplit(true);
8395 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8397 new_item.
SetQuantity(split_quantity_new,
false,
true);
8398 }
8399 }
8400 }
8401 else
8402 {
8403 if (stack_max != 0)
8404 {
8406 {
8408 }
8409
8411 {
8413
8414 if (new_item)
8415 {
8416 new_item.SetResultOfSplit(true);
8417 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8420 new_item.PlaceOnSurface();
8421 }
8422 }
8423 }
8424 }
8425 }
8426
8428 {
8430 {
8431 if (ScriptInputUserData.CanStoreInputUserData())
8432 {
8433 ScriptInputUserData ctx = new ScriptInputUserData;
8438 dst.WriteToContext(ctx);
8440 }
8441 }
8442 else if (!
GetGame().IsMultiplayer())
8443 {
8445 }
8446 }
8447
8449 {
8451 {
8452 if (ScriptInputUserData.CanStoreInputUserData())
8453 {
8454 ScriptInputUserData ctx = new ScriptInputUserData;
8459 ctx.
Write(destination_entity);
8465 }
8466 }
8467 else if (!
GetGame().IsMultiplayer())
8468 {
8470 }
8471 }
8472
8474 {
8476 }
8477
8479 {
8481 float split_quantity_new;
8483 if (dst.IsValid())
8484 {
8485 int slot_id = dst.GetSlot();
8487
8488 if (quantity > stack_max)
8489 split_quantity_new = stack_max;
8490 else
8491 split_quantity_new = quantity;
8492
8494 {
8496
8497 if (new_item)
8498 {
8499 new_item.SetResultOfSplit(true);
8500 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8502 new_item.
SetQuantity(split_quantity_new,
false,
true);
8503 }
8504
8505 return new_item;
8506 }
8507 }
8508
8509 return null;
8510 }
8511
8513 {
8515 float split_quantity_new;
8517 if (destination_entity)
8518 {
8520 if (quantity > stackable)
8521 split_quantity_new = stackable;
8522 else
8523 split_quantity_new = quantity;
8524
8526 {
8527 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
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 }
8538
8540 {
8542 {
8543 if (ScriptInputUserData.CanStoreInputUserData())
8544 {
8545 ScriptInputUserData ctx = new ScriptInputUserData;
8550 ItemBase destination_entity =
this;
8551 ctx.
Write(destination_entity);
8555 }
8556 }
8557 else if (!
GetGame().IsMultiplayer())
8558 {
8560 }
8561 }
8562
8564 {
8566 float split_quantity_new;
8568 if (player)
8569 {
8571 if (quantity > stackable)
8572 split_quantity_new = stackable;
8573 else
8574 split_quantity_new = quantity;
8575
8577 {
8578 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8579 new_item =
ItemBase.Cast(in_hands);
8580 if (new_item)
8581 {
8582 new_item.SetResultOfSplit(true);
8583 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8585 new_item.SetQuantity(split_quantity_new, false, true);
8586 }
8587 }
8588 }
8589 }
8590
8592 {
8594 float split_quantity_new = Math.Floor(quantity * 0.5);
8595
8597 return;
8598
8600
8601 if (new_item)
8602 {
8603 if (new_item.GetQuantityMax() < split_quantity_new)
8604 {
8605 split_quantity_new = new_item.GetQuantityMax();
8606 }
8607
8608 new_item.SetResultOfSplit(true);
8609 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8610
8612 {
8615 }
8616 else
8617 {
8619 new_item.
SetQuantity(split_quantity_new,
false,
true);
8620 }
8621 }
8622 }
8623
8625 {
8627 float split_quantity_new = Math.Floor(quantity / 2);
8628
8630 return;
8631
8632 InventoryLocation invloc = new InventoryLocation;
8634
8636 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8637
8638 if (new_item)
8639 {
8640 if (new_item.GetQuantityMax() < split_quantity_new)
8641 {
8642 split_quantity_new = new_item.GetQuantityMax();
8643 }
8645 {
8648 }
8649 else if (split_quantity_new > 1)
8650 {
8652 new_item.
SetQuantity(split_quantity_new,
false,
true);
8653 }
8654 }
8655 }
8656
8659 {
8660 SetWeightDirty();
8662
8663 if (parent)
8664 parent.OnAttachmentQuantityChangedEx(this, delta);
8665
8667 {
8669 {
8671 }
8673 {
8674 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8676 }
8677 }
8678
8679 }
8680
8683 {
8684
8685 }
8686
8689 {
8691 }
8692
8694 {
8695 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8696
8698 {
8699 if (newLevel == GameConstants.STATE_RUINED)
8700 {
8702 EntityAI parent = GetHierarchyParent();
8703 if (parent && parent.IsFireplace())
8704 {
8705 CargoBase cargo = GetInventory().GetCargo();
8706 if (cargo)
8707 {
8709 {
8711 }
8712 }
8713 }
8714 }
8715
8717 {
8718
8720 return;
8721 }
8722
8723 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8724 {
8726 }
8727 }
8728 }
8729
8730
8732 {
8733 super.OnRightClick();
8734
8736 {
8738 {
8739 if (ScriptInputUserData.CanStoreInputUserData())
8740 {
8741 EntityAI root = GetHierarchyRoot();
8742 Man playerOwner = GetHierarchyRootPlayer();
8743 InventoryLocation dst = new InventoryLocation;
8744
8745
8746 if (!playerOwner && root && root == this)
8747 {
8749 }
8750 else
8751 {
8752
8753 GetInventory().GetCurrentInventoryLocation(dst);
8755 {
8758 {
8760 }
8761 else
8762 {
8764
8765
8766 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8767 {
8769 }
8770 else
8771 {
8772 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8773 }
8774 }
8775 }
8776 }
8777
8778 ScriptInputUserData ctx = new ScriptInputUserData;
8786 }
8787 }
8788 else if (!
GetGame().IsMultiplayer())
8789 {
8791 }
8792 }
8793 }
8794
8796 {
8797 if (root)
8798 {
8799 vector m4[4];
8800 root.GetTransform(m4);
8801 dst.SetGround(this, m4);
8802 }
8803 else
8804 {
8805 GetInventory().GetCurrentInventoryLocation(dst);
8806 }
8807 }
8808
8809 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8810 {
8811
8812 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8813 return false;
8814
8815 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8816 return false;
8817
8818
8820 return false;
8821
8822
8823 Magazine mag = Magazine.Cast(this);
8824 if (mag)
8825 {
8826 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8827 return false;
8828
8829 if (stack_max_limit)
8830 {
8831 Magazine other_mag = Magazine.Cast(other_item);
8832 if (other_item)
8833 {
8834 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8835 return false;
8836 }
8837
8838 }
8839 }
8840 else
8841 {
8842
8844 return false;
8845
8847 return false;
8848 }
8849
8850 PlayerBase player = null;
8851 if (CastTo(player, GetHierarchyRootPlayer()))
8852 {
8853 if (player.GetInventory().HasAttachment(this))
8854 return false;
8855
8856 if (player.IsItemsToDelete())
8857 return false;
8858 }
8859
8860 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8861 return false;
8862
8863 int slotID;
8865 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8866 return false;
8867
8868 return true;
8869 }
8870
8872 {
8874 }
8875
8877 {
8878 return m_IsResultOfSplit;
8879 }
8880
8882 {
8883 m_IsResultOfSplit = value;
8884 }
8885
8887 {
8889 }
8890
8892 {
8893 float other_item_quantity = other_item.GetQuantity();
8894 float this_free_space;
8895
8897
8899
8900 if (other_item_quantity > this_free_space)
8901 {
8902 return this_free_space;
8903 }
8904 else
8905 {
8906 return other_item_quantity;
8907 }
8908 }
8909
8911 {
8913 }
8914
8916 {
8918 return;
8919
8920 if (!IsMagazine() && other_item)
8921 {
8923 if (quantity_used != 0)
8924 {
8925 float hp1 = GetHealth01("","");
8926 float hp2 = other_item.GetHealth01("","");
8927 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8928 hpResult = hpResult / (
GetQuantity() + quantity_used);
8929
8930 hpResult *= GetMaxHealth();
8931 Math.Round(hpResult);
8932 SetHealth("", "Health", hpResult);
8933
8935 other_item.AddQuantity(-quantity_used);
8936 }
8937 }
8939 }
8940
8942 {
8943 #ifdef SERVER
8944 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8945 GetHierarchyParent().IncreaseLifetimeUp();
8946 #endif
8947 };
8948
8950 {
8951 PlayerBase p = PlayerBase.Cast(player);
8952
8953 array<int> recipesIds = p.m_Recipes;
8954 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8955 if (moduleRecipesManager)
8956 {
8957 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8958 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8959 }
8960
8961 for (int i = 0;i < recipesIds.Count(); i++)
8962 {
8963 int key = recipesIds.Get(i);
8964 string recipeName = moduleRecipesManager.GetRecipeName(key);
8966 }
8967 }
8968
8969
8970 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8971 {
8972 super.GetDebugActions(outputList);
8973
8974
8980
8981
8986
8991
8992
8996
8997
8999 {
9003 }
9004
9007
9008
9012
9014
9015 InventoryLocation loc = new InventoryLocation();
9016 GetInventory().GetCurrentInventoryLocation(loc);
9018 {
9019 if (Gizmo_IsSupported())
9022 }
9023
9025 }
9026
9027
9028
9029
9031 {
9032 super.OnAction(action_id, player, ctx);
9033
9035 {
9036 switch (action_id)
9037 {
9040 return true;
9043 return true;
9044 }
9045 }
9046
9048 {
9049 switch (action_id)
9050 {
9052 Delete();
9053 return true;
9054 }
9055 }
9056
9057 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9058 {
9059 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9060 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9061 PlayerBase p = PlayerBase.Cast(player);
9062 if (
EActions.RECIPES_RANGE_START < 1000)
9063 {
9064 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9065 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9066 }
9067 }
9068 #ifndef SERVER
9069 else if (action_id ==
EActions.WATCH_PLAYER)
9070 {
9071 PluginDeveloper.SetDeveloperItemClientEx(player);
9072 }
9073 #endif
9075 {
9076 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9077 {
9078 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9079 OnDebugButtonPressServer(id + 1);
9080 }
9081
9082 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9083 {
9084 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9086 }
9087
9088 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9089 {
9090 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9092 }
9093
9094 else if (action_id ==
EActions.ADD_QUANTITY)
9095 {
9096 if (IsMagazine())
9097 {
9098 Magazine mag = Magazine.Cast(this);
9099 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9100 }
9101 else
9102 {
9104 }
9105
9106 if (m_EM)
9107 {
9108 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9109 }
9110
9111 }
9112
9113 else if (action_id ==
EActions.REMOVE_QUANTITY)
9114 {
9115 if (IsMagazine())
9116 {
9117 Magazine mag2 = Magazine.Cast(this);
9118 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9119 }
9120 else
9121 {
9123 }
9124 if (m_EM)
9125 {
9126 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9127 }
9128
9129 }
9130
9131 else if (action_id ==
EActions.SET_QUANTITY_0)
9132 {
9134
9135 if (m_EM)
9136 {
9137 m_EM.SetEnergy(0);
9138 }
9139 }
9140
9141 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9142 {
9144
9145 if (m_EM)
9146 {
9147 m_EM.SetEnergy(m_EM.GetEnergyMax());
9148 }
9149 }
9150
9151 else if (action_id ==
EActions.ADD_HEALTH)
9152 {
9153 AddHealth("","",GetMaxHealth("","Health")/5);
9154 }
9155 else if (action_id ==
EActions.REMOVE_HEALTH)
9156 {
9157 AddHealth("","",-GetMaxHealth("","Health")/5);
9158 }
9159 else if (action_id ==
EActions.DESTROY_HEALTH)
9160 {
9161 SetHealth01("","",0);
9162 }
9163 else if (action_id ==
EActions.WATCH_ITEM)
9164 {
9166 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9167 #ifdef DEVELOPER
9168 SetDebugDeveloper_item(this);
9169 #endif
9170 }
9171
9172 else if (action_id ==
EActions.ADD_TEMPERATURE)
9173 {
9174 AddTemperature(20);
9175
9176 }
9177
9178 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9179 {
9180 AddTemperature(-20);
9181
9182 }
9183
9184 else if (action_id ==
EActions.FLIP_FROZEN)
9185 {
9186 SetFrozen(!GetIsFrozen());
9187
9188 }
9189
9190 else if (action_id ==
EActions.ADD_WETNESS)
9191 {
9193
9194 }
9195
9196 else if (action_id ==
EActions.REMOVE_WETNESS)
9197 {
9199
9200 }
9201
9202 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9203 {
9206
9207
9208 }
9209
9210 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9211 {
9214 }
9215
9216 else if (action_id ==
EActions.MAKE_SPECIAL)
9217 {
9218 auto debugParams = DebugSpawnParams.WithPlayer(player);
9219 OnDebugSpawnEx(debugParams);
9220 }
9221
9222 }
9223
9224
9225 return false;
9226 }
9227
9228
9229
9230
9234
9237
9238
9239
9241 {
9242 return false;
9243 }
9244
9245
9247 {
9248 return true;
9249 }
9250
9251
9253 {
9254 return true;
9255 }
9256
9257
9258
9260 {
9261 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9263 }
9264
9267 {
9268 return null;
9269 }
9270
9272 {
9273 return false;
9274 }
9275
9277 {
9278 return false;
9279 }
9280
9284
9285
9287 {
9288 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9289 return module_repairing.CanRepair(this, item_repair_kit);
9290 }
9291
9292
9293 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9294 {
9295 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9296 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9297 }
9298
9299
9301 {
9302
9303
9304
9305
9306
9307
9308
9309
9310 return 1;
9311 }
9312
9313
9314
9316 {
9318 }
9319
9320
9321
9323 {
9325 }
9326
9327
9336 {
9337 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9338
9339 if (player)
9340 {
9341 player.MessageStatus(text);
9342 }
9343 }
9344
9345
9354 {
9355 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9356
9357 if (player)
9358 {
9359 player.MessageAction(text);
9360 }
9361 }
9362
9363
9372 {
9373 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9374
9375 if (player)
9376 {
9377 player.MessageFriendly(text);
9378 }
9379 }
9380
9381
9390 {
9391 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9392
9393 if (player)
9394 {
9395 player.MessageImportant(text);
9396 }
9397 }
9398
9400 {
9401 return true;
9402 }
9403
9404
9405 override bool KindOf(
string tag)
9406 {
9407 bool found = false;
9408 string item_name = this.
GetType();
9411
9412 int array_size = item_tag_array.Count();
9413 for (int i = 0; i < array_size; i++)
9414 {
9415 if (item_tag_array.Get(i) == tag)
9416 {
9417 found = true;
9418 break;
9419 }
9420 }
9421 return found;
9422 }
9423
9424
9426 {
9427
9428 super.OnRPC(sender, rpc_type,ctx);
9429
9430
9431 switch (rpc_type)
9432 {
9433 #ifndef SERVER
9434 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9435 Param2<bool, string> p = new Param2<bool, string>(false, "");
9436
9438 return;
9439
9440 bool play = p.param1;
9441 string soundSet = p.param2;
9442
9443 if (play)
9444 {
9446 {
9448 {
9450 }
9451 }
9452 else
9453 {
9455 }
9456 }
9457 else
9458 {
9460 }
9461
9462 break;
9463 #endif
9464
9465 }
9466
9468 {
9470 }
9471 }
9472
9473
9474
9475
9477 {
9478 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9479 return plugin.GetID(
name);
9480 }
9481
9483 {
9484 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9485 return plugin.GetName(id);
9486 }
9487
9490 {
9491
9492
9493 int varFlags;
9494 if (!ctx.
Read(varFlags))
9495 return;
9496
9497 if (varFlags & ItemVariableFlags.FLOAT)
9498 {
9500 }
9501 }
9502
9504 {
9505
9506 super.SerializeNumericalVars(floats_out);
9507
9508
9509
9511 {
9513 }
9514
9516 {
9518 }
9519
9521 {
9523 }
9524
9526 {
9531 }
9532
9534 {
9536 }
9537 }
9538
9540 {
9541
9542 super.DeSerializeNumericalVars(floats);
9543
9544
9545 int index = 0;
9546 int mask = Math.Round(floats.Get(index));
9547
9548 index++;
9549
9551 {
9553 {
9555 }
9556 else
9557 {
9558 float quantity = floats.Get(index);
9560 }
9561 index++;
9562 }
9563
9565 {
9566 float wet = floats.Get(index);
9568 index++;
9569 }
9570
9572 {
9573 int liquidtype = Math.Round(floats.Get(index));
9575 index++;
9576 }
9577
9579 {
9581 index++;
9583 index++;
9585 index++;
9587 index++;
9588 }
9589
9591 {
9592 int cleanness = Math.Round(floats.Get(index));
9594 index++;
9595 }
9596 }
9597
9599 {
9600 super.WriteVarsToCTX(ctx);
9601
9602
9604 {
9606 }
9607
9609 {
9611 }
9612
9614 {
9616 }
9617
9619 {
9620 int r,g,b,a;
9626 }
9627
9629 {
9631 }
9632 }
9633
9635 {
9636 if (!super.ReadVarsFromCTX(ctx,version))
9637 return false;
9638
9639 int intValue;
9640 float value;
9641
9642 if (version < 140)
9643 {
9644 if (!ctx.
Read(intValue))
9645 return false;
9646
9647 m_VariablesMask = intValue;
9648 }
9649
9651 {
9652 if (!ctx.
Read(value))
9653 return false;
9654
9656 {
9658 }
9659 else
9660 {
9662 }
9663 }
9664
9665 if (version < 140)
9666 {
9668 {
9669 if (!ctx.
Read(value))
9670 return false;
9671 SetTemperatureDirect(value);
9672 }
9673 }
9674
9676 {
9677 if (!ctx.
Read(value))
9678 return false;
9680 }
9681
9683 {
9684 if (!ctx.
Read(intValue))
9685 return false;
9687 }
9688
9690 {
9691 int r,g,b,a;
9693 return false;
9695 return false;
9697 return false;
9699 return false;
9700
9702 }
9703
9705 {
9706 if (!ctx.
Read(intValue))
9707 return false;
9709 }
9710
9711 if (version >= 138 && version < 140)
9712 {
9714 {
9715 if (!ctx.
Read(intValue))
9716 return false;
9717 SetFrozen(intValue);
9718 }
9719 }
9720
9721 return true;
9722 }
9723
9724
9726 {
9729 {
9731 }
9732
9733 if (!super.OnStoreLoad(ctx, version))
9734 {
9736 return false;
9737 }
9738
9739 if (version >= 114)
9740 {
9741 bool hasQuickBarIndexSaved;
9742
9743 if (!ctx.
Read(hasQuickBarIndexSaved))
9744 {
9746 return false;
9747 }
9748
9749 if (hasQuickBarIndexSaved)
9750 {
9751 int itmQBIndex;
9752
9753
9754 if (!ctx.
Read(itmQBIndex))
9755 {
9757 return false;
9758 }
9759
9760 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9761 if (itmQBIndex != -1 && parentPlayer)
9762 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9763 }
9764 }
9765 else
9766 {
9767
9768 PlayerBase player;
9769 int itemQBIndex;
9770 if (version ==
int.
MAX)
9771 {
9772 if (!ctx.
Read(itemQBIndex))
9773 {
9775 return false;
9776 }
9777 }
9778 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9779 {
9780
9781 if (!ctx.
Read(itemQBIndex))
9782 {
9784 return false;
9785 }
9786 if (itemQBIndex != -1 && player)
9787 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9788 }
9789 }
9790
9791 if (version < 140)
9792 {
9793
9794 if (!LoadVariables(ctx, version))
9795 {
9797 return false;
9798 }
9799 }
9800
9801
9803 {
9805 return false;
9806 }
9807 if (version >= 132)
9808 {
9810 if (raib)
9811 {
9813 {
9815 return false;
9816 }
9817 }
9818 }
9819
9821 return true;
9822 }
9823
9824
9825
9827 {
9828 super.OnStoreSave(ctx);
9829
9830 PlayerBase player;
9831 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9832 {
9834
9835 int itemQBIndex = -1;
9836 itemQBIndex = player.FindQuickBarEntityIndex(this);
9837 ctx.
Write(itemQBIndex);
9838 }
9839 else
9840 {
9842 }
9843
9845
9847 if (raib)
9848 {
9850 }
9851 }
9852
9853
9855 {
9856 super.AfterStoreLoad();
9857
9859 {
9861 }
9862
9864 {
9867 }
9868 }
9869
9871 {
9872 super.EEOnAfterLoad();
9873
9875 {
9877 }
9878
9881 }
9882
9884 {
9885 return false;
9886 }
9887
9888
9889
9891 {
9893 {
9894 #ifdef PLATFORM_CONSOLE
9895
9897 {
9899 if (menu)
9900 {
9902 }
9903 }
9904 #endif
9905 }
9906
9908 {
9911 }
9912
9914 {
9915 SetWeightDirty();
9917 }
9919 {
9922 }
9923
9925 {
9928 }
9930 {
9933 }
9934
9935 super.OnVariablesSynchronized();
9936 }
9937
9938
9939
9941 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9942 {
9943 if (!IsServerCheck(allow_client))
9944 return false;
9945
9947 return false;
9948
9951
9952 if (value <= (min + 0.001))
9953 value = min;
9954
9955 if (value == min)
9956 {
9957 if (destroy_config)
9958 {
9959 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9960 if (dstr)
9961 {
9963 this.Delete();
9964 return true;
9965 }
9966 }
9967 else if (destroy_forced)
9968 {
9970 this.Delete();
9971 return true;
9972 }
9973
9975 }
9976
9979
9981 {
9983
9984 if (delta)
9986 }
9987
9989
9990 return false;
9991 }
9992
9993
9995 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9996 {
9998 }
9999
10001 {
10004 }
10005
10007 {
10010 }
10011
10013 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10014 {
10015 float value_clamped = Math.Clamp(value, 0, 1);
10017 SetQuantity(result, destroy_config, destroy_forced);
10018 }
10019
10020
10023 {
10025 }
10026
10028 {
10030 }
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10042 {
10043 int slot = -1;
10044 if (GetInventory())
10045 {
10046 InventoryLocation il = new InventoryLocation;
10047 GetInventory().GetCurrentInventoryLocation(il);
10049 }
10050
10052 }
10053
10055 {
10056 float quantity_max = 0;
10057
10059 {
10060 if (attSlotID != -1)
10061 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10062
10063 if (quantity_max <= 0)
10065 }
10066
10067 if (quantity_max <= 0)
10069
10070 return quantity_max;
10071 }
10072
10074 {
10076 }
10077
10079 {
10081 }
10082
10083
10085 {
10087 }
10088
10090 {
10092 }
10093
10095 {
10097 }
10098
10099
10101 {
10102
10103 float weightEx = GetWeightEx();
10104 float special = GetInventoryAndCargoWeight();
10105 return weightEx - special;
10106 }
10107
10108
10110 {
10112 }
10113
10115 {
10117 {
10118 #ifdef DEVELOPER
10119 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10120 {
10121 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10123 }
10124 #endif
10125
10126 return GetQuantity() * GetConfigWeightModified();
10127 }
10128 else if (HasEnergyManager())
10129 {
10130 #ifdef DEVELOPER
10131 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10132 {
10133 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10134 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10135 }
10136 #endif
10137 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10138 }
10139 else
10140 {
10141 #ifdef DEVELOPER
10142 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10143 {
10144 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10145 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10146 }
10147 #endif
10148 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10149 }
10150 }
10151
10154 {
10155 int item_count = 0;
10157
10158 if (GetInventory().GetCargo() != NULL)
10159 {
10160 item_count = GetInventory().GetCargo().GetItemCount();
10161 }
10162
10163 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10164 {
10165 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10166 if (item)
10167 item_count += item.GetNumberOfItems();
10168 }
10169 return item_count;
10170 }
10171
10174 {
10175 float weight = 0;
10176 float wetness = 1;
10177 if (include_wetness)
10180 {
10181 weight = wetness * m_ConfigWeight;
10182 }
10184 {
10185 weight = 1;
10186 }
10187 return weight;
10188 }
10189
10190
10191
10193 {
10194 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10195 {
10196 GameInventory inv = GetInventory();
10197 array<EntityAI> items = new array<EntityAI>;
10199 for (int i = 0; i < items.Count(); i++)
10200 {
10202 if (item)
10203 {
10205 }
10206 }
10207 }
10208 }
10209
10210
10211
10212
10214 {
10215 float energy = 0;
10216 if (HasEnergyManager())
10217 {
10218 energy = GetCompEM().GetEnergy();
10219 }
10220 return energy;
10221 }
10222
10223
10225 {
10226 super.OnEnergyConsumed();
10227
10229 }
10230
10232 {
10233 super.OnEnergyAdded();
10234
10236 }
10237
10238
10240 {
10241 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10242 {
10244 {
10245 float energy_0to1 = GetCompEM().GetEnergy0To1();
10247 }
10248 }
10249 }
10250
10251
10253 {
10254 return ConfigGetFloat("heatIsolation");
10255 }
10256
10258 {
10260 }
10261
10263 {
10264 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10265 if (
GetGame().ConfigIsExisting(paramPath))
10267
10268 return 0.0;
10269 }
10270
10272 {
10273 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10274 if (
GetGame().ConfigIsExisting(paramPath))
10276
10277 return 0.0;
10278 }
10279
10280 override void SetWet(
float value,
bool allow_client =
false)
10281 {
10282 if (!IsServerCheck(allow_client))
10283 return;
10284
10287
10289
10290 m_VarWet = Math.Clamp(value, min, max);
10291
10293 {
10296 }
10297 }
10298
10299 override void AddWet(
float value)
10300 {
10302 }
10303
10305 {
10307 }
10308
10310 {
10312 }
10313
10315 {
10317 }
10318
10320 {
10322 }
10323
10325 {
10327 }
10328
10329 override void OnWetChanged(
float newVal,
float oldVal)
10330 {
10333 if (newLevel != oldLevel)
10334 {
10336 }
10337 }
10338
10340 {
10341 SetWeightDirty();
10342 }
10343
10345 {
10346 return GetWetLevelInternal(
m_VarWet);
10347 }
10348
10349
10350
10352 {
10354 }
10355
10357 {
10359 }
10360
10362 {
10364 }
10365
10367 {
10369 }
10370
10371
10372
10374 {
10375 if (ConfigIsExisting("itemModelLength"))
10376 {
10377 return ConfigGetFloat("itemModelLength");
10378 }
10379 return 0;
10380 }
10381
10383 {
10384 if (ConfigIsExisting("itemAttachOffset"))
10385 {
10386 return ConfigGetFloat("itemAttachOffset");
10387 }
10388 return 0;
10389 }
10390
10391 override void SetCleanness(
int value,
bool allow_client =
false)
10392 {
10393 if (!IsServerCheck(allow_client))
10394 return;
10395
10397
10399
10402 }
10403
10405 {
10407 }
10408
10410 {
10411 return true;
10412 }
10413
10414
10415
10416
10418 {
10420 }
10421
10423 {
10425 }
10426
10427
10428
10429
10430 override void SetColor(
int r,
int g,
int b,
int a)
10431 {
10437 }
10439 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10440 {
10445 }
10446
10448 {
10450 }
10451
10454 {
10455 int r,g,b,a;
10457 r = r/255;
10458 g = g/255;
10459 b = b/255;
10460 a = a/255;
10461 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10462 }
10463
10464
10465
10466 override void SetLiquidType(
int value,
bool allow_client =
false)
10467 {
10468 if (!IsServerCheck(allow_client))
10469 return;
10470
10475 }
10476
10478 {
10479 return ConfigGetInt("varLiquidTypeInit");
10480 }
10481
10483 {
10485 }
10486
10488 {
10490 SetFrozen(false);
10491 }
10492
10495 {
10496 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10497 }
10498
10499
10502 {
10503 PlayerBase nplayer;
10504 if (PlayerBase.CastTo(nplayer, player))
10505 {
10507
10508 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10509 }
10510 }
10511
10512
10515 {
10516 PlayerBase nplayer;
10517 if (PlayerBase.CastTo(nplayer,player))
10518 {
10519
10520 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10521
10522 }
10523
10524
10525 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10526
10527
10528 if (HasEnergyManager())
10529 {
10530 GetCompEM().UpdatePlugState();
10531 }
10532 }
10533
10534
10536 {
10537 super.OnPlacementStarted(player);
10538
10540 }
10541
10542 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10543 {
10545 {
10546 m_AdminLog.OnPlacementComplete(player,
this);
10547 }
10548
10549 super.OnPlacementComplete(player, position, orientation);
10550 }
10551
10552
10553
10554
10555
10557 {
10559 {
10560 return true;
10561 }
10562 else
10563 {
10564 return false;
10565 }
10566 }
10567
10568
10570 {
10572 {
10574 }
10575 }
10576
10577
10579 {
10581 }
10582
10584 {
10586 }
10587
10588 override void InsertAgent(
int agent,
float count = 1)
10589 {
10590 if (count < 1)
10591 return;
10592
10594 }
10595
10598 {
10600 }
10601
10602
10604 {
10606 }
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10650 {
10652 return false;
10653 return true;
10654 }
10655
10657 {
10658
10660 }
10661
10662
10665 {
10666 super.CheckForRoofLimited(timeTresholdMS);
10667
10669 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10670 {
10671 m_PreviousRoofTestTime = time;
10672 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10673 }
10674 }
10675
10676
10678 {
10680 {
10681 return 0;
10682 }
10683
10684 if (GetInventory().GetAttachmentSlotsCount() != 0)
10685 {
10686 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10687 if (filter)
10688 return filter.GetProtectionLevel(type, false, system);
10689 else
10690 return 0;
10691 }
10692
10693 string subclassPath, entryName;
10694
10695 switch (type)
10696 {
10698 entryName = "biological";
10699 break;
10701 entryName = "chemical";
10702 break;
10703 default:
10704 entryName = "biological";
10705 break;
10706 }
10707
10708 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10709
10711 }
10712
10713
10714
10717 {
10718 if (!IsMagazine())
10720
10722 }
10723
10724
10725
10726
10727
10732 {
10733 return true;
10734 }
10735
10737 {
10739 }
10740
10741
10742
10743
10744
10746 {
10747 if (parent)
10748 {
10749 if (parent.IsInherited(DayZInfected))
10750 return true;
10751
10752 if (!parent.IsRuined())
10753 return true;
10754 }
10755
10756 return true;
10757 }
10758
10760 {
10761 if (!super.CanPutAsAttachment(parent))
10762 {
10763 return false;
10764 }
10765
10766 if (!IsRuined() && !parent.IsRuined())
10767 {
10768 return true;
10769 }
10770
10771 return false;
10772 }
10773
10775 {
10776
10777
10778
10779
10780 return super.CanReceiveItemIntoCargo(item);
10781 }
10782
10784 {
10785
10786
10787
10788
10789 GameInventory attachmentInv = attachment.GetInventory();
10791 {
10792 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10793 return false;
10794 }
10795
10796 InventoryLocation loc = new InventoryLocation();
10797 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10798 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10799 return false;
10800
10801 return super.CanReceiveAttachment(attachment, slotId);
10802 }
10803
10805 {
10806 if (!super.CanReleaseAttachment(attachment))
10807 return false;
10808
10809 return GetInventory().AreChildrenAccessible();
10810 }
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10833 {
10834 int id = muzzle_owner.GetMuzzleID();
10835 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10836
10837 if (WPOF_array)
10838 {
10839 for (int i = 0; i < WPOF_array.Count(); i++)
10840 {
10841 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10842
10843 if (WPOF)
10844 {
10845 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10846 }
10847 }
10848 }
10849 }
10850
10851
10853 {
10854 int id = muzzle_owner.GetMuzzleID();
10856
10857 if (WPOBE_array)
10858 {
10859 for (int i = 0; i < WPOBE_array.Count(); i++)
10860 {
10861 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10862
10863 if (WPOBE)
10864 {
10865 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10866 }
10867 }
10868 }
10869 }
10870
10871
10873 {
10874 int id = muzzle_owner.GetMuzzleID();
10875 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10876
10877 if (WPOOH_array)
10878 {
10879 for (int i = 0; i < WPOOH_array.Count(); i++)
10880 {
10881 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10882
10883 if (WPOOH)
10884 {
10885 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10886 }
10887 }
10888 }
10889 }
10890
10891
10893 {
10894 int id = muzzle_owner.GetMuzzleID();
10895 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10896
10897 if (WPOOH_array)
10898 {
10899 for (int i = 0; i < WPOOH_array.Count(); i++)
10900 {
10901 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10902
10903 if (WPOOH)
10904 {
10905 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10906 }
10907 }
10908 }
10909 }
10910
10911
10913 {
10914 int id = muzzle_owner.GetMuzzleID();
10915 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10916
10917 if (WPOOH_array)
10918 {
10919 for (int i = 0; i < WPOOH_array.Count(); i++)
10920 {
10921 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10922
10923 if (WPOOH)
10924 {
10925 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10926 }
10927 }
10928 }
10929 }
10930
10931
10932
10934 {
10936 {
10937 return true;
10938 }
10939
10940 return false;
10941 }
10942
10944 {
10946 {
10947 return true;
10948 }
10949
10950 return false;
10951 }
10952
10954 {
10956 {
10957 return true;
10958 }
10959
10960 return false;
10961 }
10962
10964 {
10965 return false;
10966 }
10967
10970 {
10971 return UATimeSpent.DEFAULT_DEPLOY;
10972 }
10973
10974
10975
10976
10978 {
10980 SetSynchDirty();
10981 }
10982
10984 {
10986 }
10987
10988
10990 {
10991 return false;
10992 }
10993
10996 {
10997 string att_type = "None";
10998
10999 if (ConfigIsExisting("soundAttType"))
11000 {
11001 att_type = ConfigGetString("soundAttType");
11002 }
11003
11005 }
11006
11008 {
11010 }
11011
11012
11013
11014
11015
11021
11023 {
11026
11028 }
11029
11030
11032 {
11034 return;
11035
11037
11040
11043
11044 SoundParameters params = new SoundParameters();
11048 }
11049
11050
11052 {
11054 return;
11055
11057 SetSynchDirty();
11058
11061 }
11062
11063
11065 {
11067 return;
11068
11070 SetSynchDirty();
11071
11074 }
11075
11077 {
11079 }
11080
11082 {
11084 }
11085
11088 {
11089 if (!
GetGame().IsDedicatedServer())
11090 {
11091 if (ConfigIsExisting("attachSoundSet"))
11092 {
11093 string cfg_path = "";
11094 string soundset = "";
11095 string type_name =
GetType();
11096
11099 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11100 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11101
11102 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11103 {
11104 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11105 {
11106 if (cfg_slot_array[i] == slot_type)
11107 {
11108 soundset = cfg_soundset_array[i];
11109 break;
11110 }
11111 }
11112 }
11113
11114 if (soundset != "")
11115 {
11116 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11118 }
11119 }
11120 }
11121 }
11122
11124 {
11125
11126 }
11127
11128 void OnApply(PlayerBase player);
11129
11131 {
11132 return 1.0;
11133 };
11134
11136 {
11138 }
11139
11141 {
11143 }
11144
11146
11148 {
11149 SetDynamicPhysicsLifeTime(0.01);
11151 }
11152
11154 {
11155 array<string> zone_names = new array<string>;
11156 GetDamageZones(zone_names);
11157 for (int i = 0; i < zone_names.Count(); i++)
11158 {
11159 SetHealthMax(zone_names.Get(i),"Health");
11160 }
11161 SetHealthMax("","Health");
11162 }
11163
11166 {
11167 float global_health = GetHealth01("","Health");
11168 array<string> zones = new array<string>;
11169 GetDamageZones(zones);
11170
11171 for (int i = 0; i < zones.Count(); i++)
11172 {
11173 SetHealth01(zones.Get(i),"Health",global_health);
11174 }
11175 }
11176
11179 {
11180 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11181 }
11182
11184 {
11185 if (!hasRootAsPlayer)
11186 {
11187 if (refParentIB)
11188 {
11189
11190 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11191 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11192
11193 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11194 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11195
11198 }
11199 else
11200 {
11201
11204 }
11205 }
11206 }
11207
11209 {
11211 {
11212 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11213 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11214 {
11215 float heatPermCoef = 1.0;
11217 while (ent)
11218 {
11219 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11220 ent = ent.GetHierarchyParent();
11221 }
11222
11223 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11224 }
11225 }
11226 }
11227
11229 {
11230
11231 EntityAI parent = GetHierarchyParent();
11232 if (!parent)
11233 {
11234 hasParent = false;
11235 hasRootAsPlayer = false;
11236 }
11237 else
11238 {
11239 hasParent = true;
11240 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11241 refParentIB =
ItemBase.Cast(parent);
11242 }
11243 }
11244
11245 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11246 {
11247
11248 }
11249
11251 {
11252
11253 return false;
11254 }
11255
11257 {
11258
11259
11260 return false;
11261 }
11262
11264 {
11265
11266 return false;
11267 }
11268
11271 {
11272 return !GetIsFrozen() &&
IsOpen();
11273 }
11274
11276 {
11277 bool hasParent = false, hasRootAsPlayer = false;
11279
11280 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11281 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11282
11283 if (wwtu || foodDecay)
11284 {
11288
11289 if (processWetness || processTemperature || processDecay)
11290 {
11292
11293 if (processWetness)
11294 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11295
11296 if (processTemperature)
11298
11299 if (processDecay)
11300 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11301 }
11302 }
11303 }
11304
11307 {
11309 }
11310
11312 {
11315
11316 return super.GetTemperatureFreezeThreshold();
11317 }
11318
11320 {
11323
11324 return super.GetTemperatureThawThreshold();
11325 }
11326
11328 {
11331
11332 return super.GetItemOverheatThreshold();
11333 }
11334
11336 {
11338 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11339
11340 return super.GetTemperatureFreezeTime();
11341 }
11342
11344 {
11346 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11347
11348 return super.GetTemperatureThawTime();
11349 }
11350
11355
11357 {
11358 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11359 }
11360
11362 {
11363 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11364 }
11365
11368 {
11370 }
11371
11373 {
11375 }
11376
11378 {
11380 }
11381
11384 {
11385 return null;
11386 }
11387
11390 {
11391 return false;
11392 }
11393
11395 {
11397 {
11400 if (!trg)
11401 {
11403 explosive = this;
11404 }
11405
11406 explosive.PairRemote(trg);
11408
11409 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11410 trg.SetPersistentPairID(persistentID);
11411 explosive.SetPersistentPairID(persistentID);
11412
11413 return true;
11414 }
11415 return false;
11416 }
11417
11420 {
11421 float ret = 1.0;
11424 ret *= GetHealth01();
11425
11426 return ret;
11427 }
11428
11429 #ifdef DEVELOPER
11430 override void SetDebugItem()
11431 {
11432 super.SetDebugItem();
11433 _itemBase = this;
11434 }
11435
11437 {
11438 string text = super.GetDebugText();
11439
11441 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11442
11443 return text;
11444 }
11445 #endif
11446
11448 {
11449 return true;
11450 }
11451
11453
11455
11457 {
11460 }
11461
11462
11470
11486}
11487
11489{
11491 if (entity)
11492 {
11493 bool is_item = entity.IsInherited(
ItemBase);
11494 if (is_item && full_quantity)
11495 {
11498 }
11499 }
11500 else
11501 {
11503 return NULL;
11504 }
11505 return entity;
11506}
11507
11509{
11510 if (item)
11511 {
11512 if (health > 0)
11513 item.SetHealth("", "", health);
11514
11515 if (item.CanHaveTemperature())
11516 {
11518 if (item.CanFreeze())
11519 item.SetFrozen(false);
11520 }
11521
11522 if (item.HasEnergyManager())
11523 {
11524 if (quantity >= 0)
11525 {
11526 item.GetCompEM().SetEnergy0To1(quantity);
11527 }
11528 else
11529 {
11531 }
11532 }
11533 else if (item.IsMagazine())
11534 {
11535 Magazine mag = Magazine.Cast(item);
11536 if (quantity >= 0)
11537 {
11538 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11539 }
11540 else
11541 {
11543 }
11544
11545 }
11546 else
11547 {
11548 if (quantity >= 0)
11549 {
11550 item.SetQuantityNormalized(quantity, false);
11551 }
11552 else
11553 {
11555 }
11556
11557 }
11558 }
11559}
11560
11561#ifdef DEVELOPER
11563#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.