6655{
6657 {
6658 return true;
6659 }
6660};
6661
6662
6663
6665{
6669
6671
6674
6675
6676
6677
6678
6687
6693
6698
6703
6724 protected bool m_IsResultOfSplit
6725
6727
6732
6733
6734
6736
6740
6741
6742
6744
6747
6748
6749
6755
6756
6764
6767
6768
6770
6771
6773
6774
6779
6780
6785
6786
6788
6789
6791 {
6796
6797 if (!
GetGame().IsDedicatedServer())
6798 {
6800 {
6802
6804 {
6806 }
6807 }
6808
6811 }
6812
6813 m_OldLocation = null;
6814
6816 {
6818 }
6819
6820 if (ConfigIsExisting("headSelectionsToHide"))
6821 {
6824 }
6825
6827 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6828 {
6830 }
6831
6833
6834 m_IsResultOfSplit = false;
6835
6837 }
6838
6840 {
6841 super.InitItemVariables();
6842
6848 m_Count = ConfigGetInt(
"count");
6849
6852
6857
6860
6865
6877
6881
6882
6885 if (ConfigIsExisting("canBeSplit"))
6886 {
6889 }
6890
6892 if (ConfigIsExisting("itemBehaviour"))
6894
6895
6898 RegisterNetSyncVariableInt("m_VarLiquidType");
6899 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6900
6901 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6902 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6903 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6904
6905 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6906 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6907 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6908 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6909
6910 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6911 RegisterNetSyncVariableBool("m_IsTakeable");
6912 RegisterNetSyncVariableBool("m_IsHologram");
6913
6916 {
6919 }
6920
6922
6924 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6926
6927 }
6928
6930 {
6932 }
6933
6935 {
6938 {
6943 }
6944 }
6945
6946 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6947 {
6949 {
6952 }
6953
6955 }
6956
6958 {
6964 }
6965
6967
6969 {
6971
6972 if (!action)
6973 {
6974 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6975 return;
6976 }
6977
6979 if (!ai)
6980 {
6982 return;
6983 }
6984
6986 if (!action_array)
6987 {
6988 action_array = new array<ActionBase_Basic>;
6990 }
6991 if (LogManager.IsActionLogEnable())
6992 {
6993 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6994 }
6995
6996 if (action_array.Find(action) != -1)
6997 {
6998 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6999 }
7000 else
7001 {
7002 action_array.Insert(action);
7003 }
7004 }
7005
7007 {
7009 ActionBase action = player.GetActionManager().GetAction(actionName);
7012
7013 if (action_array)
7014 {
7015 action_array.RemoveItem(action);
7016 }
7017 }
7018
7019
7020
7022 {
7023 ActionOverrideData overrideData = new ActionOverrideData();
7027
7029 if (!actionMap)
7030 {
7033 }
7034
7035 actionMap.Insert(this.
Type(), overrideData);
7036
7037 }
7038
7040
7042
7043
7045 {
7048
7051
7052 string config_to_search = "CfgVehicles";
7053 string muzzle_owner_config;
7054
7056 {
7057 if (IsInherited(Weapon))
7058 config_to_search = "CfgWeapons";
7059
7060 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7061
7062 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7063
7065
7066 if (config_OnFire_subclass_count > 0)
7067 {
7068 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7069
7070 for (int i = 0; i < config_OnFire_subclass_count; i++)
7071 {
7072 string particle_class = "";
7074 string config_OnFire_entry = config_OnFire_class + particle_class;
7075 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7076 WPOF_array.Insert(WPOF);
7077 }
7078
7079
7081 }
7082 }
7083
7085 {
7086 config_to_search = "CfgWeapons";
7087 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7088
7089 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7090
7092
7093 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7094 {
7095 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7096
7097 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7098 {
7099 string particle_class2 = "";
7101 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7102 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7103 WPOBE_array.Insert(WPOBE);
7104 }
7105
7106
7108 }
7109 }
7110 }
7111
7112
7114 {
7117
7119 {
7120 string config_to_search = "CfgVehicles";
7121
7122 if (IsInherited(Weapon))
7123 config_to_search = "CfgWeapons";
7124
7125 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7126 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7127
7128 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7129 {
7130
7132
7134 {
7136 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7138 return;
7139 }
7140
7143
7144
7145
7147 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7148
7149 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7150 {
7151 string particle_class = "";
7153 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7155
7156 if (entry_type == CT_CLASS)
7157 {
7158 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7159 WPOOH_array.Insert(WPOF);
7160 }
7161 }
7162
7163
7165 }
7166 }
7167 }
7168
7170 {
7172 }
7173
7175 {
7177 {
7179
7182
7185
7186 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7187 }
7188 }
7189
7191 {
7193 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7194
7196 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7197
7199 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7200
7202 {
7204 }
7205 }
7206
7208 {
7210 }
7211
7213 {
7216 else
7218
7220 {
7223 }
7224 else
7225 {
7228
7231 }
7232
7234 }
7235
7237 {
7239 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7240 }
7241
7243 {
7245 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7247 }
7248
7250 {
7252 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7253 }
7254
7256 {
7259
7260 OverheatingParticle OP = new OverheatingParticle();
7265
7267 }
7268
7270 {
7273
7274 return -1;
7275 }
7276
7278 {
7280 {
7283
7284 for (int i = count; i > 0; --i)
7285 {
7286 int id = i - 1;
7289
7292
7293 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7294 {
7295 if (p)
7296 {
7299 }
7300 }
7301 }
7302 }
7303 }
7304
7306 {
7308 {
7310 {
7311 int id = i - 1;
7313
7314 if (OP)
7315 {
7317
7318 if (p)
7319 {
7321 }
7322
7323 delete OP;
7324 }
7325 }
7326
7329 }
7330 }
7331
7334 {
7335 return 0.0;
7336 }
7337
7338
7340 {
7341 return 250;
7342 }
7343
7345 {
7346 return 0;
7347 }
7348
7351 {
7353 return true;
7354
7355 return false;
7356 }
7357
7360 {
7363
7365 {
7367 }
7368 else
7369 {
7370
7372 }
7373
7375 }
7376
7383 {
7384 return -1;
7385 }
7386
7387
7388
7389
7391 {
7393 {
7395 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7396
7397 if (r_index >= 0)
7398 {
7399 InventoryLocation r_il = new InventoryLocation;
7400 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7401
7402 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7405 {
7406 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7407 }
7409 {
7410 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7411 }
7412
7413 }
7414
7415 player.GetHumanInventory().ClearUserReservedLocation(this);
7416 }
7417
7420 }
7421
7422
7423
7424
7426 {
7427 return ItemBase.m_DebugActionsMask;
7428 }
7429
7431 {
7432 return ItemBase.m_DebugActionsMask & mask;
7433 }
7434
7436 {
7437 ItemBase.m_DebugActionsMask = mask;
7438 }
7439
7441 {
7442 ItemBase.m_DebugActionsMask |= mask;
7443 }
7444
7446 {
7447 ItemBase.m_DebugActionsMask &= ~mask;
7448 }
7449
7451 {
7453 {
7455 }
7456 else
7457 {
7459 }
7460 }
7461
7462
7464 {
7465 if (GetEconomyProfile())
7466 {
7467 float q_max = GetEconomyProfile().GetQuantityMax();
7468 if (q_max > 0)
7469 {
7470 float q_min = GetEconomyProfile().GetQuantityMin();
7471 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7472
7474 {
7475 ComponentEnergyManager comp = GetCompEM();
7477 {
7479 }
7480 }
7482 {
7484
7485 }
7486
7487 }
7488 }
7489 }
7490
7493 {
7494 EntityAI parent = GetHierarchyParent();
7495
7496 if (parent)
7497 {
7498 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7499 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7500 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7501 }
7502 }
7503
7506 {
7507 EntityAI parent = GetHierarchyParent();
7508
7509 if (parent)
7510 {
7511 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7512 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7513 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7514 }
7515 }
7516
7518 {
7519
7520
7521
7522
7524
7526 {
7527 if (ScriptInputUserData.CanStoreInputUserData())
7528 {
7529 ScriptInputUserData ctx = new ScriptInputUserData;
7535 ctx.
Write(use_stack_max);
7538
7540 {
7541 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7542 }
7543 }
7544 }
7545 else if (!
GetGame().IsMultiplayer())
7546 {
7548 }
7549 }
7550
7552 {
7554 }
7555
7557 {
7559 }
7560
7562 {
7564 }
7565
7567 {
7568
7569 return false;
7570 }
7571
7573 {
7574 return false;
7575 }
7576
7580 {
7581 return false;
7582 }
7583
7585 {
7586 return "";
7587 }
7588
7590
7592 {
7593 return false;
7594 }
7595
7597 {
7598 return true;
7599 }
7600
7601
7602
7604 {
7605 return true;
7606 }
7607
7609 {
7610 return true;
7611 }
7612
7614 {
7615 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7617 }
7618
7620 {
7622 }
7623
7625 {
7627 if (!is_being_placed)
7629 SetSynchDirty();
7630 }
7631
7632
7634
7636 {
7638 }
7639
7641 {
7643 }
7644
7646 {
7647 return 1;
7648 }
7649
7651 {
7652 return false;
7653 }
7654
7656 {
7658 SetSynchDirty();
7659 }
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7696 {
7697 super.OnMovedInsideCargo(container);
7698
7699 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7700 }
7701
7702 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7703 {
7704 super.EEItemLocationChanged(oldLoc,newLoc);
7705
7706 PlayerBase new_player = null;
7707 PlayerBase old_player = null;
7708
7709 if (newLoc.GetParent())
7710 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7711
7712 if (oldLoc.GetParent())
7713 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7714
7716 {
7717 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7718
7719 if (r_index >= 0)
7720 {
7721 InventoryLocation r_il = new InventoryLocation;
7722 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7723
7724 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7727 {
7728 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7729 }
7731 {
7732 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7733 }
7734
7735 }
7736 }
7737
7739 {
7740 if (new_player)
7741 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7742
7743 if (new_player == old_player)
7744 {
7745
7746 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7747 {
7749 {
7750 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7751 {
7752 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7753 }
7754 }
7755 else
7756 {
7757 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7758 }
7759 }
7760
7761 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7762 {
7763 int type = oldLoc.GetType();
7765 {
7766 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7767 }
7769 {
7770 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7771 }
7772 }
7773 if (!m_OldLocation)
7774 {
7775 m_OldLocation = new InventoryLocation;
7776 }
7777 m_OldLocation.Copy(oldLoc);
7778 }
7779 else
7780 {
7781 if (m_OldLocation)
7782 {
7783 m_OldLocation.Reset();
7784 }
7785 }
7786
7788 }
7789 else
7790 {
7791 if (new_player)
7792 {
7793 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7794 if (res_index >= 0)
7795 {
7796 InventoryLocation il = new InventoryLocation;
7797 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7799 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7802 {
7803 il.
GetParent().GetOnReleaseLock().Invoke(it);
7804 }
7806 {
7808 }
7809
7810 }
7811 }
7813 {
7814
7816 }
7817
7818 if (m_OldLocation)
7819 {
7820 m_OldLocation.Reset();
7821 }
7822 }
7823 }
7824
7825 override void EOnContact(IEntity other, Contact extra)
7826 {
7828 {
7829 int liquidType = -1;
7831 if (impactSpeed > 0.0)
7832 {
7834 #ifndef SERVER
7836 #else
7838 SetSynchDirty();
7839 #endif
7841 }
7842 }
7843
7844 #ifdef SERVER
7845 if (GetCompEM() && GetCompEM().IsPlugged())
7846 {
7847 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7848 GetCompEM().UnplugThis();
7849 }
7850 #endif
7851 }
7852
7854
7856 {
7858 }
7859
7861 {
7862
7863 }
7864
7866 {
7867 super.OnItemLocationChanged(old_owner, new_owner);
7868
7869 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7870 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7871
7872 if (!relatedPlayer && playerNew)
7873 relatedPlayer = playerNew;
7874
7875 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7876 {
7878 if (actionMgr)
7879 {
7880 ActionBase currentAction = actionMgr.GetRunningAction();
7881 if (currentAction)
7883 }
7884 }
7885
7886 Man ownerPlayerOld = null;
7887 Man ownerPlayerNew = null;
7888
7889 if (old_owner)
7890 {
7891 if (old_owner.
IsMan())
7892 {
7893 ownerPlayerOld = Man.Cast(old_owner);
7894 }
7895 else
7896 {
7897 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7898 }
7899 }
7900 else
7901 {
7903 {
7905
7906 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7907 {
7908 GetCompEM().UnplugThis();
7909 }
7910 }
7911 }
7912
7913 if (new_owner)
7914 {
7915 if (new_owner.
IsMan())
7916 {
7917 ownerPlayerNew = Man.Cast(new_owner);
7918 }
7919 else
7920 {
7921 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7922 }
7923 }
7924
7925 if (ownerPlayerOld != ownerPlayerNew)
7926 {
7927 if (ownerPlayerOld)
7928 {
7929 array<EntityAI> subItemsExit = new array<EntityAI>;
7931 for (int i = 0; i < subItemsExit.Count(); i++)
7932 {
7935 }
7936 }
7937
7938 if (ownerPlayerNew)
7939 {
7940 array<EntityAI> subItemsEnter = new array<EntityAI>;
7942 for (int j = 0; j < subItemsEnter.Count(); j++)
7943 {
7946 }
7947 }
7948 }
7949 else if (ownerPlayerNew != null)
7950 {
7951 PlayerBase nplayer;
7952 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7953 {
7954 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7956 for (int k = 0; k < subItemsUpdate.Count(); k++)
7957 {
7959 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7960 }
7961 }
7962 }
7963
7964 if (old_owner)
7965 old_owner.OnChildItemRemoved(this);
7966 if (new_owner)
7967 new_owner.OnChildItemReceived(this);
7968 }
7969
7970
7972 {
7973 super.EEDelete(parent);
7974 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7975 if (player)
7976 {
7978
7979 if (player.IsAlive())
7980 {
7981 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7982 if (r_index >= 0)
7983 {
7984 InventoryLocation r_il = new InventoryLocation;
7985 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7986
7987 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7990 {
7991 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7992 }
7994 {
7995 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7996 }
7997
7998 }
7999
8000 player.RemoveQuickBarEntityShortcut(this);
8001 }
8002 }
8003 }
8004
8006 {
8007 super.EEKilled(killer);
8008
8011 {
8012 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8013 {
8014 if (IsMagazine())
8015 {
8016 if (Magazine.Cast(this).GetAmmoCount() > 0)
8017 {
8019 }
8020 }
8021 else
8022 {
8024 }
8025 }
8026 }
8027 }
8028
8030 {
8031 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8032
8033 super.OnWasAttached(parent, slot_id);
8034
8037
8039 }
8040
8042 {
8043 super.OnWasDetached(parent, slot_id);
8044
8047 }
8048
8050 {
8051 int idx;
8054
8055 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8056 if (inventory_slots.Count() < 1)
8057 {
8058 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8059 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8060 }
8061 else
8062 {
8063 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8064 }
8065
8066 idx = inventory_slots.Find(slot);
8067 if (idx < 0)
8068 return "";
8069
8070 return attach_types.Get(idx);
8071 }
8072
8074 {
8075 int idx = -1;
8076 string slot;
8077
8080
8081 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8082 if (inventory_slots.Count() < 1)
8083 {
8084 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8085 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8086 }
8087 else
8088 {
8089 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8090 if (detach_types.Count() < 1)
8091 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8092 }
8093
8094 for (int i = 0; i < inventory_slots.Count(); i++)
8095 {
8096 slot = inventory_slots.Get(i);
8097 }
8098
8099 if (slot != "")
8100 {
8101 if (detach_types.Count() == 1)
8102 idx = 0;
8103 else
8104 idx = inventory_slots.Find(slot);
8105 }
8106 if (idx < 0)
8107 return "";
8108
8109 return detach_types.Get(idx);
8110 }
8111
8113 {
8114
8116
8117
8118 float min_time = 1;
8119 float max_time = 3;
8120 float delay = Math.RandomFloat(min_time, max_time);
8121
8122 explode_timer.Run(delay, this, "DoAmmoExplosion");
8123 }
8124
8126 {
8127 Magazine magazine = Magazine.Cast(this);
8128 int pop_sounds_count = 6;
8129 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8130
8131
8132 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8133 string sound_name = pop_sounds[ sound_idx ];
8135
8136
8137 magazine.ServerAddAmmoCount(-1);
8138
8139
8140 float min_temp_to_explode = 100;
8141
8142 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
8143 {
8145 }
8146 }
8147
8148
8149 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8150 {
8151 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8152
8153 const int CHANCE_DAMAGE_CARGO = 4;
8154 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8155 const int CHANCE_DAMAGE_NOTHING = 2;
8156
8158 {
8159 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8160 int chances;
8161 int rnd;
8162
8163 if (GetInventory().GetCargo())
8164 {
8165 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8166 rnd = Math.RandomInt(0,chances);
8167
8168 if (rnd < CHANCE_DAMAGE_CARGO)
8169 {
8171 }
8172 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8173 {
8175 }
8176 }
8177 else
8178 {
8179 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8180 rnd = Math.RandomInt(0,chances);
8181
8182 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8183 {
8185 }
8186 }
8187 }
8188 }
8189
8191 {
8192 if (GetInventory().GetCargo())
8193 {
8194 int item_count = GetInventory().GetCargo().GetItemCount();
8195 if (item_count > 0)
8196 {
8197 int random_pick = Math.RandomInt(0, item_count);
8199 if (!item.IsExplosive())
8200 {
8201 item.AddHealth("","",damage);
8202 return true;
8203 }
8204 }
8205 }
8206 return false;
8207 }
8208
8210 {
8211 int attachment_count = GetInventory().AttachmentCount();
8212 if (attachment_count > 0)
8213 {
8214 int random_pick = Math.RandomInt(0, attachment_count);
8215 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8216 if (!attachment.IsExplosive())
8217 {
8218 attachment.AddHealth("","",damage);
8219 return true;
8220 }
8221 }
8222 return false;
8223 }
8224
8226 {
8228 }
8229
8231 {
8233 return GetInventory().CanRemoveEntity();
8234
8235 return false;
8236 }
8237
8239 {
8241 return;
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 {
8267 return;
8268
8269 float split_quantity_new;
8273 InventoryLocation loc = new InventoryLocation;
8274
8275 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8276 {
8278 split_quantity_new = stack_max;
8279 else
8281
8282 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8283 if (new_item)
8284 {
8285 new_item.SetResultOfSplit(true);
8286 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8288 new_item.SetQuantity(split_quantity_new);
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 {
8302 }
8303
8304 if (new_item)
8305 {
8306 new_item.SetResultOfSplit(true);
8307 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8309 new_item.SetQuantity(split_quantity_new);
8310 }
8311 }
8312 else
8313 {
8314 if (stack_max != 0)
8315 {
8317 {
8319 }
8320
8321 if (split_quantity_new == 0)
8322 {
8323 if (!
GetGame().IsMultiplayer())
8324 player.PhysicalPredictiveDropItem(this);
8325 else
8326 player.ServerDropEntity(this);
8327 return;
8328 }
8329
8331
8332 if (new_item)
8333 {
8334 new_item.SetResultOfSplit(true);
8335 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8337 new_item.SetQuantity(stack_max);
8338 new_item.PlaceOnSurface();
8339 }
8340 }
8341 }
8342 }
8343
8345 {
8347 return;
8348
8349 float split_quantity_new;
8353 InventoryLocation loc = new InventoryLocation;
8354
8355 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8356 {
8358 split_quantity_new = stack_max;
8359 else
8361
8362 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8363 if (new_item)
8364 {
8365 new_item.SetResultOfSplit(true);
8366 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8368 new_item.SetQuantity(split_quantity_new);
8369 }
8370 }
8371 else if (destination_entity && slot_id == -1)
8372 {
8373 if (quantity > stack_max)
8374 split_quantity_new = stack_max;
8375 else
8376 split_quantity_new = quantity;
8377
8379 {
8382 }
8383
8384 if (new_item)
8385 {
8386 new_item.SetResultOfSplit(true);
8387 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8389 new_item.SetQuantity(split_quantity_new);
8390 }
8391 }
8392 else
8393 {
8394 if (stack_max != 0)
8395 {
8397 {
8399 }
8400
8402
8403 if (new_item)
8404 {
8405 new_item.SetResultOfSplit(true);
8406 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8408 new_item.SetQuantity(stack_max);
8409 new_item.PlaceOnSurface();
8410 }
8411 }
8412 }
8413 }
8414
8416 {
8418 return;
8419
8421 {
8422 if (ScriptInputUserData.CanStoreInputUserData())
8423 {
8424 ScriptInputUserData ctx = new ScriptInputUserData;
8429 dst.WriteToContext(ctx);
8431 }
8432 }
8433 else if (!
GetGame().IsMultiplayer())
8434 {
8436 }
8437 }
8438
8440 {
8442 return;
8443
8445 {
8446 if (ScriptInputUserData.CanStoreInputUserData())
8447 {
8448 ScriptInputUserData ctx = new ScriptInputUserData;
8453 ctx.
Write(destination_entity);
8459 }
8460 }
8461 else if (!
GetGame().IsMultiplayer())
8462 {
8464 }
8465 }
8466
8468 {
8470 }
8471
8473 {
8475 return this;
8476
8478 float split_quantity_new;
8480 if (dst.IsValid())
8481 {
8482 int slot_id = dst.GetSlot();
8484
8485 if (quantity > stack_max)
8486 split_quantity_new = stack_max;
8487 else
8488 split_quantity_new = quantity;
8489
8491
8492 if (new_item)
8493 {
8494 new_item.SetResultOfSplit(true);
8495 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8498 }
8499
8500 return new_item;
8501 }
8502
8503 return null;
8504 }
8505
8507 {
8509 return;
8510
8512 float split_quantity_new;
8514 if (destination_entity)
8515 {
8517 if (quantity > stackable)
8518 split_quantity_new = stackable;
8519 else
8520 split_quantity_new = quantity;
8521
8522 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8523 if (new_item)
8524 {
8525 new_item.SetResultOfSplit(true);
8526 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8528 new_item.SetQuantity(split_quantity_new);
8529 }
8530 }
8531 }
8532
8534 {
8536 return;
8537
8539 {
8540 if (ScriptInputUserData.CanStoreInputUserData())
8541 {
8542 ScriptInputUserData ctx = new ScriptInputUserData;
8547 ItemBase destination_entity =
this;
8548 ctx.
Write(destination_entity);
8552 }
8553 }
8554 else if (!
GetGame().IsMultiplayer())
8555 {
8557 }
8558 }
8559
8561 {
8563 return;
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
8576 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8577 new_item =
ItemBase.Cast(in_hands);
8578 if (new_item)
8579 {
8580 new_item.SetResultOfSplit(true);
8581 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8583 new_item.SetQuantity(split_quantity_new);
8584 }
8585 }
8586 }
8587
8589 {
8591 return;
8592
8594 float split_quantity_new = Math.Floor(quantity * 0.5);
8595
8597
8598 if (new_item)
8599 {
8600 if (new_item.GetQuantityMax() < split_quantity_new)
8601 {
8602 split_quantity_new = new_item.GetQuantityMax();
8603 }
8604
8605 new_item.SetResultOfSplit(true);
8606 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8607
8609 {
8612 }
8613 else
8614 {
8617 }
8618 }
8619 }
8620
8622 {
8624 return;
8625
8627 float split_quantity_new = Math.Floor(quantity / 2);
8628
8629 InventoryLocation invloc = new InventoryLocation;
8631
8633 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8634
8635 if (new_item)
8636 {
8637 if (new_item.GetQuantityMax() < split_quantity_new)
8638 {
8639 split_quantity_new = new_item.GetQuantityMax();
8640 }
8642 {
8645 }
8646 else
8647 {
8650 }
8651 }
8652 }
8653
8656 {
8657 SetWeightDirty();
8659
8660 if (parent)
8661 parent.OnAttachmentQuantityChangedEx(this, delta);
8662
8664 {
8666 {
8668 }
8670 {
8671 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8673 }
8674 }
8675
8676 }
8677
8680 {
8681
8682 }
8683
8686 {
8688 }
8689
8691 {
8692 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8693
8695 {
8696 if (newLevel == GameConstants.STATE_RUINED)
8697 {
8699 EntityAI parent = GetHierarchyParent();
8700 if (parent && parent.IsFireplace())
8701 {
8702 CargoBase cargo = GetInventory().GetCargo();
8703 if (cargo)
8704 {
8706 {
8708 }
8709 }
8710 }
8711 }
8712
8714 {
8715
8717 return;
8718 }
8719
8720 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8721 {
8723 }
8724 }
8725 }
8726
8727
8729 {
8730 super.OnRightClick();
8731
8733 {
8735 {
8736 if (ScriptInputUserData.CanStoreInputUserData())
8737 {
8738 vector m4[4];
8740
8741 EntityAI root = GetHierarchyRoot();
8742
8743 InventoryLocation dst = new InventoryLocation;
8745 {
8746 if (root)
8747 {
8748 root.GetTransform(m4);
8750 }
8751 else
8752 GetInventory().GetCurrentInventoryLocation(dst);
8753 }
8754 else
8755 {
8757
8758
8759 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8760 {
8761 if (root)
8762 {
8763 root.GetTransform(m4);
8765 }
8766 else
8767 GetInventory().GetCurrentInventoryLocation(dst);
8768 }
8769 else
8770 {
8771 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8772 }
8773 }
8774
8775 ScriptInputUserData ctx = new ScriptInputUserData;
8783 }
8784 }
8785 else if (!
GetGame().IsMultiplayer())
8786 {
8788 }
8789 }
8790 }
8791
8792 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8793 {
8794
8795 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8796 return false;
8797
8798 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8799 return false;
8800
8801
8803 return false;
8804
8805
8806 Magazine mag = Magazine.Cast(this);
8807 if (mag)
8808 {
8809 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8810 return false;
8811
8812 if (stack_max_limit)
8813 {
8814 Magazine other_mag = Magazine.Cast(other_item);
8815 if (other_item)
8816 {
8817 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8818 return false;
8819 }
8820
8821 }
8822 }
8823 else
8824 {
8825
8827 return false;
8828
8830 return false;
8831 }
8832
8833 PlayerBase player = null;
8834 if (CastTo(player, GetHierarchyRootPlayer()))
8835 {
8836 if (player.GetInventory().HasAttachment(this))
8837 return false;
8838
8839 if (player.IsItemsToDelete())
8840 return false;
8841 }
8842
8843 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8844 return false;
8845
8846 int slotID;
8848 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8849 return false;
8850
8851 return true;
8852 }
8853
8855 {
8857 }
8858
8860 {
8861 return m_IsResultOfSplit;
8862 }
8863
8865 {
8866 m_IsResultOfSplit = value;
8867 }
8868
8870 {
8872 }
8873
8875 {
8876 float other_item_quantity = other_item.GetQuantity();
8877 float this_free_space;
8878
8880
8882
8883 if (other_item_quantity > this_free_space)
8884 {
8885 return this_free_space;
8886 }
8887 else
8888 {
8889 return other_item_quantity;
8890 }
8891 }
8892
8894 {
8896 }
8897
8899 {
8901 return;
8902
8903 if (!IsMagazine() && other_item)
8904 {
8906 if (quantity_used != 0)
8907 {
8908 float hp1 = GetHealth01("","");
8909 float hp2 = other_item.GetHealth01("","");
8910 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8911 hpResult = hpResult / (
GetQuantity() + quantity_used);
8912
8913 hpResult *= GetMaxHealth();
8914 Math.Round(hpResult);
8915 SetHealth("", "Health", hpResult);
8916
8918 other_item.AddQuantity(-quantity_used);
8919 }
8920 }
8922 }
8923
8925 {
8926 #ifdef SERVER
8927 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8928 GetHierarchyParent().IncreaseLifetimeUp();
8929 #endif
8930 };
8931
8933 {
8934 PlayerBase p = PlayerBase.Cast(player);
8935
8936 array<int> recipesIds = p.m_Recipes;
8937 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8938 if (moduleRecipesManager)
8939 {
8940 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8941 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8942 }
8943
8944 for (int i = 0;i < recipesIds.Count(); i++)
8945 {
8946 int key = recipesIds.Get(i);
8947 string recipeName = moduleRecipesManager.GetRecipeName(key);
8949 }
8950 }
8951
8952
8953 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8954 {
8955 super.GetDebugActions(outputList);
8956
8957
8962
8963
8967
8971
8972
8975
8976
8978 {
8981 }
8982
8984
8987
8991 }
8992
8993
8994
8995
8997 {
8998 super.OnAction(action_id, player, ctx);
8999 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9000 {
9001 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9002 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9003 PlayerBase p = PlayerBase.Cast(player);
9004 if (
EActions.RECIPES_RANGE_START < 1000)
9005 {
9006 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9007 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9008 }
9009 }
9010 #ifndef SERVER
9011 else if (action_id ==
EActions.WATCH_PLAYER)
9012 {
9013 PluginDeveloper.SetDeveloperItemClientEx(player);
9014 }
9015 #endif
9017 {
9018 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9019 {
9020 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9021 OnDebugButtonPressServer(id + 1);
9022 }
9023
9024 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9025 {
9026 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9028 }
9029
9030 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9031 {
9032 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9034 }
9035
9036 else if (action_id ==
EActions.ADD_QUANTITY)
9037 {
9038 if (IsMagazine())
9039 {
9040 Magazine mag = Magazine.Cast(this);
9041 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9042 }
9043 else
9044 {
9046 }
9047
9048 if (m_EM)
9049 {
9050 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9051 }
9052
9053 }
9054
9055 else if (action_id ==
EActions.REMOVE_QUANTITY)
9056 {
9057 if (IsMagazine())
9058 {
9059 Magazine mag2 = Magazine.Cast(this);
9060 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9061 }
9062 else
9063 {
9065 }
9066 if (m_EM)
9067 {
9068 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9069 }
9070
9071 }
9072
9073 else if (action_id ==
EActions.SET_QUANTITY_0)
9074 {
9076
9077 if (m_EM)
9078 {
9079 m_EM.SetEnergy(0);
9080 }
9081 }
9082
9083 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9084 {
9086
9087 if (m_EM)
9088 {
9089 m_EM.SetEnergy(m_EM.GetEnergyMax());
9090 }
9091 }
9092
9093 else if (action_id ==
EActions.ADD_HEALTH)
9094 {
9095 AddHealth("","",GetMaxHealth("","Health")/5);
9096 }
9097 else if (action_id ==
EActions.REMOVE_HEALTH)
9098 {
9099 AddHealth("","",-GetMaxHealth("","Health")/5);
9100 }
9101 else if (action_id ==
EActions.DESTROY_HEALTH)
9102 {
9103 SetHealth01("","",0);
9104 }
9105 else if (action_id ==
EActions.WATCH_ITEM)
9106 {
9108 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9109 #ifdef DEVELOPER
9110 SetDebugDeveloper_item(this);
9111 #endif
9112 }
9113
9114 else if (action_id ==
EActions.ADD_TEMPERATURE)
9115 {
9116 AddTemperature(20);
9117
9118 }
9119
9120 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9121 {
9122 AddTemperature(-20);
9123
9124 }
9125
9126 else if (action_id ==
EActions.FLIP_FROZEN)
9127 {
9128 SetFrozen(!GetIsFrozen());
9129
9130 }
9131
9132 else if (action_id ==
EActions.ADD_WETNESS)
9133 {
9135
9136 }
9137
9138 else if (action_id ==
EActions.REMOVE_WETNESS)
9139 {
9141
9142 }
9143
9144 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9145 {
9148
9149
9150 }
9151
9152 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9153 {
9156 }
9157
9158 else if (action_id ==
EActions.MAKE_SPECIAL)
9159 {
9160 auto debugParams = DebugSpawnParams.WithPlayer(player);
9161 OnDebugSpawnEx(debugParams);
9162 }
9163
9164 else if (action_id ==
EActions.DELETE)
9165 {
9166 Delete();
9167 }
9168
9169 }
9170
9171
9172 return false;
9173 }
9174
9175
9176
9177
9181
9184
9185
9186
9188 {
9189 return false;
9190 }
9191
9192
9194 {
9195 return true;
9196 }
9197
9198
9200 {
9201 return true;
9202 }
9203
9204
9205
9207 {
9208 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9210 }
9211
9214 {
9215 return null;
9216 }
9217
9219 {
9220 return false;
9221 }
9222
9224 {
9225 return false;
9226 }
9227
9231
9232
9234 {
9235 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9236 return module_repairing.CanRepair(this, item_repair_kit);
9237 }
9238
9239
9240 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9241 {
9242 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9243 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9244 }
9245
9246
9248 {
9249
9250
9251
9252
9253
9254
9255
9256
9257 return 1;
9258 }
9259
9260
9261
9263 {
9265 }
9266
9267
9268
9270 {
9272 }
9273
9274
9283 {
9284 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9285
9286 if (player)
9287 {
9288 player.MessageStatus(text);
9289 }
9290 }
9291
9292
9301 {
9302 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9303
9304 if (player)
9305 {
9306 player.MessageAction(text);
9307 }
9308 }
9309
9310
9319 {
9320 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9321
9322 if (player)
9323 {
9324 player.MessageFriendly(text);
9325 }
9326 }
9327
9328
9337 {
9338 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9339
9340 if (player)
9341 {
9342 player.MessageImportant(text);
9343 }
9344 }
9345
9347 {
9348 return true;
9349 }
9350
9351
9352 override bool KindOf(
string tag)
9353 {
9354 bool found = false;
9355 string item_name = this.
GetType();
9358
9359 int array_size = item_tag_array.Count();
9360 for (int i = 0; i < array_size; i++)
9361 {
9362 if (item_tag_array.Get(i) == tag)
9363 {
9364 found = true;
9365 break;
9366 }
9367 }
9368 return found;
9369 }
9370
9371
9373 {
9374
9375 super.OnRPC(sender, rpc_type,ctx);
9376
9377
9378 switch (rpc_type)
9379 {
9380 #ifndef SERVER
9381 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9382 Param2<bool, string> p = new Param2<bool, string>(false, "");
9383
9385 return;
9386
9387 bool play = p.param1;
9388 string soundSet = p.param2;
9389
9390 if (play)
9391 {
9393 {
9395 {
9397 }
9398 }
9399 else
9400 {
9402 }
9403 }
9404 else
9405 {
9407 }
9408
9409 break;
9410 #endif
9411
9412 }
9413
9415 {
9417 }
9418 }
9419
9420
9421
9422
9424 {
9425 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9426 return plugin.GetID(
name);
9427 }
9428
9430 {
9431 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9432 return plugin.GetName(id);
9433 }
9434
9437 {
9438
9439
9440 int varFlags;
9441 if (!ctx.
Read(varFlags))
9442 return;
9443
9444 if (varFlags & ItemVariableFlags.FLOAT)
9445 {
9447 }
9448 }
9449
9451 {
9452
9453 super.SerializeNumericalVars(floats_out);
9454
9455
9456
9458 {
9460 }
9461
9463 {
9465 }
9466
9468 {
9470 }
9471
9473 {
9478 }
9479
9481 {
9483 }
9484 }
9485
9487 {
9488
9489 super.DeSerializeNumericalVars(floats);
9490
9491
9492 int index = 0;
9493 int mask = Math.Round(floats.Get(index));
9494
9495 index++;
9496
9498 {
9500 {
9502 }
9503 else
9504 {
9505 float quantity = floats.Get(index);
9507 }
9508 index++;
9509 }
9510
9512 {
9513 float wet = floats.Get(index);
9515 index++;
9516 }
9517
9519 {
9520 int liquidtype = Math.Round(floats.Get(index));
9522 index++;
9523 }
9524
9526 {
9528 index++;
9530 index++;
9532 index++;
9534 index++;
9535 }
9536
9538 {
9539 int cleanness = Math.Round(floats.Get(index));
9541 index++;
9542 }
9543 }
9544
9546 {
9547 super.WriteVarsToCTX(ctx);
9548
9549
9551 {
9553 }
9554
9556 {
9558 }
9559
9561 {
9563 }
9564
9566 {
9567 int r,g,b,a;
9573 }
9574
9576 {
9578 }
9579 }
9580
9582 {
9583 if (!super.ReadVarsFromCTX(ctx,version))
9584 return false;
9585
9586 int intValue;
9587 float value;
9588
9589 if (version < 140)
9590 {
9591 if (!ctx.
Read(intValue))
9592 return false;
9593
9594 m_VariablesMask = intValue;
9595 }
9596
9598 {
9599 if (!ctx.
Read(value))
9600 return false;
9601
9603 {
9605 }
9606 else
9607 {
9609 }
9610 }
9611
9612 if (version < 140)
9613 {
9615 {
9616 if (!ctx.
Read(value))
9617 return false;
9618 SetTemperatureDirect(value);
9619 }
9620 }
9621
9623 {
9624 if (!ctx.
Read(value))
9625 return false;
9627 }
9628
9630 {
9631 if (!ctx.
Read(intValue))
9632 return false;
9634 }
9635
9637 {
9638 int r,g,b,a;
9640 return false;
9642 return false;
9644 return false;
9646 return false;
9647
9649 }
9650
9652 {
9653 if (!ctx.
Read(intValue))
9654 return false;
9656 }
9657
9658 if (version >= 138 && version < 140)
9659 {
9661 {
9662 if (!ctx.
Read(intValue))
9663 return false;
9664 SetFrozen(intValue);
9665 }
9666 }
9667
9668 return true;
9669 }
9670
9671
9673 {
9676 {
9678 }
9679
9680 if (!super.OnStoreLoad(ctx, version))
9681 {
9683 return false;
9684 }
9685
9686 if (version >= 114)
9687 {
9688 bool hasQuickBarIndexSaved;
9689
9690 if (!ctx.
Read(hasQuickBarIndexSaved))
9691 {
9693 return false;
9694 }
9695
9696 if (hasQuickBarIndexSaved)
9697 {
9698 int itmQBIndex;
9699
9700
9701 if (!ctx.
Read(itmQBIndex))
9702 {
9704 return false;
9705 }
9706
9707 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9708 if (itmQBIndex != -1 && parentPlayer)
9709 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9710 }
9711 }
9712 else
9713 {
9714
9715 PlayerBase player;
9716 int itemQBIndex;
9717 if (version ==
int.
MAX)
9718 {
9719 if (!ctx.
Read(itemQBIndex))
9720 {
9722 return false;
9723 }
9724 }
9725 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9726 {
9727
9728 if (!ctx.
Read(itemQBIndex))
9729 {
9731 return false;
9732 }
9733 if (itemQBIndex != -1 && player)
9734 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9735 }
9736 }
9737
9738 if (version < 140)
9739 {
9740
9741 if (!LoadVariables(ctx, version))
9742 {
9744 return false;
9745 }
9746 }
9747
9748
9750 {
9752 return false;
9753 }
9754 if (version >= 132)
9755 {
9757 if (raib)
9758 {
9760 {
9762 return false;
9763 }
9764 }
9765 }
9766
9768 return true;
9769 }
9770
9771
9772
9774 {
9775 super.OnStoreSave(ctx);
9776
9777 PlayerBase player;
9778 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9779 {
9781
9782 int itemQBIndex = -1;
9783 itemQBIndex = player.FindQuickBarEntityIndex(this);
9784 ctx.
Write(itemQBIndex);
9785 }
9786 else
9787 {
9789 }
9790
9792
9794 if (raib)
9795 {
9797 }
9798 }
9799
9800
9802 {
9803 super.AfterStoreLoad();
9804
9806 {
9808 }
9809
9811 {
9814 }
9815 }
9816
9818 {
9819 super.EEOnAfterLoad();
9820
9822 {
9824 }
9825
9828 }
9829
9831 {
9832 return false;
9833 }
9834
9835
9836
9838 {
9840 {
9841 #ifdef PLATFORM_CONSOLE
9842
9844 {
9846 if (menu)
9847 {
9849 }
9850 }
9851 #endif
9852 }
9853
9855 {
9858 }
9859
9861 {
9862 SetWeightDirty();
9864 }
9866 {
9869 }
9870
9872 {
9875 }
9877 {
9880 }
9881
9882 super.OnVariablesSynchronized();
9883 }
9884
9885
9886
9888 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9889 {
9890 if (!IsServerCheck(allow_client))
9891 return false;
9892
9894 return false;
9895
9898
9899 if (value <= (min + 0.001))
9900 value = min;
9901
9902 if (value == min)
9903 {
9904 if (destroy_config)
9905 {
9906 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9907 if (dstr)
9908 {
9910 this.Delete();
9911 return true;
9912 }
9913 }
9914 else if (destroy_forced)
9915 {
9917 this.Delete();
9918 return true;
9919 }
9920
9922 }
9923
9926
9928 {
9930
9931 if (delta)
9933 }
9934
9936
9937 return false;
9938 }
9939
9940
9942 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9943 {
9945 }
9946
9948 {
9951 }
9952
9954 {
9957 }
9958
9961 {
9962 float value_clamped = Math.Clamp(value, 0, 1);
9964 SetQuantity(result, destroy_config, destroy_forced);
9965 }
9966
9967
9970 {
9972 }
9973
9975 {
9977 }
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9989 {
9990 int slot = -1;
9991 if (GetInventory())
9992 {
9993 InventoryLocation il = new InventoryLocation;
9994 GetInventory().GetCurrentInventoryLocation(il);
9996 }
9997
9999 }
10000
10002 {
10003 float quantity_max = 0;
10004
10006 {
10007 if (attSlotID != -1)
10008 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10009
10010 if (quantity_max <= 0)
10012 }
10013
10014 if (quantity_max <= 0)
10016
10017 return quantity_max;
10018 }
10019
10021 {
10023 }
10024
10026 {
10028 }
10029
10030
10032 {
10034 }
10035
10037 {
10039 }
10040
10042 {
10044 }
10045
10046
10048 {
10049
10050 float weightEx = GetWeightEx();
10051 float special = GetInventoryAndCargoWeight();
10052 return weightEx - special;
10053 }
10054
10055
10057 {
10059 }
10060
10062 {
10064 {
10065 #ifdef DEVELOPER
10066 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10067 {
10068 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10070 }
10071 #endif
10072
10073 return GetQuantity() * GetConfigWeightModified();
10074 }
10075 else if (HasEnergyManager())
10076 {
10077 #ifdef DEVELOPER
10078 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10079 {
10080 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10081 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10082 }
10083 #endif
10084 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10085 }
10086 else
10087 {
10088 #ifdef DEVELOPER
10089 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10090 {
10091 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10092 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10093 }
10094 #endif
10095 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
10096 }
10097 }
10098
10101 {
10102 int item_count = 0;
10104
10105 if (GetInventory().GetCargo() != NULL)
10106 {
10107 item_count = GetInventory().GetCargo().GetItemCount();
10108 }
10109
10110 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10111 {
10112 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10113 if (item)
10114 item_count += item.GetNumberOfItems();
10115 }
10116 return item_count;
10117 }
10118
10121 {
10122 float weight = 0;
10123 float wetness = 1;
10124 if (include_wetness)
10127 {
10128 weight = wetness * m_ConfigWeight;
10129 }
10131 {
10132 weight = 1;
10133 }
10134 return weight;
10135 }
10136
10137
10138
10140 {
10141 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10142 {
10143 GameInventory inv = GetInventory();
10144 array<EntityAI> items = new array<EntityAI>;
10146 for (int i = 0; i < items.Count(); i++)
10147 {
10149 if (item)
10150 {
10152 }
10153 }
10154 }
10155 }
10156
10157
10158
10159
10161 {
10162 float energy = 0;
10163 if (HasEnergyManager())
10164 {
10165 energy = GetCompEM().GetEnergy();
10166 }
10167 return energy;
10168 }
10169
10170
10172 {
10173 super.OnEnergyConsumed();
10174
10176 }
10177
10179 {
10180 super.OnEnergyAdded();
10181
10183 }
10184
10185
10187 {
10188 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10189 {
10191 {
10192 float energy_0to1 = GetCompEM().GetEnergy0To1();
10194 }
10195 }
10196 }
10197
10198
10200 {
10201 return ConfigGetFloat("heatIsolation");
10202 }
10203
10205 {
10207 }
10208
10210 {
10211 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10212 if (
GetGame().ConfigIsExisting(paramPath))
10214
10215 return 0.0;
10216 }
10217
10219 {
10220 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10221 if (
GetGame().ConfigIsExisting(paramPath))
10223
10224 return 0.0;
10225 }
10226
10227 override void SetWet(
float value,
bool allow_client =
false)
10228 {
10229 if (!IsServerCheck(allow_client))
10230 return;
10231
10234
10236
10237 m_VarWet = Math.Clamp(value, min, max);
10238
10240 {
10243 }
10244 }
10245
10246 override void AddWet(
float value)
10247 {
10249 }
10250
10252 {
10254 }
10255
10257 {
10259 }
10260
10262 {
10264 }
10265
10267 {
10269 }
10270
10272 {
10274 }
10275
10276 override void OnWetChanged(
float newVal,
float oldVal)
10277 {
10280 if (newLevel != oldLevel)
10281 {
10283 }
10284 }
10285
10287 {
10288 SetWeightDirty();
10289 }
10290
10292 {
10293 return GetWetLevelInternal(
m_VarWet);
10294 }
10295
10296
10297
10299 {
10301 }
10302
10304 {
10306 }
10307
10309 {
10311 }
10312
10314 {
10316 }
10317
10318
10319
10321 {
10322 if (ConfigIsExisting("itemModelLength"))
10323 {
10324 return ConfigGetFloat("itemModelLength");
10325 }
10326 return 0;
10327 }
10328
10330 {
10331 if (ConfigIsExisting("itemAttachOffset"))
10332 {
10333 return ConfigGetFloat("itemAttachOffset");
10334 }
10335 return 0;
10336 }
10337
10338 override void SetCleanness(
int value,
bool allow_client =
false)
10339 {
10340 if (!IsServerCheck(allow_client))
10341 return;
10342
10344
10346
10349 }
10350
10352 {
10354 }
10355
10357 {
10358 return true;
10359 }
10360
10361
10362
10363
10365 {
10367 }
10368
10370 {
10372 }
10373
10374
10375
10376
10377 override void SetColor(
int r,
int g,
int b,
int a)
10378 {
10384 }
10386 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10387 {
10392 }
10393
10395 {
10397 }
10398
10401 {
10402 int r,g,b,a;
10404 r = r/255;
10405 g = g/255;
10406 b = b/255;
10407 a = a/255;
10408 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10409 }
10410
10411
10412
10413 override void SetLiquidType(
int value,
bool allow_client =
false)
10414 {
10415 if (!IsServerCheck(allow_client))
10416 return;
10417
10422 }
10423
10425 {
10426 return ConfigGetInt("varLiquidTypeInit");
10427 }
10428
10430 {
10432 }
10433
10435 {
10437 SetFrozen(false);
10438 }
10439
10442 {
10443 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10444 }
10445
10446
10449 {
10450 PlayerBase nplayer;
10451 if (PlayerBase.CastTo(nplayer, player))
10452 {
10454
10455 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10456 }
10457 }
10458
10459
10462 {
10463 PlayerBase nplayer;
10464 if (PlayerBase.CastTo(nplayer,player))
10465 {
10466
10467 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10468
10469 }
10470
10471
10472 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10473
10474
10475 if (HasEnergyManager())
10476 {
10477 GetCompEM().UpdatePlugState();
10478 }
10479 }
10480
10481
10483 {
10484 super.OnPlacementStarted(player);
10485
10487 }
10488
10489 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10490 {
10492 {
10493 m_AdminLog.OnPlacementComplete(player,
this);
10494 }
10495
10496 super.OnPlacementComplete(player, position, orientation);
10497 }
10498
10499
10500
10501
10502
10504 {
10506 {
10507 return true;
10508 }
10509 else
10510 {
10511 return false;
10512 }
10513 }
10514
10515
10517 {
10519 {
10521 }
10522 }
10523
10524
10526 {
10528 }
10529
10531 {
10533 }
10534
10535 override void InsertAgent(
int agent,
float count = 1)
10536 {
10537 if (count < 1)
10538 return;
10539
10541 }
10542
10545 {
10547 }
10548
10549
10551 {
10553 }
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10597 {
10599 return false;
10600 return true;
10601 }
10602
10604 {
10605
10607 }
10608
10609
10612 {
10613 super.CheckForRoofLimited(timeTresholdMS);
10614
10616 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10617 {
10618 m_PreviousRoofTestTime = time;
10619 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10620 }
10621 }
10622
10623
10625 {
10627 {
10628 return 0;
10629 }
10630
10631 if (GetInventory().GetAttachmentSlotsCount() != 0)
10632 {
10633 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10634 if (filter)
10635 return filter.GetProtectionLevel(type, false, system);
10636 else
10637 return 0;
10638 }
10639
10640 string subclassPath, entryName;
10641
10642 switch (type)
10643 {
10645 entryName = "biological";
10646 break;
10648 entryName = "chemical";
10649 break;
10650 default:
10651 entryName = "biological";
10652 break;
10653 }
10654
10655 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10656
10658 }
10659
10660
10661
10664 {
10665 if (!IsMagazine())
10667
10669 }
10670
10671
10672
10673
10674
10679 {
10680 return true;
10681 }
10682
10684 {
10686 }
10687
10688
10689
10690
10691
10693 {
10694 if (parent)
10695 {
10696 if (parent.IsInherited(DayZInfected))
10697 return true;
10698
10699 if (!parent.IsRuined())
10700 return true;
10701 }
10702
10703 return true;
10704 }
10705
10707 {
10708 if (!super.CanPutAsAttachment(parent))
10709 {
10710 return false;
10711 }
10712
10713 if (!IsRuined() && !parent.IsRuined())
10714 {
10715 return true;
10716 }
10717
10718 return false;
10719 }
10720
10722 {
10723
10724
10725
10726
10727 return super.CanReceiveItemIntoCargo(item);
10728 }
10729
10731 {
10732
10733
10734
10735
10736 GameInventory attachmentInv = attachment.GetInventory();
10738 {
10739 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10740 return false;
10741 }
10742
10743 InventoryLocation loc = new InventoryLocation();
10744 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10745 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10746 return false;
10747
10748 return super.CanReceiveAttachment(attachment, slotId);
10749 }
10750
10752 {
10753 if (!super.CanReleaseAttachment(attachment))
10754 return false;
10755
10756 return GetInventory().AreChildrenAccessible();
10757 }
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10780 {
10781 int id = muzzle_owner.GetMuzzleID();
10782 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10783
10784 if (WPOF_array)
10785 {
10786 for (int i = 0; i < WPOF_array.Count(); i++)
10787 {
10788 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10789
10790 if (WPOF)
10791 {
10792 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10793 }
10794 }
10795 }
10796 }
10797
10798
10800 {
10801 int id = muzzle_owner.GetMuzzleID();
10803
10804 if (WPOBE_array)
10805 {
10806 for (int i = 0; i < WPOBE_array.Count(); i++)
10807 {
10808 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10809
10810 if (WPOBE)
10811 {
10812 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10813 }
10814 }
10815 }
10816 }
10817
10818
10820 {
10821 int id = muzzle_owner.GetMuzzleID();
10822 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10823
10824 if (WPOOH_array)
10825 {
10826 for (int i = 0; i < WPOOH_array.Count(); i++)
10827 {
10828 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10829
10830 if (WPOOH)
10831 {
10832 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10833 }
10834 }
10835 }
10836 }
10837
10838
10840 {
10841 int id = muzzle_owner.GetMuzzleID();
10842 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10843
10844 if (WPOOH_array)
10845 {
10846 for (int i = 0; i < WPOOH_array.Count(); i++)
10847 {
10848 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10849
10850 if (WPOOH)
10851 {
10852 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10853 }
10854 }
10855 }
10856 }
10857
10858
10860 {
10861 int id = muzzle_owner.GetMuzzleID();
10862 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10863
10864 if (WPOOH_array)
10865 {
10866 for (int i = 0; i < WPOOH_array.Count(); i++)
10867 {
10868 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10869
10870 if (WPOOH)
10871 {
10872 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10873 }
10874 }
10875 }
10876 }
10877
10878
10879
10881 {
10883 {
10884 return true;
10885 }
10886
10887 return false;
10888 }
10889
10891 {
10893 {
10894 return true;
10895 }
10896
10897 return false;
10898 }
10899
10901 {
10903 {
10904 return true;
10905 }
10906
10907 return false;
10908 }
10909
10911 {
10912 return false;
10913 }
10914
10917 {
10918 return UATimeSpent.DEFAULT_DEPLOY;
10919 }
10920
10921
10922
10923
10925 {
10927 SetSynchDirty();
10928 }
10929
10931 {
10933 }
10934
10935
10937 {
10938 return false;
10939 }
10940
10943 {
10944 string att_type = "None";
10945
10946 if (ConfigIsExisting("soundAttType"))
10947 {
10948 att_type = ConfigGetString("soundAttType");
10949 }
10950
10952 }
10953
10955 {
10957 }
10958
10959
10960
10961
10962
10966
10968 {
10971
10973 }
10974
10975
10977 {
10979 return;
10980
10982
10985
10988
10989 SoundParameters params = new SoundParameters();
10993 }
10994
10995
10997 {
10999 return;
11000
11002 SetSynchDirty();
11003
11006 }
11007
11008
11010 {
11012 return;
11013
11015 SetSynchDirty();
11016
11019 }
11020
11022 {
11024 }
11025
11027 {
11029 }
11030
11033 {
11034 if (!
GetGame().IsDedicatedServer())
11035 {
11036 if (ConfigIsExisting("attachSoundSet"))
11037 {
11038 string cfg_path = "";
11039 string soundset = "";
11040 string type_name =
GetType();
11041
11044 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11045 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11046
11047 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11048 {
11049 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11050 {
11051 if (cfg_slot_array[i] == slot_type)
11052 {
11053 soundset = cfg_soundset_array[i];
11054 break;
11055 }
11056 }
11057 }
11058
11059 if (soundset != "")
11060 {
11061 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11063 }
11064 }
11065 }
11066 }
11067
11069 {
11070
11071 }
11072
11073 void OnApply(PlayerBase player);
11074
11076 {
11077 return 1.0;
11078 };
11079
11081 {
11083 }
11084
11086 {
11088 }
11089
11091
11093 {
11094 SetDynamicPhysicsLifeTime(0.01);
11096 }
11097
11099 {
11100 array<string> zone_names = new array<string>;
11101 GetDamageZones(zone_names);
11102 for (int i = 0; i < zone_names.Count(); i++)
11103 {
11104 SetHealthMax(zone_names.Get(i),"Health");
11105 }
11106 SetHealthMax("","Health");
11107 }
11108
11111 {
11112 float global_health = GetHealth01("","Health");
11113 array<string> zones = new array<string>;
11114 GetDamageZones(zones);
11115
11116 for (int i = 0; i < zones.Count(); i++)
11117 {
11118 SetHealth01(zones.Get(i),"Health",global_health);
11119 }
11120 }
11121
11124 {
11125 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11126 }
11127
11129 {
11130 if (!hasRootAsPlayer)
11131 {
11132 if (refParentIB)
11133 {
11134
11135 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11136 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11137
11138 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11139 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11140
11143 }
11144 else
11145 {
11146
11149 }
11150 }
11151 }
11152
11154 {
11156 {
11157 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11158 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11159 {
11160 float heatPermCoef = 1.0;
11162 while (ent)
11163 {
11164 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11165 ent = ent.GetHierarchyParent();
11166 }
11167
11168 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11169 }
11170 }
11171 }
11172
11174 {
11175
11176 EntityAI parent = GetHierarchyParent();
11177 if (!parent)
11178 {
11179 hasParent = false;
11180 hasRootAsPlayer = false;
11181 }
11182 else
11183 {
11184 hasParent = true;
11185 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11186 refParentIB =
ItemBase.Cast(parent);
11187 }
11188 }
11189
11190 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11191 {
11192
11193 }
11194
11196 {
11197
11198 return false;
11199 }
11200
11202 {
11203
11204
11205 return false;
11206 }
11207
11209 {
11210
11211 return false;
11212 }
11213
11216 {
11217 return !GetIsFrozen() &&
IsOpen();
11218 }
11219
11221 {
11222 bool hasParent = false, hasRootAsPlayer = false;
11224
11225 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11226 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11227
11228 if (wwtu || foodDecay)
11229 {
11233
11234 if (processWetness || processTemperature || processDecay)
11235 {
11237
11238 if (processWetness)
11239 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11240
11241 if (processTemperature)
11243
11244 if (processDecay)
11245 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11246 }
11247 }
11248 }
11249
11252 {
11254 }
11255
11257 {
11260
11261 return super.GetTemperatureFreezeThreshold();
11262 }
11263
11265 {
11268
11269 return super.GetTemperatureThawThreshold();
11270 }
11271
11273 {
11276
11277 return super.GetItemOverheatThreshold();
11278 }
11279
11281 {
11283 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11284
11285 return super.GetTemperatureFreezeTime();
11286 }
11287
11289 {
11291 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11292
11293 return super.GetTemperatureThawTime();
11294 }
11295
11300
11302 {
11303 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11304 }
11305
11307 {
11308 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11309 }
11310
11313 {
11315 }
11316
11318 {
11320 }
11321
11323 {
11325 }
11326
11329 {
11330 return null;
11331 }
11332
11335 {
11336 return false;
11337 }
11338
11340 {
11342 {
11345 if (!trg)
11346 {
11348 explosive = this;
11349 }
11350
11351 explosive.PairRemote(trg);
11353
11354 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11355 trg.SetPersistentPairID(persistentID);
11356 explosive.SetPersistentPairID(persistentID);
11357
11358 return true;
11359 }
11360 return false;
11361 }
11362
11365 {
11366 float ret = 1.0;
11369 ret *= GetHealth01();
11370
11371 return ret;
11372 }
11373
11374 #ifdef DEVELOPER
11375 override void SetDebugItem()
11376 {
11377 super.SetDebugItem();
11378 _itemBase = this;
11379 }
11380
11382 {
11383 string text = super.GetDebugText();
11384
11386 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11387
11388 return text;
11389 }
11390 #endif
11391
11393 {
11394 return true;
11395 }
11396
11398
11400
11402 {
11405 }
11406
11407
11415
11431}
11432
11434{
11436 if (entity)
11437 {
11438 bool is_item = entity.IsInherited(
ItemBase);
11439 if (is_item && full_quantity)
11440 {
11443 }
11444 }
11445 else
11446 {
11448 return NULL;
11449 }
11450 return entity;
11451}
11452
11454{
11455 if (item)
11456 {
11457 if (health > 0)
11458 item.SetHealth("", "", health);
11459
11460 if (item.CanHaveTemperature())
11461 {
11463 if (item.CanFreeze())
11464 item.SetFrozen(false);
11465 }
11466
11467 if (item.HasEnergyManager())
11468 {
11469 if (quantity >= 0)
11470 {
11471 item.GetCompEM().SetEnergy0To1(quantity);
11472 }
11473 else
11474 {
11476 }
11477 }
11478 else if (item.IsMagazine())
11479 {
11480 Magazine mag = Magazine.Cast(item);
11481 if (quantity >= 0)
11482 {
11483 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11484 }
11485 else
11486 {
11488 }
11489
11490 }
11491 else
11492 {
11493 if (quantity >= 0)
11494 {
11495 item.SetQuantityNormalized(quantity, false);
11496 }
11497 else
11498 {
11500 }
11501
11502 }
11503 }
11504}
11505
11506#ifdef DEVELOPER
11508#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.