6628{
6630 {
6631 return true;
6632 }
6633};
6634
6635
6636
6638{
6642
6644
6647
6648
6649
6650
6651
6660
6666
6671
6676
6697 protected bool m_IsResultOfSplit
6698
6700
6705
6706
6707
6709
6713
6714
6715
6717
6720
6721
6722
6728
6729
6737
6740
6741
6743
6744
6746
6747
6752
6753
6758
6759
6761
6762
6764 {
6769
6770 if (!
GetGame().IsDedicatedServer())
6771 {
6773 {
6775
6777 {
6779 }
6780 }
6781
6784 }
6785
6786 m_OldLocation = null;
6787
6789 {
6791 }
6792
6793 if (ConfigIsExisting("headSelectionsToHide"))
6794 {
6797 }
6798
6800 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6801 {
6803 }
6804
6806
6807 m_IsResultOfSplit = false;
6808
6810 }
6811
6813 {
6814 super.InitItemVariables();
6815
6821 m_Count = ConfigGetInt(
"count");
6822
6825
6830
6833
6838
6850
6854
6855
6858 if (ConfigIsExisting("canBeSplit"))
6859 {
6862 }
6863
6865 if (ConfigIsExisting("itemBehaviour"))
6867
6868
6871 RegisterNetSyncVariableInt("m_VarLiquidType");
6872 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6873
6874 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6875 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6876 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6877
6878 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6879 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6880 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6881 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6882
6883 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6884 RegisterNetSyncVariableBool("m_IsTakeable");
6885 RegisterNetSyncVariableBool("m_IsHologram");
6886
6889 {
6892 }
6893
6895
6897 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6899
6900 }
6901
6903 {
6905 }
6906
6908 {
6911 {
6916 }
6917 }
6918
6919 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6920 {
6922 {
6925 }
6926
6928 }
6929
6931 {
6937 }
6938
6940
6942 {
6944
6945 if (!action)
6946 {
6947 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6948 return;
6949 }
6950
6952 if (!ai)
6953 {
6955 return;
6956 }
6957
6959 if (!action_array)
6960 {
6961 action_array = new array<ActionBase_Basic>;
6963 }
6964 if (LogManager.IsActionLogEnable())
6965 {
6966 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6967 }
6968
6969 if (action_array.Find(action) != -1)
6970 {
6971 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6972 }
6973 else
6974 {
6975 action_array.Insert(action);
6976 }
6977 }
6978
6980 {
6982 ActionBase action = player.GetActionManager().GetAction(actionName);
6985
6986 if (action_array)
6987 {
6988 action_array.RemoveItem(action);
6989 }
6990 }
6991
6992
6993
6995 {
6996 ActionOverrideData overrideData = new ActionOverrideData();
7000
7002 if (!actionMap)
7003 {
7006 }
7007
7008 actionMap.Insert(this.
Type(), overrideData);
7009
7010 }
7011
7013
7015
7016
7018 {
7021
7024
7025 string config_to_search = "CfgVehicles";
7026 string muzzle_owner_config;
7027
7029 {
7030 if (IsInherited(Weapon))
7031 config_to_search = "CfgWeapons";
7032
7033 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7034
7035 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7036
7038
7039 if (config_OnFire_subclass_count > 0)
7040 {
7041 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7042
7043 for (int i = 0; i < config_OnFire_subclass_count; i++)
7044 {
7045 string particle_class = "";
7047 string config_OnFire_entry = config_OnFire_class + particle_class;
7048 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7049 WPOF_array.Insert(WPOF);
7050 }
7051
7052
7054 }
7055 }
7056
7058 {
7059 config_to_search = "CfgWeapons";
7060 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7061
7062 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7063
7065
7066 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7067 {
7068 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7069
7070 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7071 {
7072 string particle_class2 = "";
7074 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7075 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7076 WPOBE_array.Insert(WPOBE);
7077 }
7078
7079
7081 }
7082 }
7083 }
7084
7085
7087 {
7090
7092 {
7093 string config_to_search = "CfgVehicles";
7094
7095 if (IsInherited(Weapon))
7096 config_to_search = "CfgWeapons";
7097
7098 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7099 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7100
7101 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7102 {
7103
7105
7107 {
7109 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7111 return;
7112 }
7113
7116
7117
7118
7120 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7121
7122 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7123 {
7124 string particle_class = "";
7126 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7128
7129 if (entry_type == CT_CLASS)
7130 {
7131 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7132 WPOOH_array.Insert(WPOF);
7133 }
7134 }
7135
7136
7138 }
7139 }
7140 }
7141
7143 {
7145 }
7146
7148 {
7150 {
7152
7155
7158
7159 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7160 }
7161 }
7162
7164 {
7166 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7167
7169 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7170
7172 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7173
7175 {
7177 }
7178 }
7179
7181 {
7183 }
7184
7186 {
7189 else
7191
7193 {
7196 }
7197 else
7198 {
7201
7204 }
7205
7207 }
7208
7210 {
7212 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7213 }
7214
7216 {
7218 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7220 }
7221
7223 {
7225 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7226 }
7227
7229 {
7232
7233 OverheatingParticle OP = new OverheatingParticle();
7238
7240 }
7241
7243 {
7246
7247 return -1;
7248 }
7249
7251 {
7253 {
7256
7257 for (int i = count; i > 0; --i)
7258 {
7259 int id = i - 1;
7262
7265
7266 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7267 {
7268 if (p)
7269 {
7272 }
7273 }
7274 }
7275 }
7276 }
7277
7279 {
7281 {
7283 {
7284 int id = i - 1;
7286
7287 if (OP)
7288 {
7290
7291 if (p)
7292 {
7294 }
7295
7296 delete OP;
7297 }
7298 }
7299
7302 }
7303 }
7304
7307 {
7308 return 0.0;
7309 }
7310
7311
7313 {
7314 return 250;
7315 }
7316
7318 {
7319 return 0;
7320 }
7321
7324 {
7326 return true;
7327
7328 return false;
7329 }
7330
7333 {
7336
7338 {
7340 }
7341 else
7342 {
7343
7345 }
7346
7348 }
7349
7356 {
7357 return -1;
7358 }
7359
7360
7361
7362
7364 {
7366 {
7368 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7369
7370 if (r_index >= 0)
7371 {
7372 InventoryLocation r_il = new InventoryLocation;
7373 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7374
7375 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7378 {
7379 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7380 }
7382 {
7383 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7384 }
7385
7386 }
7387
7388 player.GetHumanInventory().ClearUserReservedLocation(this);
7389 }
7390
7393 }
7394
7395
7396
7397
7399 {
7400 return ItemBase.m_DebugActionsMask;
7401 }
7402
7404 {
7405 return ItemBase.m_DebugActionsMask & mask;
7406 }
7407
7409 {
7410 ItemBase.m_DebugActionsMask = mask;
7411 }
7412
7414 {
7415 ItemBase.m_DebugActionsMask |= mask;
7416 }
7417
7419 {
7420 ItemBase.m_DebugActionsMask &= ~mask;
7421 }
7422
7424 {
7426 {
7428 }
7429 else
7430 {
7432 }
7433 }
7434
7435
7437 {
7438 if (GetEconomyProfile())
7439 {
7440 float q_max = GetEconomyProfile().GetQuantityMax();
7441 if (q_max > 0)
7442 {
7443 float q_min = GetEconomyProfile().GetQuantityMin();
7444 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7445
7447 {
7448 ComponentEnergyManager comp = GetCompEM();
7450 {
7452 }
7453 }
7455 {
7457
7458 }
7459
7460 }
7461 }
7462 }
7463
7466 {
7467 EntityAI parent = GetHierarchyParent();
7468
7469 if (parent)
7470 {
7471 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7472 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7473 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7474 }
7475 }
7476
7479 {
7480 EntityAI parent = GetHierarchyParent();
7481
7482 if (parent)
7483 {
7484 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7485 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7486 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7487 }
7488 }
7489
7491 {
7492
7493
7494
7495
7497
7499 {
7500 if (ScriptInputUserData.CanStoreInputUserData())
7501 {
7502 ScriptInputUserData ctx = new ScriptInputUserData;
7508 ctx.
Write(use_stack_max);
7511
7513 {
7514 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7515 }
7516 }
7517 }
7518 else if (!
GetGame().IsMultiplayer())
7519 {
7521 }
7522 }
7523
7525 {
7527 }
7528
7530 {
7532 }
7533
7535 {
7537 }
7538
7540 {
7541
7542 return false;
7543 }
7544
7546 {
7547 return false;
7548 }
7549
7553 {
7554 return false;
7555 }
7556
7558 {
7559 return "";
7560 }
7561
7563
7565 {
7566 return false;
7567 }
7568
7570 {
7571 return true;
7572 }
7573
7574
7575
7577 {
7578 return true;
7579 }
7580
7582 {
7583 return true;
7584 }
7585
7587 {
7588 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7590 }
7591
7593 {
7595 }
7596
7598 {
7600 if (!is_being_placed)
7602 SetSynchDirty();
7603 }
7604
7605
7607
7609 {
7611 }
7612
7614 {
7616 }
7617
7619 {
7620 return 1;
7621 }
7622
7624 {
7625 return false;
7626 }
7627
7629 {
7631 SetSynchDirty();
7632 }
7633
7634
7635
7636
7637
7638
7639
7640
7641
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
7669 {
7670 super.OnMovedInsideCargo(container);
7671
7672 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7673 }
7674
7675 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7676 {
7677 super.EEItemLocationChanged(oldLoc,newLoc);
7678
7679 PlayerBase new_player = null;
7680 PlayerBase old_player = null;
7681
7682 if (newLoc.GetParent())
7683 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7684
7685 if (oldLoc.GetParent())
7686 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7687
7689 {
7690 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7691
7692 if (r_index >= 0)
7693 {
7694 InventoryLocation r_il = new InventoryLocation;
7695 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7696
7697 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7700 {
7701 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7702 }
7704 {
7705 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7706 }
7707
7708 }
7709 }
7710
7712 {
7713 if (new_player)
7714 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7715
7716 if (new_player == old_player)
7717 {
7718
7719 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7720 {
7722 {
7723 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7724 {
7725 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7726 }
7727 }
7728 else
7729 {
7730 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7731 }
7732 }
7733
7734 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7735 {
7736 int type = oldLoc.GetType();
7738 {
7739 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7740 }
7742 {
7743 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7744 }
7745 }
7746 if (!m_OldLocation)
7747 {
7748 m_OldLocation = new InventoryLocation;
7749 }
7750 m_OldLocation.Copy(oldLoc);
7751 }
7752 else
7753 {
7754 if (m_OldLocation)
7755 {
7756 m_OldLocation.Reset();
7757 }
7758 }
7759
7761 }
7762 else
7763 {
7764 if (new_player)
7765 {
7766 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7767 if (res_index >= 0)
7768 {
7769 InventoryLocation il = new InventoryLocation;
7770 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7772 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7775 {
7776 il.
GetParent().GetOnReleaseLock().Invoke(it);
7777 }
7779 {
7781 }
7782
7783 }
7784 }
7786 {
7787
7789 }
7790
7791 if (m_OldLocation)
7792 {
7793 m_OldLocation.Reset();
7794 }
7795 }
7796 }
7797
7798 override void EOnContact(IEntity other, Contact extra)
7799 {
7801 {
7802 int liquidType = -1;
7804 if (impactSpeed > 0.0)
7805 {
7807 #ifndef SERVER
7809 #else
7811 SetSynchDirty();
7812 #endif
7814 }
7815 }
7816
7817 #ifdef SERVER
7818 if (GetCompEM() && GetCompEM().IsPlugged())
7819 {
7820 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7821 GetCompEM().UnplugThis();
7822 }
7823 #endif
7824 }
7825
7827
7829 {
7831 }
7832
7834 {
7835
7836 }
7837
7839 {
7840 super.OnItemLocationChanged(old_owner, new_owner);
7841
7842 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7843 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7844
7845 if (!relatedPlayer && playerNew)
7846 relatedPlayer = playerNew;
7847
7848 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7849 {
7851 if (actionMgr)
7852 {
7853 ActionBase currentAction = actionMgr.GetRunningAction();
7854 if (currentAction)
7856 }
7857 }
7858
7859 Man ownerPlayerOld = null;
7860 Man ownerPlayerNew = null;
7861
7862 if (old_owner)
7863 {
7864 if (old_owner.
IsMan())
7865 {
7866 ownerPlayerOld = Man.Cast(old_owner);
7867 }
7868 else
7869 {
7870 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7871 }
7872 }
7873 else
7874 {
7876 {
7878
7879 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7880 {
7881 GetCompEM().UnplugThis();
7882 }
7883 }
7884 }
7885
7886 if (new_owner)
7887 {
7888 if (new_owner.
IsMan())
7889 {
7890 ownerPlayerNew = Man.Cast(new_owner);
7891 }
7892 else
7893 {
7894 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7895 }
7896 }
7897
7898 if (ownerPlayerOld != ownerPlayerNew)
7899 {
7900 if (ownerPlayerOld)
7901 {
7902 array<EntityAI> subItemsExit = new array<EntityAI>;
7904 for (int i = 0; i < subItemsExit.Count(); i++)
7905 {
7908 }
7909 }
7910
7911 if (ownerPlayerNew)
7912 {
7913 array<EntityAI> subItemsEnter = new array<EntityAI>;
7915 for (int j = 0; j < subItemsEnter.Count(); j++)
7916 {
7919 }
7920 }
7921 }
7922 else if (ownerPlayerNew != null)
7923 {
7924 PlayerBase nplayer;
7925 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7926 {
7927 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7929 for (int k = 0; k < subItemsUpdate.Count(); k++)
7930 {
7932 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7933 }
7934 }
7935 }
7936
7937 if (old_owner)
7938 old_owner.OnChildItemRemoved(this);
7939 if (new_owner)
7940 new_owner.OnChildItemReceived(this);
7941 }
7942
7943
7945 {
7946 super.EEDelete(parent);
7947 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7948 if (player)
7949 {
7951
7952 if (player.IsAlive())
7953 {
7954 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7955 if (r_index >= 0)
7956 {
7957 InventoryLocation r_il = new InventoryLocation;
7958 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7959
7960 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7963 {
7964 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7965 }
7967 {
7968 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7969 }
7970
7971 }
7972
7973 player.RemoveQuickBarEntityShortcut(this);
7974 }
7975 }
7976 }
7977
7979 {
7980 super.EEKilled(killer);
7981
7984 {
7985 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7986 {
7987 if (IsMagazine())
7988 {
7989 if (Magazine.Cast(this).GetAmmoCount() > 0)
7990 {
7992 }
7993 }
7994 else
7995 {
7997 }
7998 }
7999 }
8000 }
8001
8003 {
8004 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8005
8006 super.OnWasAttached(parent, slot_id);
8007
8010
8012 }
8013
8015 {
8016 super.OnWasDetached(parent, slot_id);
8017
8020 }
8021
8023 {
8024 int idx;
8027
8028 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8029 if (inventory_slots.Count() < 1)
8030 {
8031 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8032 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8033 }
8034 else
8035 {
8036 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8037 }
8038
8039 idx = inventory_slots.Find(slot);
8040 if (idx < 0)
8041 return "";
8042
8043 return attach_types.Get(idx);
8044 }
8045
8047 {
8048 int idx = -1;
8049 string slot;
8050
8053
8054 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8055 if (inventory_slots.Count() < 1)
8056 {
8057 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8058 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8059 }
8060 else
8061 {
8062 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8063 if (detach_types.Count() < 1)
8064 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8065 }
8066
8067 for (int i = 0; i < inventory_slots.Count(); i++)
8068 {
8069 slot = inventory_slots.Get(i);
8070 }
8071
8072 if (slot != "")
8073 {
8074 if (detach_types.Count() == 1)
8075 idx = 0;
8076 else
8077 idx = inventory_slots.Find(slot);
8078 }
8079 if (idx < 0)
8080 return "";
8081
8082 return detach_types.Get(idx);
8083 }
8084
8086 {
8087
8089
8090
8091 float min_time = 1;
8092 float max_time = 3;
8093 float delay = Math.RandomFloat(min_time, max_time);
8094
8095 explode_timer.Run(delay, this, "DoAmmoExplosion");
8096 }
8097
8099 {
8100 Magazine magazine = Magazine.Cast(this);
8101 int pop_sounds_count = 6;
8102 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8103
8104
8105 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8106 string sound_name = pop_sounds[ sound_idx ];
8108
8109
8110 magazine.ServerAddAmmoCount(-1);
8111
8112
8113 float min_temp_to_explode = 100;
8114
8115 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
8116 {
8118 }
8119 }
8120
8121
8122 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8123 {
8124 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8125
8126 const int CHANCE_DAMAGE_CARGO = 4;
8127 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8128 const int CHANCE_DAMAGE_NOTHING = 2;
8129
8131 {
8132 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8133 int chances;
8134 int rnd;
8135
8136 if (GetInventory().GetCargo())
8137 {
8138 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8139 rnd = Math.RandomInt(0,chances);
8140
8141 if (rnd < CHANCE_DAMAGE_CARGO)
8142 {
8144 }
8145 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8146 {
8148 }
8149 }
8150 else
8151 {
8152 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8153 rnd = Math.RandomInt(0,chances);
8154
8155 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8156 {
8158 }
8159 }
8160 }
8161 }
8162
8164 {
8165 if (GetInventory().GetCargo())
8166 {
8167 int item_count = GetInventory().GetCargo().GetItemCount();
8168 if (item_count > 0)
8169 {
8170 int random_pick = Math.RandomInt(0, item_count);
8172 if (!item.IsExplosive())
8173 {
8174 item.AddHealth("","",damage);
8175 return true;
8176 }
8177 }
8178 }
8179 return false;
8180 }
8181
8183 {
8184 int attachment_count = GetInventory().AttachmentCount();
8185 if (attachment_count > 0)
8186 {
8187 int random_pick = Math.RandomInt(0, attachment_count);
8188 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8189 if (!attachment.IsExplosive())
8190 {
8191 attachment.AddHealth("","",damage);
8192 return true;
8193 }
8194 }
8195 return false;
8196 }
8197
8199 {
8201 }
8202
8204 {
8206 return GetInventory().CanRemoveEntity();
8207
8208 return false;
8209 }
8210
8212 {
8214 return;
8215
8217 {
8218 if (ScriptInputUserData.CanStoreInputUserData())
8219 {
8220 ScriptInputUserData ctx = new ScriptInputUserData;
8225 ctx.
Write(destination_entity);
8229 }
8230 }
8231 else if (!
GetGame().IsMultiplayer())
8232 {
8234 }
8235 }
8236
8238 {
8240 return;
8241
8242 float split_quantity_new;
8246 InventoryLocation loc = new InventoryLocation;
8247
8248 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8249 {
8251 split_quantity_new = stack_max;
8252 else
8254
8255 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8256 if (new_item)
8257 {
8258 new_item.SetResultOfSplit(true);
8259 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8261 new_item.SetQuantity(split_quantity_new);
8262 }
8263 }
8264 else if (destination_entity && slot_id == -1)
8265 {
8266 if (quantity > stack_max)
8267 split_quantity_new = stack_max;
8268 else
8269 split_quantity_new = quantity;
8270
8272 {
8275 }
8276
8277 if (new_item)
8278 {
8279 new_item.SetResultOfSplit(true);
8280 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8282 new_item.SetQuantity(split_quantity_new);
8283 }
8284 }
8285 else
8286 {
8287 if (stack_max != 0)
8288 {
8290 {
8292 }
8293
8294 if (split_quantity_new == 0)
8295 {
8296 if (!
GetGame().IsMultiplayer())
8297 player.PhysicalPredictiveDropItem(this);
8298 else
8299 player.ServerDropEntity(this);
8300 return;
8301 }
8302
8304
8305 if (new_item)
8306 {
8307 new_item.SetResultOfSplit(true);
8308 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8310 new_item.SetQuantity(stack_max);
8311 new_item.PlaceOnSurface();
8312 }
8313 }
8314 }
8315 }
8316
8318 {
8320 return;
8321
8322 float split_quantity_new;
8326 InventoryLocation loc = new InventoryLocation;
8327
8328 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8329 {
8331 split_quantity_new = stack_max;
8332 else
8334
8335 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8336 if (new_item)
8337 {
8338 new_item.SetResultOfSplit(true);
8339 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8341 new_item.SetQuantity(split_quantity_new);
8342 }
8343 }
8344 else if (destination_entity && slot_id == -1)
8345 {
8346 if (quantity > stack_max)
8347 split_quantity_new = stack_max;
8348 else
8349 split_quantity_new = quantity;
8350
8352 {
8355 }
8356
8357 if (new_item)
8358 {
8359 new_item.SetResultOfSplit(true);
8360 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8362 new_item.SetQuantity(split_quantity_new);
8363 }
8364 }
8365 else
8366 {
8367 if (stack_max != 0)
8368 {
8370 {
8372 }
8373
8375
8376 if (new_item)
8377 {
8378 new_item.SetResultOfSplit(true);
8379 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8381 new_item.SetQuantity(stack_max);
8382 new_item.PlaceOnSurface();
8383 }
8384 }
8385 }
8386 }
8387
8389 {
8391 return;
8392
8394 {
8395 if (ScriptInputUserData.CanStoreInputUserData())
8396 {
8397 ScriptInputUserData ctx = new ScriptInputUserData;
8402 dst.WriteToContext(ctx);
8404 }
8405 }
8406 else if (!
GetGame().IsMultiplayer())
8407 {
8409 }
8410 }
8411
8413 {
8415 return;
8416
8418 {
8419 if (ScriptInputUserData.CanStoreInputUserData())
8420 {
8421 ScriptInputUserData ctx = new ScriptInputUserData;
8426 ctx.
Write(destination_entity);
8432 }
8433 }
8434 else if (!
GetGame().IsMultiplayer())
8435 {
8437 }
8438 }
8439
8441 {
8443 }
8444
8446 {
8448 return this;
8449
8451 float split_quantity_new;
8453 if (dst.IsValid())
8454 {
8455 int slot_id = dst.GetSlot();
8457
8458 if (quantity > stack_max)
8459 split_quantity_new = stack_max;
8460 else
8461 split_quantity_new = quantity;
8462
8464
8465 if (new_item)
8466 {
8467 new_item.SetResultOfSplit(true);
8468 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8471 }
8472
8473 return new_item;
8474 }
8475
8476 return null;
8477 }
8478
8480 {
8482 return;
8483
8485 float split_quantity_new;
8487 if (destination_entity)
8488 {
8490 if (quantity > stackable)
8491 split_quantity_new = stackable;
8492 else
8493 split_quantity_new = quantity;
8494
8495 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8496 if (new_item)
8497 {
8498 new_item.SetResultOfSplit(true);
8499 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8501 new_item.SetQuantity(split_quantity_new);
8502 }
8503 }
8504 }
8505
8507 {
8509 return;
8510
8512 {
8513 if (ScriptInputUserData.CanStoreInputUserData())
8514 {
8515 ScriptInputUserData ctx = new ScriptInputUserData;
8520 ItemBase destination_entity =
this;
8521 ctx.
Write(destination_entity);
8525 }
8526 }
8527 else if (!
GetGame().IsMultiplayer())
8528 {
8530 }
8531 }
8532
8534 {
8536 return;
8537
8539 float split_quantity_new;
8541 if (player)
8542 {
8544 if (quantity > stackable)
8545 split_quantity_new = stackable;
8546 else
8547 split_quantity_new = quantity;
8548
8549 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8550 new_item =
ItemBase.Cast(in_hands);
8551 if (new_item)
8552 {
8553 new_item.SetResultOfSplit(true);
8554 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8556 new_item.SetQuantity(split_quantity_new);
8557 }
8558 }
8559 }
8560
8562 {
8564 return;
8565
8567 float split_quantity_new = Math.Floor(quantity * 0.5);
8568
8570
8571 if (new_item)
8572 {
8573 if (new_item.GetQuantityMax() < split_quantity_new)
8574 {
8575 split_quantity_new = new_item.GetQuantityMax();
8576 }
8577
8578 new_item.SetResultOfSplit(true);
8579 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8580
8582 {
8585 }
8586 else
8587 {
8590 }
8591 }
8592 }
8593
8595 {
8597 return;
8598
8600 float split_quantity_new = Math.Floor(quantity / 2);
8601
8602 InventoryLocation invloc = new InventoryLocation;
8604
8606 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8607
8608 if (new_item)
8609 {
8610 if (new_item.GetQuantityMax() < split_quantity_new)
8611 {
8612 split_quantity_new = new_item.GetQuantityMax();
8613 }
8615 {
8618 }
8619 else
8620 {
8623 }
8624 }
8625 }
8626
8629 {
8630 SetWeightDirty();
8632
8633 if (parent)
8634 parent.OnAttachmentQuantityChangedEx(this, delta);
8635
8637 {
8639 {
8641 }
8643 {
8644 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8646 }
8647 }
8648
8649 }
8650
8653 {
8654
8655 }
8656
8659 {
8661 }
8662
8664 {
8665 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8666
8668 {
8669 if (newLevel == GameConstants.STATE_RUINED)
8670 {
8672 EntityAI parent = GetHierarchyParent();
8673 if (parent && parent.IsFireplace())
8674 {
8675 CargoBase cargo = GetInventory().GetCargo();
8676 if (cargo)
8677 {
8679 {
8681 }
8682 }
8683 }
8684 }
8685
8687 {
8688
8690 return;
8691 }
8692
8693 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8694 {
8696 }
8697 }
8698 }
8699
8700
8702 {
8703 super.OnRightClick();
8704
8706 {
8708 {
8709 if (ScriptInputUserData.CanStoreInputUserData())
8710 {
8711 vector m4[4];
8713
8714 EntityAI root = GetHierarchyRoot();
8715
8716 InventoryLocation dst = new InventoryLocation;
8718 {
8719 if (root)
8720 {
8721 root.GetTransform(m4);
8723 }
8724 else
8725 GetInventory().GetCurrentInventoryLocation(dst);
8726 }
8727 else
8728 {
8730
8731
8732 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8733 {
8734 if (root)
8735 {
8736 root.GetTransform(m4);
8738 }
8739 else
8740 GetInventory().GetCurrentInventoryLocation(dst);
8741 }
8742 else
8743 {
8744 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8745 }
8746 }
8747
8748 ScriptInputUserData ctx = new ScriptInputUserData;
8756 }
8757 }
8758 else if (!
GetGame().IsMultiplayer())
8759 {
8761 }
8762 }
8763 }
8764
8765 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8766 {
8767
8768 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8769 return false;
8770
8771 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8772 return false;
8773
8774
8776 return false;
8777
8778
8779 Magazine mag = Magazine.Cast(this);
8780 if (mag)
8781 {
8782 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8783 return false;
8784
8785 if (stack_max_limit)
8786 {
8787 Magazine other_mag = Magazine.Cast(other_item);
8788 if (other_item)
8789 {
8790 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8791 return false;
8792 }
8793
8794 }
8795 }
8796 else
8797 {
8798
8800 return false;
8801
8803 return false;
8804 }
8805
8806 PlayerBase player = null;
8807 if (CastTo(player, GetHierarchyRootPlayer()))
8808 {
8809 if (player.GetInventory().HasAttachment(this))
8810 return false;
8811
8812 if (player.IsItemsToDelete())
8813 return false;
8814 }
8815
8816 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8817 return false;
8818
8819 int slotID;
8821 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8822 return false;
8823
8824 return true;
8825 }
8826
8828 {
8830 }
8831
8833 {
8834 return m_IsResultOfSplit;
8835 }
8836
8838 {
8839 m_IsResultOfSplit = value;
8840 }
8841
8843 {
8845 }
8846
8848 {
8849 float other_item_quantity = other_item.GetQuantity();
8850 float this_free_space;
8851
8853
8855
8856 if (other_item_quantity > this_free_space)
8857 {
8858 return this_free_space;
8859 }
8860 else
8861 {
8862 return other_item_quantity;
8863 }
8864 }
8865
8867 {
8869 }
8870
8872 {
8874 return;
8875
8876 if (!IsMagazine() && other_item)
8877 {
8879 if (quantity_used != 0)
8880 {
8881 float hp1 = GetHealth01("","");
8882 float hp2 = other_item.GetHealth01("","");
8883 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8884 hpResult = hpResult / (
GetQuantity() + quantity_used);
8885
8886 hpResult *= GetMaxHealth();
8887 Math.Round(hpResult);
8888 SetHealth("", "Health", hpResult);
8889
8891 other_item.AddQuantity(-quantity_used);
8892 }
8893 }
8895 }
8896
8898 {
8899 #ifdef SERVER
8900 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8901 GetHierarchyParent().IncreaseLifetimeUp();
8902 #endif
8903 };
8904
8906 {
8907 PlayerBase p = PlayerBase.Cast(player);
8908
8909 array<int> recipesIds = p.m_Recipes;
8910 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8911 if (moduleRecipesManager)
8912 {
8913 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8914 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8915 }
8916
8917 for (int i = 0;i < recipesIds.Count(); i++)
8918 {
8919 int key = recipesIds.Get(i);
8920 string recipeName = moduleRecipesManager.GetRecipeName(key);
8922 }
8923 }
8924
8925
8926 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8927 {
8928 super.GetDebugActions(outputList);
8929
8930
8935
8936
8940
8944
8945
8948
8949
8951 {
8954 }
8955
8957
8960
8964 }
8965
8966
8967
8968
8970 {
8971 super.OnAction(action_id, player, ctx);
8972 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8973 {
8974 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8975 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8976 PlayerBase p = PlayerBase.Cast(player);
8977 if (
EActions.RECIPES_RANGE_START < 1000)
8978 {
8979 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8980 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8981 }
8982 }
8983 #ifndef SERVER
8984 else if (action_id ==
EActions.WATCH_PLAYER)
8985 {
8986 PluginDeveloper.SetDeveloperItemClientEx(player);
8987 }
8988 #endif
8990 {
8991 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8992 {
8993 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8994 OnDebugButtonPressServer(id + 1);
8995 }
8996
8997 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8998 {
8999 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9001 }
9002
9003 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9004 {
9005 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9007 }
9008
9009 else if (action_id ==
EActions.ADD_QUANTITY)
9010 {
9011 if (IsMagazine())
9012 {
9013 Magazine mag = Magazine.Cast(this);
9014 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9015 }
9016 else
9017 {
9019 }
9020
9021 if (m_EM)
9022 {
9023 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9024 }
9025
9026 }
9027
9028 else if (action_id ==
EActions.REMOVE_QUANTITY)
9029 {
9030 if (IsMagazine())
9031 {
9032 Magazine mag2 = Magazine.Cast(this);
9033 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9034 }
9035 else
9036 {
9038 }
9039 if (m_EM)
9040 {
9041 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9042 }
9043
9044 }
9045
9046 else if (action_id ==
EActions.SET_QUANTITY_0)
9047 {
9049
9050 if (m_EM)
9051 {
9052 m_EM.SetEnergy(0);
9053 }
9054 }
9055
9056 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9057 {
9059
9060 if (m_EM)
9061 {
9062 m_EM.SetEnergy(m_EM.GetEnergyMax());
9063 }
9064 }
9065
9066 else if (action_id ==
EActions.ADD_HEALTH)
9067 {
9068 AddHealth("","",GetMaxHealth("","Health")/5);
9069 }
9070 else if (action_id ==
EActions.REMOVE_HEALTH)
9071 {
9072 AddHealth("","",-GetMaxHealth("","Health")/5);
9073 }
9074 else if (action_id ==
EActions.DESTROY_HEALTH)
9075 {
9076 SetHealth01("","",0);
9077 }
9078 else if (action_id ==
EActions.WATCH_ITEM)
9079 {
9081 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9082 #ifdef DEVELOPER
9083 SetDebugDeveloper_item(this);
9084 #endif
9085 }
9086
9087 else if (action_id ==
EActions.ADD_TEMPERATURE)
9088 {
9089 AddTemperature(20);
9090
9091 }
9092
9093 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9094 {
9095 AddTemperature(-20);
9096
9097 }
9098
9099 else if (action_id ==
EActions.FLIP_FROZEN)
9100 {
9101 SetFrozen(!GetIsFrozen());
9102
9103 }
9104
9105 else if (action_id ==
EActions.ADD_WETNESS)
9106 {
9108
9109 }
9110
9111 else if (action_id ==
EActions.REMOVE_WETNESS)
9112 {
9114
9115 }
9116
9117 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9118 {
9121
9122
9123 }
9124
9125 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9126 {
9129 }
9130
9131 else if (action_id ==
EActions.MAKE_SPECIAL)
9132 {
9133 auto debugParams = DebugSpawnParams.WithPlayer(player);
9134 OnDebugSpawnEx(debugParams);
9135 }
9136
9137 else if (action_id ==
EActions.DELETE)
9138 {
9139 Delete();
9140 }
9141
9142 }
9143
9144
9145 return false;
9146 }
9147
9148
9149
9150
9154
9157
9158
9159
9161 {
9162 return false;
9163 }
9164
9165
9167 {
9168 return true;
9169 }
9170
9171
9173 {
9174 return true;
9175 }
9176
9177
9178
9180 {
9181 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9183 }
9184
9187 {
9188 return null;
9189 }
9190
9192 {
9193 return false;
9194 }
9195
9197 {
9198 return false;
9199 }
9200
9204
9205
9207 {
9208 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9209 return module_repairing.CanRepair(this, item_repair_kit);
9210 }
9211
9212
9213 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9214 {
9215 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9216 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9217 }
9218
9219
9221 {
9222
9223
9224
9225
9226
9227
9228
9229
9230 return 1;
9231 }
9232
9233
9234
9236 {
9238 }
9239
9240
9241
9243 {
9245 }
9246
9247
9256 {
9257 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9258
9259 if (player)
9260 {
9261 player.MessageStatus(text);
9262 }
9263 }
9264
9265
9274 {
9275 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9276
9277 if (player)
9278 {
9279 player.MessageAction(text);
9280 }
9281 }
9282
9283
9292 {
9293 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9294
9295 if (player)
9296 {
9297 player.MessageFriendly(text);
9298 }
9299 }
9300
9301
9310 {
9311 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9312
9313 if (player)
9314 {
9315 player.MessageImportant(text);
9316 }
9317 }
9318
9320 {
9321 return true;
9322 }
9323
9324
9325 override bool KindOf(
string tag)
9326 {
9327 bool found = false;
9328 string item_name = this.
GetType();
9331
9332 int array_size = item_tag_array.Count();
9333 for (int i = 0; i < array_size; i++)
9334 {
9335 if (item_tag_array.Get(i) == tag)
9336 {
9337 found = true;
9338 break;
9339 }
9340 }
9341 return found;
9342 }
9343
9344
9346 {
9347
9348 super.OnRPC(sender, rpc_type,ctx);
9349
9350
9351 switch (rpc_type)
9352 {
9353 #ifndef SERVER
9354 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9355 Param2<bool, string> p = new Param2<bool, string>(false, "");
9356
9358 return;
9359
9360 bool play = p.param1;
9361 string soundSet = p.param2;
9362
9363 if (play)
9364 {
9366 {
9368 {
9370 }
9371 }
9372 else
9373 {
9375 }
9376 }
9377 else
9378 {
9380 }
9381
9382 break;
9383 #endif
9384
9385 }
9386
9388 {
9390 }
9391 }
9392
9393
9394
9395
9397 {
9398 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9399 return plugin.GetID(
name);
9400 }
9401
9403 {
9404 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9405 return plugin.GetName(id);
9406 }
9407
9410 {
9411
9412
9413 int varFlags;
9414 if (!ctx.
Read(varFlags))
9415 return;
9416
9417 if (varFlags & ItemVariableFlags.FLOAT)
9418 {
9420 }
9421 }
9422
9424 {
9425
9426 super.SerializeNumericalVars(floats_out);
9427
9428
9429
9431 {
9433 }
9434
9436 {
9438 }
9439
9441 {
9443 }
9444
9446 {
9451 }
9452
9454 {
9456 }
9457 }
9458
9460 {
9461
9462 super.DeSerializeNumericalVars(floats);
9463
9464
9465 int index = 0;
9466 int mask = Math.Round(floats.Get(index));
9467
9468 index++;
9469
9471 {
9473 {
9475 }
9476 else
9477 {
9478 float quantity = floats.Get(index);
9480 }
9481 index++;
9482 }
9483
9485 {
9486 float wet = floats.Get(index);
9488 index++;
9489 }
9490
9492 {
9493 int liquidtype = Math.Round(floats.Get(index));
9495 index++;
9496 }
9497
9499 {
9501 index++;
9503 index++;
9505 index++;
9507 index++;
9508 }
9509
9511 {
9512 int cleanness = Math.Round(floats.Get(index));
9514 index++;
9515 }
9516 }
9517
9519 {
9520 super.WriteVarsToCTX(ctx);
9521
9522
9524 {
9526 }
9527
9529 {
9531 }
9532
9534 {
9536 }
9537
9539 {
9540 int r,g,b,a;
9546 }
9547
9549 {
9551 }
9552 }
9553
9555 {
9556 if (!super.ReadVarsFromCTX(ctx,version))
9557 return false;
9558
9559 int intValue;
9560 float value;
9561
9562 if (version < 140)
9563 {
9564 if (!ctx.
Read(intValue))
9565 return false;
9566
9567 m_VariablesMask = intValue;
9568 }
9569
9571 {
9572 if (!ctx.
Read(value))
9573 return false;
9574
9576 {
9578 }
9579 else
9580 {
9582 }
9583 }
9584
9585 if (version < 140)
9586 {
9588 {
9589 if (!ctx.
Read(value))
9590 return false;
9591 SetTemperatureDirect(value);
9592 }
9593 }
9594
9596 {
9597 if (!ctx.
Read(value))
9598 return false;
9600 }
9601
9603 {
9604 if (!ctx.
Read(intValue))
9605 return false;
9607 }
9608
9610 {
9611 int r,g,b,a;
9613 return false;
9615 return false;
9617 return false;
9619 return false;
9620
9622 }
9623
9625 {
9626 if (!ctx.
Read(intValue))
9627 return false;
9629 }
9630
9631 if (version >= 138 && version < 140)
9632 {
9634 {
9635 if (!ctx.
Read(intValue))
9636 return false;
9637 SetFrozen(intValue);
9638 }
9639 }
9640
9641 return true;
9642 }
9643
9644
9646 {
9649 {
9651 }
9652
9653 if (!super.OnStoreLoad(ctx, version))
9654 {
9656 return false;
9657 }
9658
9659 if (version >= 114)
9660 {
9661 bool hasQuickBarIndexSaved;
9662
9663 if (!ctx.
Read(hasQuickBarIndexSaved))
9664 {
9666 return false;
9667 }
9668
9669 if (hasQuickBarIndexSaved)
9670 {
9671 int itmQBIndex;
9672
9673
9674 if (!ctx.
Read(itmQBIndex))
9675 {
9677 return false;
9678 }
9679
9680 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9681 if (itmQBIndex != -1 && parentPlayer)
9682 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9683 }
9684 }
9685 else
9686 {
9687
9688 PlayerBase player;
9689 int itemQBIndex;
9690 if (version ==
int.
MAX)
9691 {
9692 if (!ctx.
Read(itemQBIndex))
9693 {
9695 return false;
9696 }
9697 }
9698 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9699 {
9700
9701 if (!ctx.
Read(itemQBIndex))
9702 {
9704 return false;
9705 }
9706 if (itemQBIndex != -1 && player)
9707 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9708 }
9709 }
9710
9711 if (version < 140)
9712 {
9713
9714 if (!LoadVariables(ctx, version))
9715 {
9717 return false;
9718 }
9719 }
9720
9721
9723 {
9725 return false;
9726 }
9727 if (version >= 132)
9728 {
9730 if (raib)
9731 {
9733 {
9735 return false;
9736 }
9737 }
9738 }
9739
9741 return true;
9742 }
9743
9744
9745
9747 {
9748 super.OnStoreSave(ctx);
9749
9750 PlayerBase player;
9751 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9752 {
9754
9755 int itemQBIndex = -1;
9756 itemQBIndex = player.FindQuickBarEntityIndex(this);
9757 ctx.
Write(itemQBIndex);
9758 }
9759 else
9760 {
9762 }
9763
9765
9767 if (raib)
9768 {
9770 }
9771 }
9772
9773
9775 {
9776 super.AfterStoreLoad();
9777
9779 {
9781 }
9782
9784 {
9787 }
9788 }
9789
9791 {
9792 super.EEOnAfterLoad();
9793
9795 {
9797 }
9798
9801 }
9802
9804 {
9805 return false;
9806 }
9807
9808
9809
9811 {
9813 {
9814 #ifdef PLATFORM_CONSOLE
9815
9817 {
9819 if (menu)
9820 {
9822 }
9823 }
9824 #endif
9825 }
9826
9828 {
9831 }
9832
9834 {
9835 SetWeightDirty();
9837 }
9839 {
9842 }
9843
9845 {
9848 }
9850 {
9853 }
9854
9855 super.OnVariablesSynchronized();
9856 }
9857
9858
9859
9861 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9862 {
9863 if (!IsServerCheck(allow_client))
9864 return false;
9865
9867 return false;
9868
9871
9872 if (value <= (min + 0.001))
9873 value = min;
9874
9875 if (value == min)
9876 {
9877 if (destroy_config)
9878 {
9879 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9880 if (dstr)
9881 {
9883 this.Delete();
9884 return true;
9885 }
9886 }
9887 else if (destroy_forced)
9888 {
9890 this.Delete();
9891 return true;
9892 }
9893
9895 }
9896
9899
9901 {
9903
9904 if (delta)
9906 }
9907
9909
9910 return false;
9911 }
9912
9913
9915 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9916 {
9918 }
9919
9921 {
9924 }
9925
9927 {
9930 }
9931
9934 {
9935 float value_clamped = Math.Clamp(value, 0, 1);
9937 SetQuantity(result, destroy_config, destroy_forced);
9938 }
9939
9940
9943 {
9945 }
9946
9948 {
9950 }
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9962 {
9963 int slot = -1;
9964 if (GetInventory())
9965 {
9966 InventoryLocation il = new InventoryLocation;
9967 GetInventory().GetCurrentInventoryLocation(il);
9969 }
9970
9972 }
9973
9975 {
9976 float quantity_max = 0;
9977
9979 {
9980 if (attSlotID != -1)
9981 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9982
9983 if (quantity_max <= 0)
9985 }
9986
9987 if (quantity_max <= 0)
9989
9990 return quantity_max;
9991 }
9992
9994 {
9996 }
9997
9999 {
10001 }
10002
10003
10005 {
10007 }
10008
10010 {
10012 }
10013
10015 {
10017 }
10018
10019
10021 {
10022
10023 float weightEx = GetWeightEx();
10024 float special = GetInventoryAndCargoWeight();
10025 return weightEx - special;
10026 }
10027
10028
10030 {
10032 }
10033
10035 {
10037 {
10038 #ifdef DEVELOPER
10039 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10040 {
10041 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10043 }
10044 #endif
10045
10046 return GetQuantity() * GetConfigWeightModified();
10047 }
10048 else if (HasEnergyManager())
10049 {
10050 #ifdef DEVELOPER
10051 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10052 {
10053 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10054 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10055 }
10056 #endif
10057 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10058 }
10059 else
10060 {
10061 #ifdef DEVELOPER
10062 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10063 {
10064 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10065 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10066 }
10067 #endif
10068 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
10069 }
10070 }
10071
10074 {
10075 int item_count = 0;
10077
10078 if (GetInventory().GetCargo() != NULL)
10079 {
10080 item_count = GetInventory().GetCargo().GetItemCount();
10081 }
10082
10083 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10084 {
10085 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10086 if (item)
10087 item_count += item.GetNumberOfItems();
10088 }
10089 return item_count;
10090 }
10091
10094 {
10095 float weight = 0;
10096 float wetness = 1;
10097 if (include_wetness)
10100 {
10101 weight = wetness * m_ConfigWeight;
10102 }
10104 {
10105 weight = 1;
10106 }
10107 return weight;
10108 }
10109
10110
10111
10113 {
10114 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10115 {
10116 GameInventory inv = GetInventory();
10117 array<EntityAI> items = new array<EntityAI>;
10119 for (int i = 0; i < items.Count(); i++)
10120 {
10122 if (item)
10123 {
10125 }
10126 }
10127 }
10128 }
10129
10130
10131
10132
10134 {
10135 float energy = 0;
10136 if (HasEnergyManager())
10137 {
10138 energy = GetCompEM().GetEnergy();
10139 }
10140 return energy;
10141 }
10142
10143
10145 {
10146 super.OnEnergyConsumed();
10147
10149 }
10150
10152 {
10153 super.OnEnergyAdded();
10154
10156 }
10157
10158
10160 {
10161 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10162 {
10164 {
10165 float energy_0to1 = GetCompEM().GetEnergy0To1();
10167 }
10168 }
10169 }
10170
10171
10173 {
10174 return ConfigGetFloat("heatIsolation");
10175 }
10176
10178 {
10180 }
10181
10183 {
10184 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10185 if (
GetGame().ConfigIsExisting(paramPath))
10187
10188 return 0.0;
10189 }
10190
10192 {
10193 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10194 if (
GetGame().ConfigIsExisting(paramPath))
10196
10197 return 0.0;
10198 }
10199
10200 override void SetWet(
float value,
bool allow_client =
false)
10201 {
10202 if (!IsServerCheck(allow_client))
10203 return;
10204
10207
10209
10210 m_VarWet = Math.Clamp(value, min, max);
10211
10213 {
10216 }
10217 }
10218
10219 override void AddWet(
float value)
10220 {
10222 }
10223
10225 {
10227 }
10228
10230 {
10232 }
10233
10235 {
10237 }
10238
10240 {
10242 }
10243
10245 {
10247 }
10248
10249 override void OnWetChanged(
float newVal,
float oldVal)
10250 {
10253 if (newLevel != oldLevel)
10254 {
10256 }
10257 }
10258
10260 {
10261 SetWeightDirty();
10262 }
10263
10265 {
10266 return GetWetLevelInternal(
m_VarWet);
10267 }
10268
10269
10270
10272 {
10274 }
10275
10277 {
10279 }
10280
10282 {
10284 }
10285
10287 {
10289 }
10290
10291
10292
10294 {
10295 if (ConfigIsExisting("itemModelLength"))
10296 {
10297 return ConfigGetFloat("itemModelLength");
10298 }
10299 return 0;
10300 }
10301
10303 {
10304 if (ConfigIsExisting("itemAttachOffset"))
10305 {
10306 return ConfigGetFloat("itemAttachOffset");
10307 }
10308 return 0;
10309 }
10310
10311 override void SetCleanness(
int value,
bool allow_client =
false)
10312 {
10313 if (!IsServerCheck(allow_client))
10314 return;
10315
10317
10319
10322 }
10323
10325 {
10327 }
10328
10330 {
10331 return true;
10332 }
10333
10334
10335
10336
10338 {
10340 }
10341
10343 {
10345 }
10346
10347
10348
10349
10350 override void SetColor(
int r,
int g,
int b,
int a)
10351 {
10357 }
10359 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10360 {
10365 }
10366
10368 {
10370 }
10371
10374 {
10375 int r,g,b,a;
10377 r = r/255;
10378 g = g/255;
10379 b = b/255;
10380 a = a/255;
10381 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10382 }
10383
10384
10385
10386 override void SetLiquidType(
int value,
bool allow_client =
false)
10387 {
10388 if (!IsServerCheck(allow_client))
10389 return;
10390
10395 }
10396
10398 {
10399 return ConfigGetInt("varLiquidTypeInit");
10400 }
10401
10403 {
10405 }
10406
10408 {
10410 SetFrozen(false);
10411 }
10412
10415 {
10416 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10417 }
10418
10419
10422 {
10423 PlayerBase nplayer;
10424 if (PlayerBase.CastTo(nplayer, player))
10425 {
10427
10428 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10429 }
10430 }
10431
10432
10435 {
10436 PlayerBase nplayer;
10437 if (PlayerBase.CastTo(nplayer,player))
10438 {
10439
10440 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10441
10442 }
10443
10444
10445 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10446
10447
10448 if (HasEnergyManager())
10449 {
10450 GetCompEM().UpdatePlugState();
10451 }
10452 }
10453
10454
10456 {
10457 super.OnPlacementStarted(player);
10458
10460 }
10461
10462 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10463 {
10465 {
10466 m_AdminLog.OnPlacementComplete(player,
this);
10467 }
10468
10469 super.OnPlacementComplete(player, position, orientation);
10470 }
10471
10472
10473
10474
10475
10477 {
10479 {
10480 return true;
10481 }
10482 else
10483 {
10484 return false;
10485 }
10486 }
10487
10488
10490 {
10492 {
10494 }
10495 }
10496
10497
10499 {
10501 }
10502
10504 {
10506 }
10507
10508 override void InsertAgent(
int agent,
float count = 1)
10509 {
10510 if (count < 1)
10511 return;
10512
10514 }
10515
10518 {
10520 }
10521
10522
10524 {
10526 }
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10570 {
10572 return false;
10573 return true;
10574 }
10575
10577 {
10578
10580 }
10581
10582
10585 {
10586 super.CheckForRoofLimited(timeTresholdMS);
10587
10589 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10590 {
10591 m_PreviousRoofTestTime = time;
10592 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10593 }
10594 }
10595
10596
10598 {
10600 {
10601 return 0;
10602 }
10603
10604 if (GetInventory().GetAttachmentSlotsCount() != 0)
10605 {
10606 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10607 if (filter)
10608 return filter.GetProtectionLevel(type, false, system);
10609 else
10610 return 0;
10611 }
10612
10613 string subclassPath, entryName;
10614
10615 switch (type)
10616 {
10618 entryName = "biological";
10619 break;
10621 entryName = "chemical";
10622 break;
10623 default:
10624 entryName = "biological";
10625 break;
10626 }
10627
10628 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10629
10631 }
10632
10633
10634
10637 {
10638 if (!IsMagazine())
10640
10642 }
10643
10644
10645
10646
10647
10652 {
10653 return true;
10654 }
10655
10657 {
10659 }
10660
10661
10662
10663
10664
10666 {
10667 if (parent)
10668 {
10669 if (parent.IsInherited(DayZInfected))
10670 return true;
10671
10672 if (!parent.IsRuined())
10673 return true;
10674 }
10675
10676 return true;
10677 }
10678
10680 {
10681 if (!super.CanPutAsAttachment(parent))
10682 {
10683 return false;
10684 }
10685
10686 if (!IsRuined() && !parent.IsRuined())
10687 {
10688 return true;
10689 }
10690
10691 return false;
10692 }
10693
10695 {
10696
10697
10698
10699
10700 return super.CanReceiveItemIntoCargo(item);
10701 }
10702
10704 {
10705
10706
10707
10708
10709 GameInventory attachmentInv = attachment.GetInventory();
10711 {
10712 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10713 return false;
10714 }
10715
10716 InventoryLocation loc = new InventoryLocation();
10717 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10718 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10719 return false;
10720
10721 return super.CanReceiveAttachment(attachment, slotId);
10722 }
10723
10725 {
10726 if (!super.CanReleaseAttachment(attachment))
10727 return false;
10728
10729 return GetInventory().AreChildrenAccessible();
10730 }
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10753 {
10754 int id = muzzle_owner.GetMuzzleID();
10755 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10756
10757 if (WPOF_array)
10758 {
10759 for (int i = 0; i < WPOF_array.Count(); i++)
10760 {
10761 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10762
10763 if (WPOF)
10764 {
10765 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10766 }
10767 }
10768 }
10769 }
10770
10771
10773 {
10774 int id = muzzle_owner.GetMuzzleID();
10776
10777 if (WPOBE_array)
10778 {
10779 for (int i = 0; i < WPOBE_array.Count(); i++)
10780 {
10781 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10782
10783 if (WPOBE)
10784 {
10785 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10786 }
10787 }
10788 }
10789 }
10790
10791
10793 {
10794 int id = muzzle_owner.GetMuzzleID();
10795 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10796
10797 if (WPOOH_array)
10798 {
10799 for (int i = 0; i < WPOOH_array.Count(); i++)
10800 {
10801 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10802
10803 if (WPOOH)
10804 {
10805 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10806 }
10807 }
10808 }
10809 }
10810
10811
10813 {
10814 int id = muzzle_owner.GetMuzzleID();
10815 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10816
10817 if (WPOOH_array)
10818 {
10819 for (int i = 0; i < WPOOH_array.Count(); i++)
10820 {
10821 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10822
10823 if (WPOOH)
10824 {
10825 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10826 }
10827 }
10828 }
10829 }
10830
10831
10833 {
10834 int id = muzzle_owner.GetMuzzleID();
10835 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10836
10837 if (WPOOH_array)
10838 {
10839 for (int i = 0; i < WPOOH_array.Count(); i++)
10840 {
10841 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10842
10843 if (WPOOH)
10844 {
10845 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10846 }
10847 }
10848 }
10849 }
10850
10851
10852
10854 {
10856 {
10857 return true;
10858 }
10859
10860 return false;
10861 }
10862
10864 {
10866 {
10867 return true;
10868 }
10869
10870 return false;
10871 }
10872
10874 {
10876 {
10877 return true;
10878 }
10879
10880 return false;
10881 }
10882
10884 {
10885 return false;
10886 }
10887
10890 {
10891 return UATimeSpent.DEFAULT_DEPLOY;
10892 }
10893
10894
10895
10896
10898 {
10900 SetSynchDirty();
10901 }
10902
10904 {
10906 }
10907
10908
10910 {
10911 return false;
10912 }
10913
10916 {
10917 string att_type = "None";
10918
10919 if (ConfigIsExisting("soundAttType"))
10920 {
10921 att_type = ConfigGetString("soundAttType");
10922 }
10923
10925 }
10926
10928 {
10930 }
10931
10932
10933
10934
10935
10939
10941 {
10944
10946 }
10947
10948
10950 {
10952 return;
10953
10955
10958
10961
10962 SoundParameters params = new SoundParameters();
10966 }
10967
10968
10970 {
10972 return;
10973
10975 SetSynchDirty();
10976
10979 }
10980
10981
10983 {
10985 return;
10986
10988 SetSynchDirty();
10989
10992 }
10993
10995 {
10997 }
10998
11000 {
11002 }
11003
11006 {
11007 if (!
GetGame().IsDedicatedServer())
11008 {
11009 if (ConfigIsExisting("attachSoundSet"))
11010 {
11011 string cfg_path = "";
11012 string soundset = "";
11013 string type_name =
GetType();
11014
11017 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11018 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11019
11020 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11021 {
11022 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11023 {
11024 if (cfg_slot_array[i] == slot_type)
11025 {
11026 soundset = cfg_soundset_array[i];
11027 break;
11028 }
11029 }
11030 }
11031
11032 if (soundset != "")
11033 {
11034 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11036 }
11037 }
11038 }
11039 }
11040
11042 {
11043
11044 }
11045
11046 void OnApply(PlayerBase player);
11047
11049 {
11050 return 1.0;
11051 };
11052
11054 {
11056 }
11057
11059 {
11061 }
11062
11064
11066 {
11067 SetDynamicPhysicsLifeTime(0.01);
11069 }
11070
11072 {
11073 array<string> zone_names = new array<string>;
11074 GetDamageZones(zone_names);
11075 for (int i = 0; i < zone_names.Count(); i++)
11076 {
11077 SetHealthMax(zone_names.Get(i),"Health");
11078 }
11079 SetHealthMax("","Health");
11080 }
11081
11084 {
11085 float global_health = GetHealth01("","Health");
11086 array<string> zones = new array<string>;
11087 GetDamageZones(zones);
11088
11089 for (int i = 0; i < zones.Count(); i++)
11090 {
11091 SetHealth01(zones.Get(i),"Health",global_health);
11092 }
11093 }
11094
11097 {
11098 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11099 }
11100
11102 {
11103 if (!hasRootAsPlayer)
11104 {
11105 if (refParentIB)
11106 {
11107
11108 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11109 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11110
11111 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11112 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11113
11116 }
11117 else
11118 {
11119
11122 }
11123 }
11124 }
11125
11127 {
11129 {
11130 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11131 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11132 {
11133 float heatPermCoef = 1.0;
11135 while (ent)
11136 {
11137 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11138 ent = ent.GetHierarchyParent();
11139 }
11140
11141 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11142 }
11143 }
11144 }
11145
11147 {
11148
11149 EntityAI parent = GetHierarchyParent();
11150 if (!parent)
11151 {
11152 hasParent = false;
11153 hasRootAsPlayer = false;
11154 }
11155 else
11156 {
11157 hasParent = true;
11158 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11159 refParentIB =
ItemBase.Cast(parent);
11160 }
11161 }
11162
11163 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11164 {
11165
11166 }
11167
11169 {
11170
11171 return false;
11172 }
11173
11175 {
11176
11177
11178 return false;
11179 }
11180
11182 {
11183
11184 return false;
11185 }
11186
11189 {
11190 return !GetIsFrozen() &&
IsOpen();
11191 }
11192
11194 {
11195 bool hasParent = false, hasRootAsPlayer = false;
11197
11198 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11199 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11200
11201 if (wwtu || foodDecay)
11202 {
11206
11207 if (processWetness || processTemperature || processDecay)
11208 {
11210
11211 if (processWetness)
11212 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11213
11214 if (processTemperature)
11216
11217 if (processDecay)
11218 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11219 }
11220 }
11221 }
11222
11225 {
11227 }
11228
11230 {
11233
11234 return super.GetTemperatureFreezeThreshold();
11235 }
11236
11238 {
11241
11242 return super.GetTemperatureThawThreshold();
11243 }
11244
11246 {
11249
11250 return super.GetItemOverheatThreshold();
11251 }
11252
11254 {
11256 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11257
11258 return super.GetTemperatureFreezeTime();
11259 }
11260
11262 {
11264 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11265
11266 return super.GetTemperatureThawTime();
11267 }
11268
11273
11275 {
11276 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11277 }
11278
11280 {
11281 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11282 }
11283
11286 {
11288 }
11289
11291 {
11293 }
11294
11296 {
11298 }
11299
11302 {
11303 return null;
11304 }
11305
11308 {
11309 return false;
11310 }
11311
11313 {
11315 {
11318 if (!trg)
11319 {
11321 explosive = this;
11322 }
11323
11324 explosive.PairRemote(trg);
11326
11327 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11328 trg.SetPersistentPairID(persistentID);
11329 explosive.SetPersistentPairID(persistentID);
11330
11331 return true;
11332 }
11333 return false;
11334 }
11335
11338 {
11339 float ret = 1.0;
11342 ret *= GetHealth01();
11343
11344 return ret;
11345 }
11346
11347 #ifdef DEVELOPER
11348 override void SetDebugItem()
11349 {
11350 super.SetDebugItem();
11351 _itemBase = this;
11352 }
11353
11355 {
11356 string text = super.GetDebugText();
11357
11359 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11360
11361 return text;
11362 }
11363 #endif
11364
11366 {
11367 return true;
11368 }
11369
11371
11373
11375 {
11378 }
11379
11380
11388
11404}
11405
11407{
11409 if (entity)
11410 {
11411 bool is_item = entity.IsInherited(
ItemBase);
11412 if (is_item && full_quantity)
11413 {
11416 }
11417 }
11418 else
11419 {
11421 return NULL;
11422 }
11423 return entity;
11424}
11425
11427{
11428 if (item)
11429 {
11430 if (health > 0)
11431 item.SetHealth("", "", health);
11432
11433 if (item.CanHaveTemperature())
11434 {
11436 if (item.CanFreeze())
11437 item.SetFrozen(false);
11438 }
11439
11440 if (item.HasEnergyManager())
11441 {
11442 if (quantity >= 0)
11443 {
11444 item.GetCompEM().SetEnergy0To1(quantity);
11445 }
11446 else
11447 {
11449 }
11450 }
11451 else if (item.IsMagazine())
11452 {
11453 Magazine mag = Magazine.Cast(item);
11454 if (quantity >= 0)
11455 {
11456 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11457 }
11458 else
11459 {
11461 }
11462
11463 }
11464 else
11465 {
11466 if (quantity >= 0)
11467 {
11468 item.SetQuantityNormalized(quantity, false);
11469 }
11470 else
11471 {
11473 }
11474
11475 }
11476 }
11477}
11478
11479#ifdef DEVELOPER
11481#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
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 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...
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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 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 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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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.