DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetFoodStage()

FoodStage SpawnItemOnLocation::GetFoodStage ( )
protected

overridden on Edible_Base; so we don't have to parse configs all the time

См. определение в файле ItemBase.c строка 7473

7477{
7478 override bool CanPutAsAttachment(EntityAI parent)
7479 {
7480 return true;
7481 }
7482};
7483
7484//const bool QUANTITY_DEBUG_REMOVE_ME = false;
7485
7486class ItemBase extends InventoryItem
7487{
7491
7493
7494 static int m_DebugActionsMask;
7496 // ============================================
7497 // Variable Manipulation System
7498 // ============================================
7499 // Quantity
7500
7501 float m_VarQuantity;
7502 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
7504 int m_VarQuantityMin;
7505 int m_VarQuantityMax;
7506 int m_Count;
7507 float m_VarStackMax;
7508 float m_StoreLoadedQuantity = float.LOWEST;
7509 // Wet
7510 float m_VarWet;
7511 float m_VarWetPrev;//for client to know wetness changed during synchronization
7512 float m_VarWetInit;
7513 float m_VarWetMin;
7514 float m_VarWetMax;
7515 // Cleanness
7516 int m_Cleanness;
7517 int m_CleannessInit;
7518 int m_CleannessMin;
7519 int m_CleannessMax;
7520 // impact sounds
7522 bool m_CanPlayImpactSound = true;
7523 float m_ImpactSpeed;
7525 //
7526 float m_HeatIsolation;
7527 float m_ItemModelLength;
7528 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
7530 int m_VarLiquidType;
7531 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
7532 int m_QuickBarBonus;
7533 bool m_IsBeingPlaced;
7534 bool m_IsHologram;
7535 bool m_IsTakeable;
7536 bool m_ThrowItemOnDrop;
7539 bool m_FixDamageSystemInit = false; //can be changed on storage version check
7540 bool can_this_be_combined; //Check if item can be combined
7541 bool m_CanThisBeSplit; //Check if item can be split
7542 bool m_IsStoreLoad = false;
7543 bool m_CanShowQuantity;
7544 bool m_HasQuantityBar;
7545 protected bool m_CanBeDigged;
7546 protected bool m_IsResultOfSplit
7547
7548 string m_SoundAttType;
7549 // items color variables
7554 //-------------------------------------------------------
7555
7556 // light source managing
7558
7562
7563 //==============================================
7564 // agent system
7565 private int m_AttachedAgents;
7566
7568 void TransferModifiers(PlayerBase reciever);
7569
7570
7571 // Weapons & suppressors particle effects
7576 static int m_LastRegisteredWeaponID = 0;
7577
7578 // Overheating effects
7580 float m_OverheatingShots;
7581 ref Timer m_CheckOverheating;
7582 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
7583 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
7584 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
7585 ref array <ref OverheatingParticle> m_OverheatingParticles;
7586
7588 protected bool m_HideSelectionsBySlot;
7589
7590 // Admin Log
7591 PluginAdminLog m_AdminLog;
7592
7593 // misc
7594 ref Timer m_PhysDropTimer;
7595
7596 // Attachment Locking variables
7597 ref array<int> m_CompatibleLocks;
7598 protected int m_LockType;
7599 protected ref EffectSound m_LockingSound;
7600 protected string m_LockSoundSet;
7601
7602 // ItemSoundHandler
7603 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
7604 protected int m_SoundSyncPlay; // id for sound to play
7605 protected int m_SoundSyncStop; // id for sound to stop
7607
7608 //temperature
7609 private float m_TemperaturePerQuantityWeight;
7610
7611 // -------------------------------------------------------------------------
7612 void ItemBase()
7613 {
7614 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
7618
7619 if (!GetGame().IsDedicatedServer())
7620 {
7621 if (HasMuzzle())
7622 {
7624
7626 {
7628 }
7629 }
7630
7632 m_ActionsInitialize = false;
7633 }
7634
7635 m_OldLocation = null;
7636
7637 if (GetGame().IsServer())
7638 {
7639 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
7640 }
7641
7642 if (ConfigIsExisting("headSelectionsToHide"))
7643 {
7645 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
7646 }
7647
7648 m_HideSelectionsBySlot = false;
7649 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7650 {
7651 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
7652 }
7653
7654 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
7655
7656 m_IsResultOfSplit = false;
7657
7659 }
7660
7661 override void InitItemVariables()
7662 {
7663 super.InitItemVariables();
7664
7665 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
7666 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
7667 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
7668 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
7669 m_VarStackMax = ConfigGetFloat("varStackMax");
7670 m_Count = ConfigGetInt("count");
7671
7672 m_CanShowQuantity = ConfigGetBool("quantityShow");
7673 m_HasQuantityBar = ConfigGetBool("quantityBar");
7674
7675 m_CleannessInit = ConfigGetInt("varCleannessInit");
7677 m_CleannessMin = ConfigGetInt("varCleannessMin");
7678 m_CleannessMax = ConfigGetInt("varCleannessMax");
7679
7680 m_WantPlayImpactSound = false;
7681 m_ImpactSpeed = 0.0;
7682
7683 m_VarWetInit = ConfigGetFloat("varWetInit");
7685 m_VarWetMin = ConfigGetFloat("varWetMin");
7686 m_VarWetMax = ConfigGetFloat("varWetMax");
7687
7688 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
7689 if (IsLiquidContainer() && GetQuantity() != 0)
7691 m_IsBeingPlaced = false;
7692 m_IsHologram = false;
7693 m_IsTakeable = true;
7694 m_CanBeMovedOverride = false;
7698 m_CanBeDigged = ConfigGetBool("canBeDigged");
7699
7700 m_CompatibleLocks = new array<int>();
7701 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
7702 m_LockType = ConfigGetInt("lockType");
7703
7704 //Define if item can be split and set ability to be combined accordingly
7705 m_CanThisBeSplit = false;
7706 can_this_be_combined = false;
7707 if (ConfigIsExisting("canBeSplit"))
7708 {
7709 can_this_be_combined = ConfigGetBool("canBeSplit");
7711 }
7712
7713 m_ItemBehaviour = -1;
7714 if (ConfigIsExisting("itemBehaviour"))
7715 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
7716
7717 //RegisterNetSyncVariableInt("m_VariablesMask");
7718 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7719 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
7720 RegisterNetSyncVariableInt("m_VarLiquidType");
7721 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7722
7723 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7724 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7725 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7726
7727 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7728 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7729 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7730 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7731
7732 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7733 RegisterNetSyncVariableBool("m_IsTakeable");
7734 RegisterNetSyncVariableBool("m_IsHologram");
7735
7736 InitItemSounds();
7738 {
7739 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
7740 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
7741 }
7742
7743 m_LockSoundSet = ConfigGetString("lockSoundSet");
7744
7746 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7747 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
7748
7749 }
7750
7751 override int GetQuickBarBonus()
7752 {
7753 return m_QuickBarBonus;
7754 }
7755
7756 void InitializeActions()
7757 {
7759 if (!m_InputActionMap)
7760 {
7762 m_InputActionMap = iam;
7763 SetActions();
7765 }
7766 }
7767
7768 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
7769 {
7771 {
7772 m_ActionsInitialize = true;
7774 }
7775
7776 actions = m_InputActionMap.Get(action_input_type);
7777 }
7778
7779 void SetActions()
7780 {
7781 AddAction(ActionTakeItem);
7782 AddAction(ActionTakeItemToHands);
7783 AddAction(ActionWorldCraft);
7785 AddAction(ActionAttachWithSwitch);
7786 }
7787
7788 void SetActionAnimOverrides(); // Override action animation for specific item
7789
7790 void AddAction(typename actionName)
7791 {
7792 ActionBase action = ActionManagerBase.GetAction(actionName);
7793
7794 if (!action)
7795 {
7796 Debug.LogError("Action " + actionName + " dosn't exist!");
7797 return;
7798 }
7799
7800 typename ai = action.GetInputType();
7801 if (!ai)
7802 {
7803 m_ActionsInitialize = false;
7804 return;
7805 }
7806
7807 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7808 if (!action_array)
7809 {
7810 action_array = new array<ActionBase_Basic>;
7811 m_InputActionMap.Insert(ai, action_array);
7812 }
7813 if (LogManager.IsActionLogEnable())
7814 {
7815 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
7816 }
7817
7818 if (action_array.Find(action) != -1)
7819 {
7820 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
7821 }
7822 else
7823 {
7824 action_array.Insert(action);
7825 }
7826 }
7827
7828 void RemoveAction(typename actionName)
7829 {
7830 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7831 ActionBase action = player.GetActionManager().GetAction(actionName);
7832 typename ai = action.GetInputType();
7833 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7834
7835 if (action_array)
7836 {
7837 action_array.RemoveItem(action);
7838 }
7839 }
7840
7841 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
7842 // Set -1 for params which should stay in default state
7843 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
7844 {
7845 ActionOverrideData overrideData = new ActionOverrideData();
7846 overrideData.m_CommandUID = commandUID;
7847 overrideData.m_CommandUIDProne = commandUIDProne;
7848 overrideData.m_StanceMask = stanceMask;
7849
7850 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
7851 if (!actionMap) // create new map of action > overidables map
7852 {
7853 actionMap = new TActionAnimOverrideMap();
7854 m_ItemActionOverrides.Insert(action, actionMap);
7855 }
7856
7857 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
7858
7859 }
7860
7861 void OnItemInHandsPlayerSwimStart(PlayerBase player);
7862
7863 ScriptedLightBase GetLight();
7864
7865 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7866 void LoadParticleConfigOnFire(int id)
7867 {
7868 if (!m_OnFireEffect)
7870
7873
7874 string config_to_search = "CfgVehicles";
7875 string muzzle_owner_config;
7876
7877 if (!m_OnFireEffect.Contains(id))
7878 {
7879 if (IsInherited(Weapon))
7880 config_to_search = "CfgWeapons";
7881
7882 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7883
7884 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7885
7886 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
7887
7888 if (config_OnFire_subclass_count > 0)
7889 {
7890 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7891
7892 for (int i = 0; i < config_OnFire_subclass_count; i++)
7893 {
7894 string particle_class = "";
7895 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
7896 string config_OnFire_entry = config_OnFire_class + particle_class;
7897 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7898 WPOF_array.Insert(WPOF);
7899 }
7900
7901
7902 m_OnFireEffect.Insert(id, WPOF_array);
7903 }
7904 }
7905
7906 if (!m_OnBulletCasingEjectEffect.Contains(id))
7907 {
7908 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
7909 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7910
7911 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7912
7913 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7914
7915 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7916 {
7917 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7918
7919 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7920 {
7921 string particle_class2 = "";
7922 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7923 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7924 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7925 WPOBE_array.Insert(WPOBE);
7926 }
7927
7928
7929 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
7930 }
7931 }
7932 }
7933
7934 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7936 {
7939
7940 if (!m_OnOverheatingEffect.Contains(id))
7941 {
7942 string config_to_search = "CfgVehicles";
7943
7944 if (IsInherited(Weapon))
7945 config_to_search = "CfgWeapons";
7946
7947 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
7948 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7949
7950 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
7951 {
7952
7953 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
7954
7956 {
7957 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
7958 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7959 Error(error);
7960 return;
7961 }
7962
7963 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
7964 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
7965
7966
7967
7968 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
7969 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7970
7971 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7972 {
7973 string particle_class = "";
7974 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7975 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7976 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
7977
7978 if (entry_type == CT_CLASS)
7979 {
7980 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7981 WPOOH_array.Insert(WPOF);
7982 }
7983 }
7984
7985
7986 m_OnOverheatingEffect.Insert(id, WPOOH_array);
7987 }
7988 }
7989 }
7990
7991 float GetOverheatingValue()
7992 {
7993 return m_OverheatingShots;
7994 }
7995
7996 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
7997 {
7998 if (m_MaxOverheatingValue > 0)
7999 {
8001
8002 if (!m_CheckOverheating)
8004
8006 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8007
8008 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8009 }
8010 }
8011
8012 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8013 {
8015 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8016
8018 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8019
8021 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8022
8024 {
8026 }
8027 }
8028
8030 {
8032 }
8033
8034 void OnOverheatingDecay()
8035 {
8036 if (m_MaxOverheatingValue > 0)
8037 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8038 else
8040
8041 if (m_OverheatingShots <= 0)
8042 {
8045 }
8046 else
8047 {
8048 if (!m_CheckOverheating)
8050
8052 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8053 }
8054
8055 CheckOverheating(this, "", this);
8056 }
8057
8058 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8059 {
8061 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8062 }
8063
8064 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8065 {
8067 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8069 }
8070
8071 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8072 {
8074 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8075 }
8076
8077 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8078 {
8080 m_OverheatingParticles = new array<ref OverheatingParticle>;
8081
8082 OverheatingParticle OP = new OverheatingParticle();
8083 OP.RegisterParticle(p);
8084 OP.SetOverheatingLimitMin(min_heat_coef);
8085 OP.SetOverheatingLimitMax(max_heat_coef);
8086 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8087
8088 m_OverheatingParticles.Insert(OP);
8089 }
8090
8091 float GetOverheatingCoef()
8092 {
8093 if (m_MaxOverheatingValue > 0)
8095
8096 return -1;
8097 }
8098
8100 {
8102 {
8103 float overheat_coef = GetOverheatingCoef();
8104 int count = m_OverheatingParticles.Count();
8105
8106 for (int i = count; i > 0; --i)
8107 {
8108 int id = i - 1;
8109 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8110 Particle p = OP.GetParticle();
8111
8112 float overheat_min = OP.GetOverheatingLimitMin();
8113 float overheat_max = OP.GetOverheatingLimitMax();
8114
8115 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8116 {
8117 if (p)
8118 {
8119 p.Stop();
8120 OP.RegisterParticle(null);
8121 }
8122 }
8123 }
8124 }
8125 }
8126
8128 {
8130 {
8131 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
8132 {
8133 int id = i - 1;
8134 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8135
8136 if (OP)
8137 {
8138 Particle p = OP.GetParticle();
8139
8140 if (p)
8141 {
8142 p.Stop();
8143 }
8144
8145 delete OP;
8146 }
8147 }
8148
8149 m_OverheatingParticles.Clear();
8151 }
8152 }
8153
8155 float GetInfectionChance(int system = 0, Param param = null)
8156 {
8157 return 0.0;
8158 }
8159
8160
8161 float GetDisinfectQuantity(int system = 0, Param param1 = null)
8162 {
8163 return 250;//default value
8164 }
8165
8166 float GetFilterDamageRatio()
8167 {
8168 return 0;
8169 }
8170
8172 bool HasMuzzle()
8173 {
8174 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
8175 return true;
8176
8177 return false;
8178 }
8179
8181 int GetMuzzleID()
8182 {
8183 if (!m_WeaponTypeToID)
8185
8186 if (m_WeaponTypeToID.Contains(GetType()))
8187 {
8188 return m_WeaponTypeToID.Get(GetType());
8189 }
8190 else
8191 {
8192 // Register new weapon ID
8194 }
8195
8197 }
8198
8205 {
8206 return -1;
8207 }
8208
8209
8210
8211 // -------------------------------------------------------------------------
8212 void ~ItemBase()
8213 {
8214 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
8215 {
8216 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8217 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8218
8219 if (r_index >= 0)
8220 {
8221 InventoryLocation r_il = new InventoryLocation;
8222 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8223
8224 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8225 int r_type = r_il.GetType();
8226 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8227 {
8228 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8229 }
8230 else if (r_type == InventoryLocationType.ATTACHMENT)
8231 {
8232 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8233 }
8234
8235 }
8236
8237 player.GetHumanInventory().ClearUserReservedLocation(this);
8238 }
8239
8240 if (m_LockingSound)
8241 SEffectManager.DestroyEffect(m_LockingSound);
8242 }
8243
8244
8245
8246 // -------------------------------------------------------------------------
8247 static int GetDebugActionsMask()
8248 {
8249 return ItemBase.m_DebugActionsMask;
8250 }
8251
8252 static bool HasDebugActionsMask(int mask)
8253 {
8254 return ItemBase.m_DebugActionsMask & mask;
8255 }
8256
8257 static void SetDebugActionsMask(int mask)
8258 {
8259 ItemBase.m_DebugActionsMask = mask;
8260 }
8261
8262 static void AddDebugActionsMask(int mask)
8263 {
8264 ItemBase.m_DebugActionsMask |= mask;
8265 }
8266
8267 static void RemoveDebugActionsMask(int mask)
8268 {
8269 ItemBase.m_DebugActionsMask &= ~mask;
8270 }
8271
8272 static void ToggleDebugActionsMask(int mask)
8273 {
8274 if (HasDebugActionsMask(mask))
8275 {
8277 }
8278 else
8279 {
8280 AddDebugActionsMask(mask);
8281 }
8282 }
8283
8284 // -------------------------------------------------------------------------
8285 void SetCEBasedQuantity()
8286 {
8287 if (GetEconomyProfile())
8288 {
8289 float q_max = GetEconomyProfile().GetQuantityMax();
8290 if (q_max > 0)
8291 {
8292 float q_min = GetEconomyProfile().GetQuantityMin();
8293 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8294
8295 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
8296 {
8297 ComponentEnergyManager comp = GetCompEM();
8298 if (comp && (comp.GetEnergyMaxPristine() || comp.GetEnergyAtSpawn()))//checking for a potential for energy, we need to check both values, as both are optional, only when both are set to 0, we know the item can't have energy
8299 {
8300 comp.SetEnergy0To1(quantity_randomized);
8301 }
8302 }
8303 else if (HasQuantity())
8304 {
8305 SetQuantityNormalized(quantity_randomized, false);
8306 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
8307 }
8308
8309 }
8310 }
8311 }
8312
8314 void LockToParent()
8315 {
8316 EntityAI parent = GetHierarchyParent();
8317
8318 if (parent)
8319 {
8320 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8321 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8322 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
8323 }
8324 }
8325
8327 void UnlockFromParent()
8328 {
8329 EntityAI parent = GetHierarchyParent();
8330
8331 if (parent)
8332 {
8333 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8334 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8335 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
8336 }
8337 }
8338
8339 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
8340 {
8341 /*
8342 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
8343 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
8344 */
8345 ItemBase item2 = ItemBase.Cast(entity2);
8346
8347 if (GetGame().IsClient())
8348 {
8349 if (ScriptInputUserData.CanStoreInputUserData())
8350 {
8351 ScriptInputUserData ctx = new ScriptInputUserData;
8353 ctx.Write(-1);
8354 ItemBase i1 = this; // @NOTE: workaround for correct serialization
8355 ctx.Write(i1);
8356 ctx.Write(item2);
8357 ctx.Write(use_stack_max);
8358 ctx.Write(-1);
8359 ctx.Send();
8360
8361 if (IsCombineAll(item2, use_stack_max))
8362 {
8363 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8364 }
8365 }
8366 }
8367 else if (!GetGame().IsMultiplayer())
8368 {
8369 CombineItems(item2, use_stack_max);
8370 }
8371 }
8372
8373 bool IsLiquidPresent()
8374 {
8375 return (GetLiquidType() != 0 && HasQuantity());
8376 }
8377
8378 bool IsLiquidContainer()
8379 {
8380 return m_LiquidContainerMask != 0;
8381 }
8382
8384 {
8385 return m_LiquidContainerMask;
8386 }
8387
8388 bool IsBloodContainer()
8389 {
8390 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
8391 return false;
8392 }
8393
8394 bool IsNVG()
8395 {
8396 return false;
8397 }
8398
8401 bool IsExplosive()
8402 {
8403 return false;
8404 }
8405
8407 {
8408 return "";
8409 }
8410
8412
8413 bool IsLightSource()
8414 {
8415 return false;
8416 }
8417
8419 {
8420 return true;
8421 }
8422
8423 //--- ACTION CONDITIONS
8424 //direction
8425 bool IsFacingPlayer(PlayerBase player, string selection)
8426 {
8427 return true;
8428 }
8429
8430 bool IsPlayerInside(PlayerBase player, string selection)
8431 {
8432 return true;
8433 }
8434
8435 override bool CanObstruct()
8436 {
8437 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
8438 return !player || !IsPlayerInside(player, "");
8439 }
8440
8441 override bool IsBeingPlaced()
8442 {
8443 return m_IsBeingPlaced;
8444 }
8445
8446 void SetIsBeingPlaced(bool is_being_placed)
8447 {
8448 m_IsBeingPlaced = is_being_placed;
8449 if (!is_being_placed)
8451 SetSynchDirty();
8452 }
8453
8454 //server-side
8455 void OnEndPlacement() {}
8456
8457 override bool IsHologram()
8458 {
8459 return m_IsHologram;
8460 }
8461
8462 bool CanBeDigged()
8463 {
8464 return m_CanBeDigged;
8465 }
8466
8468 {
8469 return 1;
8470 }
8471
8472 bool CanMakeGardenplot()
8473 {
8474 return false;
8475 }
8476
8477 void SetIsHologram(bool is_hologram)
8478 {
8479 m_IsHologram = is_hologram;
8480 SetSynchDirty();
8481 }
8482 /*
8483 protected float GetNutritionalEnergy()
8484 {
8485 Edible_Base edible = Edible_Base.Cast(this);
8486 return edible.GetFoodEnergy();
8487 }
8488
8489 protected float GetNutritionalWaterContent()
8490 {
8491 Edible_Base edible = Edible_Base.Cast(this);
8492 return edible.GetFoodWater();
8493 }
8494
8495 protected float GetNutritionalIndex()
8496 {
8497 Edible_Base edible = Edible_Base.Cast(this);
8498 return edible.GetFoodNutritionalIndex();
8499 }
8500
8501 protected float GetNutritionalFullnessIndex()
8502 {
8503 Edible_Base edible = Edible_Base.Cast(this);
8504 return edible.GetFoodTotalVolume();
8505 }
8506
8507 protected float GetNutritionalToxicity()
8508 {
8509 Edible_Base edible = Edible_Base.Cast(this);
8510 return edible.GetFoodToxicity();
8511
8512 }
8513 */
8514
8515
8516 // -------------------------------------------------------------------------
8517 override void OnMovedInsideCargo(EntityAI container)
8518 {
8519 super.OnMovedInsideCargo(container);
8520
8521 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8522 }
8523
8524 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8525 {
8526 super.EEItemLocationChanged(oldLoc,newLoc);
8527
8528 PlayerBase new_player = null;
8529 PlayerBase old_player = null;
8530
8531 if (newLoc.GetParent())
8532 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8533
8534 if (oldLoc.GetParent())
8535 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8536
8537 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
8538 {
8539 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8540
8541 if (r_index >= 0)
8542 {
8543 InventoryLocation r_il = new InventoryLocation;
8544 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8545
8546 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8547 int r_type = r_il.GetType();
8548 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8549 {
8550 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8551 }
8552 else if (r_type == InventoryLocationType.ATTACHMENT)
8553 {
8554 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8555 }
8556
8557 }
8558 }
8559
8560 if (newLoc.GetType() == InventoryLocationType.HANDS)
8561 {
8562 if (new_player)
8563 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8564
8565 if (new_player == old_player)
8566 {
8567
8568 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8569 {
8570 if (oldLoc.GetType() == InventoryLocationType.CARGO)
8571 {
8572 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8573 {
8574 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8575 }
8576 }
8577 else
8578 {
8579 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8580 }
8581 }
8582
8583 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8584 {
8585 int type = oldLoc.GetType();
8586 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
8587 {
8588 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8589 }
8590 else if (type == InventoryLocationType.ATTACHMENT)
8591 {
8592 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8593 }
8594 }
8595 if (!m_OldLocation)
8596 {
8597 m_OldLocation = new InventoryLocation;
8598 }
8599 m_OldLocation.Copy(oldLoc);
8600 }
8601 else
8602 {
8603 if (m_OldLocation)
8604 {
8605 m_OldLocation.Reset();
8606 }
8607 }
8608
8610 }
8611 else
8612 {
8613 if (new_player)
8614 {
8615 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8616 if (res_index >= 0)
8617 {
8618 InventoryLocation il = new InventoryLocation;
8619 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8620 ItemBase it = ItemBase.Cast(il.GetItem());
8621 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8622 int rel_type = il.GetType();
8623 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
8624 {
8625 il.GetParent().GetOnReleaseLock().Invoke(it);
8626 }
8627 else if (rel_type == InventoryLocationType.ATTACHMENT)
8628 {
8629 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
8630 }
8631 //it.GetOnReleaseLock().Invoke(it);
8632 }
8633 }
8634 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
8635 {
8636 //ThrowPhysically(old_player, vector.Zero);
8637 m_ThrowItemOnDrop = false;
8638 }
8639
8640 if (m_OldLocation)
8641 {
8642 m_OldLocation.Reset();
8643 }
8644 }
8645 }
8646
8647 override void EOnContact(IEntity other, Contact extra)
8648 {
8650 {
8651 int liquidType = -1;
8652 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
8653 if (impactSpeed > 0.0)
8654 {
8655 m_ImpactSpeed = impactSpeed;
8656 #ifndef SERVER
8657 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8658 #else
8659 m_WantPlayImpactSound = true;
8660 SetSynchDirty();
8661 #endif
8662 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
8663 }
8664 }
8665
8666 #ifdef SERVER
8667 if (GetCompEM() && GetCompEM().IsPlugged())
8668 {
8669 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
8670 GetCompEM().UnplugThis();
8671 }
8672 #endif
8673 }
8674
8675 void RefreshPhysics();
8676
8677 override void OnCreatePhysics()
8678 {
8680 }
8681
8682 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8683 {
8684
8685 }
8686 // -------------------------------------------------------------------------
8687 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
8688 {
8689 super.OnItemLocationChanged(old_owner, new_owner);
8690
8691 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8692 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8693
8694 if (!relatedPlayer && playerNew)
8695 relatedPlayer = playerNew;
8696
8697 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8698 {
8699 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
8700 if (actionMgr)
8701 {
8702 ActionBase currentAction = actionMgr.GetRunningAction();
8703 if (currentAction)
8704 currentAction.OnItemLocationChanged(this);
8705 }
8706 }
8707
8708 Man ownerPlayerOld = null;
8709 Man ownerPlayerNew = null;
8710
8711 if (old_owner)
8712 {
8713 if (old_owner.IsMan())
8714 {
8715 ownerPlayerOld = Man.Cast(old_owner);
8716 }
8717 else
8718 {
8719 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8720 }
8721 }
8722 else
8723 {
8724 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
8725 {
8726 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
8727
8728 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
8729 {
8730 GetCompEM().UnplugThis();
8731 }
8732 }
8733 }
8734
8735 if (new_owner)
8736 {
8737 if (new_owner.IsMan())
8738 {
8739 ownerPlayerNew = Man.Cast(new_owner);
8740 }
8741 else
8742 {
8743 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8744 }
8745 }
8746
8747 if (ownerPlayerOld != ownerPlayerNew)
8748 {
8749 if (ownerPlayerOld)
8750 {
8751 array<EntityAI> subItemsExit = new array<EntityAI>;
8752 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
8753 for (int i = 0; i < subItemsExit.Count(); i++)
8754 {
8755 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
8756 itemExit.OnInventoryExit(ownerPlayerOld);
8757 }
8758 }
8759
8760 if (ownerPlayerNew)
8761 {
8762 array<EntityAI> subItemsEnter = new array<EntityAI>;
8763 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
8764 for (int j = 0; j < subItemsEnter.Count(); j++)
8765 {
8766 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
8767 itemEnter.OnInventoryEnter(ownerPlayerNew);
8768 }
8769 }
8770 }
8771 else if (ownerPlayerNew != null)
8772 {
8773 PlayerBase nplayer;
8774 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8775 {
8776 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8777 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
8778 for (int k = 0; k < subItemsUpdate.Count(); k++)
8779 {
8780 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
8781 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8782 }
8783 }
8784 }
8785
8786 if (old_owner)
8787 old_owner.OnChildItemRemoved(this);
8788 if (new_owner)
8789 new_owner.OnChildItemReceived(this);
8790 }
8791
8792 // -------------------------------------------------------------------------------
8793 override void EEDelete(EntityAI parent)
8794 {
8795 super.EEDelete(parent);
8796 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8797 if (player)
8798 {
8799 OnInventoryExit(player);
8800
8801 if (player.IsAlive())
8802 {
8803 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8804 if (r_index >= 0)
8805 {
8806 InventoryLocation r_il = new InventoryLocation;
8807 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8808
8809 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8810 int r_type = r_il.GetType();
8811 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8812 {
8813 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8814 }
8815 else if (r_type == InventoryLocationType.ATTACHMENT)
8816 {
8817 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8818 }
8819
8820 }
8821
8822 player.RemoveQuickBarEntityShortcut(this);
8823 }
8824 }
8825 }
8826 // -------------------------------------------------------------------------------
8827 override void EEKilled(Object killer)
8828 {
8829 super.EEKilled(killer);
8830
8832 if (killer && killer.IsFireplace() && CanExplodeInFire())
8833 {
8834 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8835 {
8836 if (IsMagazine())
8837 {
8838 if (Magazine.Cast(this).GetAmmoCount() > 0)
8839 {
8840 ExplodeAmmo();
8841 }
8842 }
8843 else
8844 {
8845 Explode(DamageType.EXPLOSION);
8846 }
8847 }
8848 }
8849 }
8850
8851 override void OnWasAttached(EntityAI parent, int slot_id)
8852 {
8853 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8854
8855 super.OnWasAttached(parent, slot_id);
8856
8857 if (HasQuantity())
8858 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8859
8860 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
8861 }
8862
8863 override void OnWasDetached(EntityAI parent, int slot_id)
8864 {
8865 super.OnWasDetached(parent, slot_id);
8866
8867 if (HasQuantity())
8868 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8869 }
8870
8871 override string ChangeIntoOnAttach(string slot)
8872 {
8873 int idx;
8874 TStringArray inventory_slots = new TStringArray;
8875 TStringArray attach_types = new TStringArray;
8876
8877 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8878 if (inventory_slots.Count() < 1) //is string
8879 {
8880 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8881 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8882 }
8883 else //is array
8884 {
8885 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8886 }
8887
8888 idx = inventory_slots.Find(slot);
8889 if (idx < 0)
8890 return "";
8891
8892 return attach_types.Get(idx);
8893 }
8894
8895 override string ChangeIntoOnDetach()
8896 {
8897 int idx = -1;
8898 string slot;
8899
8900 TStringArray inventory_slots = new TStringArray;
8901 TStringArray detach_types = new TStringArray;
8902
8903 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8904 if (inventory_slots.Count() < 1) //is string
8905 {
8906 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8907 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8908 }
8909 else //is array
8910 {
8911 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8912 if (detach_types.Count() < 1)
8913 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8914 }
8915
8916 for (int i = 0; i < inventory_slots.Count(); i++)
8917 {
8918 slot = inventory_slots.Get(i);
8919 }
8920
8921 if (slot != "")
8922 {
8923 if (detach_types.Count() == 1)
8924 idx = 0;
8925 else
8926 idx = inventory_slots.Find(slot);
8927 }
8928 if (idx < 0)
8929 return "";
8930
8931 return detach_types.Get(idx);
8932 }
8933
8934 void ExplodeAmmo()
8935 {
8936 //timer
8937 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
8938
8939 //min/max time
8940 float min_time = 1;
8941 float max_time = 3;
8942 float delay = Math.RandomFloat(min_time, max_time);
8943
8944 explode_timer.Run(delay, this, "DoAmmoExplosion");
8945 }
8946
8947 void DoAmmoExplosion()
8948 {
8949 Magazine magazine = Magazine.Cast(this);
8950 int pop_sounds_count = 6;
8951 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8952
8953 //play sound
8954 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8955 string sound_name = pop_sounds[ sound_idx ];
8956 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
8957
8958 //remove ammo count
8959 magazine.ServerAddAmmoCount(-1);
8960
8961 //if condition then repeat -> ExplodeAmmo
8962 float min_temp_to_explode = 100; //min temperature for item to explode
8963
8964 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
8965 {
8966 ExplodeAmmo();
8967 }
8968 }
8969
8970 // -------------------------------------------------------------------------------
8971 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
8972 {
8973 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
8974
8975 const int CHANCE_DAMAGE_CARGO = 4;
8976 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8977 const int CHANCE_DAMAGE_NOTHING = 2;
8978
8979 if (IsClothing() || IsContainer() || IsItemTent())
8980 {
8981 float dmg = damageResult.GetDamage("","Health") * -0.5;
8982 int chances;
8983 int rnd;
8984
8985 if (GetInventory().GetCargo())
8986 {
8987 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8988 rnd = Math.RandomInt(0,chances);
8989
8990 if (rnd < CHANCE_DAMAGE_CARGO)
8991 {
8992 DamageItemInCargo(dmg);
8993 }
8994 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8995 {
8997 }
8998 }
8999 else
9000 {
9001 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9002 rnd = Math.RandomInt(0,chances);
9003
9004 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9005 {
9007 }
9008 }
9009 }
9010 }
9011
9012 bool DamageItemInCargo(float damage)
9013 {
9014 if (GetInventory().GetCargo())
9015 {
9016 int item_count = GetInventory().GetCargo().GetItemCount();
9017 if (item_count > 0)
9018 {
9019 int random_pick = Math.RandomInt(0, item_count);
9020 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9021 if (!item.IsExplosive())
9022 {
9023 item.AddHealth("","",damage);
9024 return true;
9025 }
9026 }
9027 }
9028 return false;
9029 }
9030
9031 bool DamageItemAttachments(float damage)
9032 {
9033 int attachment_count = GetInventory().AttachmentCount();
9034 if (attachment_count > 0)
9035 {
9036 int random_pick = Math.RandomInt(0, attachment_count);
9037 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9038 if (!attachment.IsExplosive())
9039 {
9040 attachment.AddHealth("","",damage);
9041 return true;
9042 }
9043 }
9044 return false;
9045 }
9046
9047 override bool IsSplitable()
9048 {
9049 return m_CanThisBeSplit;
9050 }
9051 //----------------
9052 override bool CanBeSplit()
9053 {
9054 if (IsSplitable() && (GetQuantity() > 1))
9055 return GetInventory().CanRemoveEntity();
9056
9057 return false;
9058 }
9059
9060 protected bool ShouldSplitQuantity(float quantity)
9061 {
9062 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
9063 if (!IsSplitable())
9064 return false;
9065
9066 // nothing to split?
9067 if (GetQuantity() <= 1)
9068 return false;
9069
9070 // check if we should re-use the item instead of creating a new copy?
9071 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
9072 int delta = GetQuantity() - quantity;
9073 if (delta == 0)
9074 return false;
9075
9076 // valid to split
9077 return true;
9078 }
9079
9080 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9081 {
9082 if (GetGame().IsClient())
9083 {
9084 if (ScriptInputUserData.CanStoreInputUserData())
9085 {
9086 ScriptInputUserData ctx = new ScriptInputUserData;
9088 ctx.Write(1);
9089 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9090 ctx.Write(i1);
9091 ctx.Write(destination_entity);
9092 ctx.Write(true);
9093 ctx.Write(slot_id);
9094 ctx.Send();
9095 }
9096 }
9097 else if (!GetGame().IsMultiplayer())
9098 {
9099 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9100 }
9101 }
9102
9103 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9104 {
9105 float split_quantity_new;
9106 ItemBase new_item;
9107 float quantity = GetQuantity();
9108 float stack_max = GetTargetQuantityMax(slot_id);
9109 InventoryLocation loc = new InventoryLocation;
9110
9111 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9112 {
9113 if (stack_max <= GetQuantity())
9114 split_quantity_new = stack_max;
9115 else
9116 split_quantity_new = GetQuantity();
9117
9118 if (ShouldSplitQuantity(split_quantity_new))
9119 {
9120 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9121 if (new_item)
9122 {
9123 new_item.SetResultOfSplit(true);
9124 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9125 AddQuantity(-split_quantity_new, false, true);
9126 new_item.SetQuantity(split_quantity_new, false, true);
9127 }
9128 }
9129 }
9130 else if (destination_entity && slot_id == -1)
9131 {
9132 if (quantity > stack_max)
9133 split_quantity_new = stack_max;
9134 else
9135 split_quantity_new = quantity;
9136
9137 if (ShouldSplitQuantity(split_quantity_new))
9138 {
9139 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9140 {
9141 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9142 new_item = ItemBase.Cast(o);
9143 }
9144
9145 if (new_item)
9146 {
9147 new_item.SetResultOfSplit(true);
9148 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9149 AddQuantity(-split_quantity_new, false, true);
9150 new_item.SetQuantity(split_quantity_new, false, true);
9151 }
9152 }
9153 }
9154 else
9155 {
9156 if (stack_max != 0)
9157 {
9158 if (stack_max < GetQuantity())
9159 {
9160 split_quantity_new = GetQuantity() - stack_max;
9161 }
9162
9163 if (split_quantity_new == 0)
9164 {
9165 if (!GetGame().IsMultiplayer())
9166 player.PhysicalPredictiveDropItem(this);
9167 else
9168 player.ServerDropEntity(this);
9169 return;
9170 }
9171
9172 if (ShouldSplitQuantity(split_quantity_new))
9173 {
9174 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9175
9176 if (new_item)
9177 {
9178 new_item.SetResultOfSplit(true);
9179 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9180 SetQuantity(split_quantity_new, false, true);
9181 new_item.SetQuantity(stack_max, false, true);
9182 new_item.PlaceOnSurface();
9183 }
9184 }
9185 }
9186 }
9187 }
9188
9189 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
9190 {
9191 float split_quantity_new;
9192 ItemBase new_item;
9193 float quantity = GetQuantity();
9194 float stack_max = GetTargetQuantityMax(slot_id);
9195 InventoryLocation loc = new InventoryLocation;
9196
9197 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9198 {
9199 if (stack_max <= GetQuantity())
9200 split_quantity_new = stack_max;
9201 else
9202 split_quantity_new = GetQuantity();
9203
9204 if (ShouldSplitQuantity(split_quantity_new))
9205 {
9206 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9207 if (new_item)
9208 {
9209 new_item.SetResultOfSplit(true);
9210 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9211 AddQuantity(-split_quantity_new, false, true);
9212 new_item.SetQuantity(split_quantity_new, false, true);
9213 }
9214 }
9215 }
9216 else if (destination_entity && slot_id == -1)
9217 {
9218 if (quantity > stack_max)
9219 split_quantity_new = stack_max;
9220 else
9221 split_quantity_new = quantity;
9222
9223 if (ShouldSplitQuantity(split_quantity_new))
9224 {
9225 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9226 {
9227 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9228 new_item = ItemBase.Cast(o);
9229 }
9230
9231 if (new_item)
9232 {
9233 new_item.SetResultOfSplit(true);
9234 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9235 AddQuantity(-split_quantity_new, false, true);
9236 new_item.SetQuantity(split_quantity_new, false, true);
9237 }
9238 }
9239 }
9240 else
9241 {
9242 if (stack_max != 0)
9243 {
9244 if (stack_max < GetQuantity())
9245 {
9246 split_quantity_new = GetQuantity() - stack_max;
9247 }
9248
9249 if (ShouldSplitQuantity(split_quantity_new))
9250 {
9251 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9252
9253 if (new_item)
9254 {
9255 new_item.SetResultOfSplit(true);
9256 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9257 SetQuantity(split_quantity_new, false, true);
9258 new_item.SetQuantity(stack_max, false, true);
9259 new_item.PlaceOnSurface();
9260 }
9261 }
9262 }
9263 }
9264 }
9265
9266 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
9267 {
9268 if (GetGame().IsClient())
9269 {
9270 if (ScriptInputUserData.CanStoreInputUserData())
9271 {
9272 ScriptInputUserData ctx = new ScriptInputUserData;
9274 ctx.Write(4);
9275 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9276 ctx.Write(thiz);
9277 dst.WriteToContext(ctx);
9278 ctx.Send();
9279 }
9280 }
9281 else if (!GetGame().IsMultiplayer())
9282 {
9284 }
9285 }
9286
9287 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
9288 {
9289 if (GetGame().IsClient())
9290 {
9291 if (ScriptInputUserData.CanStoreInputUserData())
9292 {
9293 ScriptInputUserData ctx = new ScriptInputUserData;
9295 ctx.Write(2);
9296 ItemBase dummy = this; // @NOTE: workaround for correct serialization
9297 ctx.Write(dummy);
9298 ctx.Write(destination_entity);
9299 ctx.Write(true);
9300 ctx.Write(idx);
9301 ctx.Write(row);
9302 ctx.Write(col);
9303 ctx.Send();
9304 }
9305 }
9306 else if (!GetGame().IsMultiplayer())
9307 {
9308 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
9309 }
9310 }
9311
9312 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
9313 {
9315 }
9316
9317 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
9318 {
9319 float quantity = GetQuantity();
9320 float split_quantity_new;
9321 ItemBase new_item;
9322 if (dst.IsValid())
9323 {
9324 int slot_id = dst.GetSlot();
9325 float stack_max = GetTargetQuantityMax(slot_id);
9326
9327 if (quantity > stack_max)
9328 split_quantity_new = stack_max;
9329 else
9330 split_quantity_new = quantity;
9331
9332 if (ShouldSplitQuantity(split_quantity_new))
9333 {
9334 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9335
9336 if (new_item)
9337 {
9338 new_item.SetResultOfSplit(true);
9339 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9340 AddQuantity(-split_quantity_new, false, true);
9341 new_item.SetQuantity(split_quantity_new, false, true);
9342 }
9343
9344 return new_item;
9345 }
9346 }
9347
9348 return null;
9349 }
9350
9351 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
9352 {
9353 float quantity = GetQuantity();
9354 float split_quantity_new;
9355 ItemBase new_item;
9356 if (destination_entity)
9357 {
9358 float stackable = GetTargetQuantityMax();
9359 if (quantity > stackable)
9360 split_quantity_new = stackable;
9361 else
9362 split_quantity_new = quantity;
9363
9364 if (ShouldSplitQuantity(split_quantity_new))
9365 {
9366 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
9367 if (new_item)
9368 {
9369 new_item.SetResultOfSplit(true);
9370 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9371 AddQuantity(-split_quantity_new, false, true);
9372 new_item.SetQuantity(split_quantity_new, false, true);
9373 }
9374 }
9375 }
9376 }
9377
9378 void SplitIntoStackMaxHandsClient(PlayerBase player)
9379 {
9380 if (GetGame().IsClient())
9381 {
9382 if (ScriptInputUserData.CanStoreInputUserData())
9383 {
9384 ScriptInputUserData ctx = new ScriptInputUserData;
9386 ctx.Write(3);
9387 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9388 ctx.Write(i1);
9389 ItemBase destination_entity = this;
9390 ctx.Write(destination_entity);
9391 ctx.Write(true);
9392 ctx.Write(0);
9393 ctx.Send();
9394 }
9395 }
9396 else if (!GetGame().IsMultiplayer())
9397 {
9398 SplitIntoStackMaxHands(player);
9399 }
9400 }
9401
9402 void SplitIntoStackMaxHands(PlayerBase player)
9403 {
9404 float quantity = GetQuantity();
9405 float split_quantity_new;
9406 ref ItemBase new_item;
9407 if (player)
9408 {
9409 float stackable = GetTargetQuantityMax();
9410 if (quantity > stackable)
9411 split_quantity_new = stackable;
9412 else
9413 split_quantity_new = quantity;
9414
9415 if (ShouldSplitQuantity(split_quantity_new))
9416 {
9417 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
9418 new_item = ItemBase.Cast(in_hands);
9419 if (new_item)
9420 {
9421 new_item.SetResultOfSplit(true);
9422 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9423 AddQuantity(-split_quantity_new, false, true);
9424 new_item.SetQuantity(split_quantity_new, false, true);
9425 }
9426 }
9427 }
9428 }
9429
9430 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
9431 {
9432 float quantity = GetQuantity();
9433 float split_quantity_new = Math.Floor(quantity * 0.5);
9434
9435 if (!ShouldSplitQuantity(split_quantity_new))
9436 return;
9437
9438 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9439
9440 if (new_item)
9441 {
9442 if (new_item.GetQuantityMax() < split_quantity_new)
9443 {
9444 split_quantity_new = new_item.GetQuantityMax();
9445 }
9446
9447 new_item.SetResultOfSplit(true);
9448 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9449
9450 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9451 {
9452 AddQuantity(-1, false, true);
9453 new_item.SetQuantity(1, false, true);
9454 }
9455 else
9456 {
9457 AddQuantity(-split_quantity_new, false, true);
9458 new_item.SetQuantity(split_quantity_new, false, true);
9459 }
9460 }
9461 }
9462
9463 void SplitItem(PlayerBase player)
9464 {
9465 float quantity = GetQuantity();
9466 float split_quantity_new = Math.Floor(quantity / 2);
9467
9468 if (!ShouldSplitQuantity(split_quantity_new))
9469 return;
9470
9471 InventoryLocation invloc = new InventoryLocation;
9472 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
9473
9474 ItemBase new_item;
9475 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9476
9477 if (new_item)
9478 {
9479 if (new_item.GetQuantityMax() < split_quantity_new)
9480 {
9481 split_quantity_new = new_item.GetQuantityMax();
9482 }
9483 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9484 {
9485 AddQuantity(-1, false, true);
9486 new_item.SetQuantity(1, false, true);
9487 }
9488 else if (split_quantity_new > 1)
9489 {
9490 AddQuantity(-split_quantity_new, false, true);
9491 new_item.SetQuantity(split_quantity_new, false, true);
9492 }
9493 }
9494 }
9495
9497 void OnQuantityChanged(float delta)
9498 {
9499 SetWeightDirty();
9500 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
9501
9502 if (parent)
9503 parent.OnAttachmentQuantityChangedEx(this, delta);
9504
9505 if (IsLiquidContainer())
9506 {
9507 if (GetQuantityNormalized() <= 0.0)
9508 {
9510 }
9511 else if (GetLiquidType() == LIQUID_NONE)
9512 {
9513 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
9515 }
9516 }
9517
9518 }
9519
9522 {
9523 // insert code here
9524 }
9525
9527 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
9528 {
9530 }
9531
9532 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
9533 {
9534 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9535
9536 if (GetGame().IsServer())
9537 {
9538 if (newLevel == GameConstants.STATE_RUINED)
9539 {
9541 EntityAI parent = GetHierarchyParent();
9542 if (parent && parent.IsFireplace())
9543 {
9544 CargoBase cargo = GetInventory().GetCargo();
9545 if (cargo)
9546 {
9547 for (int i = 0; i < cargo.GetItemCount(); ++i)
9548 {
9549 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
9550 }
9551 }
9552 }
9553 }
9554
9555 if (IsResultOfSplit())
9556 {
9557 // reset the splitting result flag, return to normal item behavior
9558 SetResultOfSplit(false);
9559 return;
9560 }
9561
9562 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9563 {
9564 SetCleanness(0);//unclean the item upon damage dealt
9565 }
9566 }
9567 }
9568
9569 // just the split? TODO: verify
9570 override void OnRightClick()
9571 {
9572 super.OnRightClick();
9573
9574 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
9575 {
9576 if (GetGame().IsClient())
9577 {
9578 if (ScriptInputUserData.CanStoreInputUserData())
9579 {
9580 EntityAI root = GetHierarchyRoot();
9581 Man playerOwner = GetHierarchyRootPlayer();
9582 InventoryLocation dst = new InventoryLocation;
9583
9584 // If we have no hierarchy root player and the root is the same as this item the source item is in the vicinity so we want to create the new split item there also
9585 if (!playerOwner && root && root == this)
9586 {
9588 }
9589 else
9590 {
9591 // Check if we can place the new split item in the same parent where the source item is placed in or otherwise drop it in vicinity
9592 GetInventory().GetCurrentInventoryLocation(dst);
9593 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
9594 {
9595 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9596 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
9597 {
9599 }
9600 else
9601 {
9602 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
9603 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
9604 this shouldnt cause issues within this scope*/
9605 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
9606 {
9608 }
9609 else
9610 {
9611 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9612 }
9613 }
9614 }
9615 }
9616
9617 ScriptInputUserData ctx = new ScriptInputUserData;
9619 ctx.Write(4);
9620 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9621 ctx.Write(thiz);
9622 dst.WriteToContext(ctx);
9623 ctx.Write(true); // dummy
9624 ctx.Send();
9625 }
9626 }
9627 else if (!GetGame().IsMultiplayer())
9628 {
9629 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
9630 }
9631 }
9632 }
9633
9634 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
9635 {
9636 if (root)
9637 {
9638 vector m4[4];
9639 root.GetTransform(m4);
9640 dst.SetGround(this, m4);
9641 }
9642 else
9643 {
9644 GetInventory().GetCurrentInventoryLocation(dst);
9645 }
9646 }
9647
9648 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
9649 {
9650 //TODO: delete check zero quantity check after fix double posts hands fsm events
9651 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
9652 return false;
9653
9654 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9655 return false;
9656
9657 //can_this_be_combined = ConfigGetBool("canBeSplit");
9659 return false;
9660
9661
9662 Magazine mag = Magazine.Cast(this);
9663 if (mag)
9664 {
9665 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9666 return false;
9667
9668 if (stack_max_limit)
9669 {
9670 Magazine other_mag = Magazine.Cast(other_item);
9671 if (other_item)
9672 {
9673 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9674 return false;
9675 }
9676
9677 }
9678 }
9679 else
9680 {
9681 //TODO: delete check zero quantity check after fix double posts hands fsm events
9682 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
9683 return false;
9684
9685 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
9686 return false;
9687 }
9688
9689 PlayerBase player = null;
9690 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
9691 {
9692 if (player.GetInventory().HasAttachment(this))
9693 return false;
9694
9695 if (player.IsItemsToDelete())
9696 return false;
9697 }
9698
9699 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9700 return false;
9701
9702 int slotID;
9703 string slotName;
9704 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9705 return false;
9706
9707 return true;
9708 }
9709
9710 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
9711 {
9712 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
9713 }
9714
9715 bool IsResultOfSplit()
9716 {
9717 return m_IsResultOfSplit;
9718 }
9719
9720 void SetResultOfSplit(bool value)
9721 {
9722 m_IsResultOfSplit = value;
9723 }
9724
9725 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
9726 {
9727 return ComputeQuantityUsedEx(other_item, use_stack_max);
9728 }
9729
9730 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
9731 {
9732 float other_item_quantity = other_item.GetQuantity();
9733 float this_free_space;
9734
9735 float stack_max = GetQuantityMax();
9736
9737 this_free_space = stack_max - GetQuantity();
9738
9739 if (other_item_quantity > this_free_space)
9740 {
9741 return this_free_space;
9742 }
9743 else
9744 {
9745 return other_item_quantity;
9746 }
9747 }
9748
9749 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
9750 {
9751 CombineItems(ItemBase.Cast(entity2),use_stack_max);
9752 }
9753
9754 void CombineItems(ItemBase other_item, bool use_stack_max = true)
9755 {
9756 if (!CanBeCombined(other_item, false))
9757 return;
9758
9759 if (!IsMagazine() && other_item)
9760 {
9761 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
9762 if (quantity_used != 0)
9763 {
9764 float hp1 = GetHealth01("","");
9765 float hp2 = other_item.GetHealth01("","");
9766 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
9767 hpResult = hpResult / (GetQuantity() + quantity_used);
9768
9769 hpResult *= GetMaxHealth();
9770 Math.Round(hpResult);
9771 SetHealth("", "Health", hpResult);
9772
9773 AddQuantity(quantity_used);
9774 other_item.AddQuantity(-quantity_used);
9775 }
9776 }
9777 OnCombine(other_item);
9778 }
9779
9780 void OnCombine(ItemBase other_item)
9781 {
9782 #ifdef SERVER
9783 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9784 GetHierarchyParent().IncreaseLifetimeUp();
9785 #endif
9786 };
9787
9788 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
9789 {
9790 PlayerBase p = PlayerBase.Cast(player);
9791
9792 array<int> recipesIds = p.m_Recipes;
9793 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9794 if (moduleRecipesManager)
9795 {
9796 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9797 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
9798 }
9799
9800 for (int i = 0;i < recipesIds.Count(); i++)
9801 {
9802 int key = recipesIds.Get(i);
9803 string recipeName = moduleRecipesManager.GetRecipeName(key);
9804 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
9805 }
9806 }
9807
9808 // -------------------------------------------------------------------------
9809 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9810 {
9811 super.GetDebugActions(outputList);
9812
9813 //quantity
9814 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
9815 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
9816 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
9817 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
9818 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9819
9820 //health
9821 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
9822 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
9823 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
9824 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9825 //temperature
9826 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
9827 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
9828 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
9829 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9830
9831 //wet
9832 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
9833 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
9834 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9835
9836 //liquidtype
9837 if (IsLiquidContainer())
9838 {
9839 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
9840 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
9841 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9842 }
9843
9844 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
9845 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9846
9847 // watch
9848 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
9849 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
9850 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9851
9852 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
9853
9854 InventoryLocation loc = new InventoryLocation();
9855 GetInventory().GetCurrentInventoryLocation(loc);
9856 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
9857 {
9858 if (Gizmo_IsSupported())
9859 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
9860 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
9861 }
9862
9863 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9864 }
9865
9866 // -------------------------------------------------------------------------
9867 // -------------------------------------------------------------------------
9868 // -------------------------------------------------------------------------
9869 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
9870 {
9871 super.OnAction(action_id, player, ctx);
9872
9873 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
9874 {
9875 switch (action_id)
9876 {
9877 case EActions.GIZMO_OBJECT:
9878 GetGame().GizmoSelectObject(this);
9879 return true;
9880 case EActions.GIZMO_PHYSICS:
9881 GetGame().GizmoSelectPhysics(GetPhysics());
9882 return true;
9883 }
9884 }
9885
9886 if (GetGame().IsServer())
9887 {
9888 switch (action_id)
9889 {
9890 case EActions.DELETE:
9891 Delete();
9892 return true;
9893 }
9894 }
9895
9896 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
9897 {
9898 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9899 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
9900 PlayerBase p = PlayerBase.Cast(player);
9901 if (EActions.RECIPES_RANGE_START < 1000)
9902 {
9903 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9904 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9905 }
9906 }
9907 #ifndef SERVER
9908 else if (action_id == EActions.WATCH_PLAYER)
9909 {
9910 PluginDeveloper.SetDeveloperItemClientEx(player);
9911 }
9912 #endif
9913 if (GetGame().IsServer())
9914 {
9915 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9916 {
9917 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9918 OnDebugButtonPressServer(id + 1);
9919 }
9920
9921 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9922 {
9923 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9924 InsertAgent(agent_id,100);
9925 }
9926
9927 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9928 {
9929 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9930 RemoveAgent(agent_id2);
9931 }
9932
9933 else if (action_id == EActions.ADD_QUANTITY)
9934 {
9935 if (IsMagazine())
9936 {
9937 Magazine mag = Magazine.Cast(this);
9938 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9939 }
9940 else
9941 {
9942 AddQuantity(GetQuantityMax() * 0.2);
9943 }
9944
9945 if (m_EM)
9946 {
9947 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9948 }
9949 //PrintVariables();
9950 }
9951
9952 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
9953 {
9954 if (IsMagazine())
9955 {
9956 Magazine mag2 = Magazine.Cast(this);
9957 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9958 }
9959 else
9960 {
9961 AddQuantity(- GetQuantityMax() * 0.2);
9962 }
9963 if (m_EM)
9964 {
9965 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9966 }
9967 //PrintVariables();
9968 }
9969
9970 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
9971 {
9972 SetQuantity(0);
9973
9974 if (m_EM)
9975 {
9976 m_EM.SetEnergy(0);
9977 }
9978 }
9979
9980 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
9981 {
9983
9984 if (m_EM)
9985 {
9986 m_EM.SetEnergy(m_EM.GetEnergyMax());
9987 }
9988 }
9989
9990 else if (action_id == EActions.ADD_HEALTH)
9991 {
9992 AddHealth("","",GetMaxHealth("","Health")/5);
9993 }
9994 else if (action_id == EActions.REMOVE_HEALTH)
9995 {
9996 AddHealth("","",-GetMaxHealth("","Health")/5);
9997 }
9998 else if (action_id == EActions.DESTROY_HEALTH)
9999 {
10000 SetHealth01("","",0);
10001 }
10002 else if (action_id == EActions.WATCH_ITEM)
10003 {
10005 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
10006 #ifdef DEVELOPER
10007 SetDebugDeveloper_item(this);
10008 #endif
10009 }
10010
10011 else if (action_id == EActions.ADD_TEMPERATURE)
10012 {
10013 AddTemperature(20);
10014 //PrintVariables();
10015 }
10016
10017 else if (action_id == EActions.REMOVE_TEMPERATURE)
10018 {
10019 AddTemperature(-20);
10020 //PrintVariables();
10021 }
10022
10023 else if (action_id == EActions.FLIP_FROZEN)
10024 {
10025 SetFrozen(!GetIsFrozen());
10026 //PrintVariables();
10027 }
10028
10029 else if (action_id == EActions.ADD_WETNESS)
10030 {
10031 AddWet(GetWetMax()/5);
10032 //PrintVariables();
10033 }
10034
10035 else if (action_id == EActions.REMOVE_WETNESS)
10036 {
10037 AddWet(-GetWetMax()/5);
10038 //PrintVariables();
10039 }
10040
10041 else if (action_id == EActions.LIQUIDTYPE_UP)
10042 {
10043 int curr_type = GetLiquidType();
10044 SetLiquidType(curr_type * 2);
10045 //AddWet(1);
10046 //PrintVariables();
10047 }
10048
10049 else if (action_id == EActions.LIQUIDTYPE_DOWN)
10050 {
10051 int curr_type2 = GetLiquidType();
10052 SetLiquidType(curr_type2 / 2);
10053 }
10054
10055 else if (action_id == EActions.MAKE_SPECIAL)
10056 {
10057 auto debugParams = DebugSpawnParams.WithPlayer(player);
10058 OnDebugSpawnEx(debugParams);
10059 }
10060
10061 }
10062
10063
10064 return false;
10065 }
10066
10067 // -------------------------------------------------------------------------
10068
10069
10072 void OnActivatedByTripWire();
10073
10075 void OnActivatedByItem(notnull ItemBase item);
10076
10077 //----------------------------------------------------------------
10078 //returns true if item is able to explode when put in fire
10079 bool CanExplodeInFire()
10080 {
10081 return false;
10082 }
10083
10084 //----------------------------------------------------------------
10085 bool CanEat()
10086 {
10087 return true;
10088 }
10089
10090 //----------------------------------------------------------------
10091 override bool IsIgnoredByConstruction()
10092 {
10093 return true;
10094 }
10095
10096 //----------------------------------------------------------------
10097 //has FoodStages in config?
10098 bool HasFoodStage()
10099 {
10100 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10101 return GetGame().ConfigIsExisting(config_path);
10102 }
10103
10105 FoodStage GetFoodStage()
10106 {
10107 return null;
10108 }
10109
10110 bool CanBeCooked()
10111 {
10112 return false;
10113 }
10114
10115 bool CanBeCookedOnStick()
10116 {
10117 return false;
10118 }
10119
10121 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10123
10124 //----------------------------------------------------------------
10125 bool CanRepair(ItemBase item_repair_kit)
10126 {
10127 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10128 return module_repairing.CanRepair(this, item_repair_kit);
10129 }
10130
10131 //----------------------------------------------------------------
10132 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10133 {
10134 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10135 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10136 }
10137
10138 //----------------------------------------------------------------
10139 int GetItemSize()
10140 {
10141 /*
10142 vector v_size = this.ConfigGetVector("itemSize");
10143 int v_size_x = v_size[0];
10144 int v_size_y = v_size[1];
10145 int size = v_size_x * v_size_y;
10146 return size;
10147 */
10148
10149 return 1;
10150 }
10151
10152 //----------------------------------------------------------------
10153 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10154 bool CanBeMovedOverride()
10155 {
10156 return m_CanBeMovedOverride;
10157 }
10158
10159 //----------------------------------------------------------------
10160 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10161 void SetCanBeMovedOverride(bool setting)
10162 {
10163 m_CanBeMovedOverride = setting;
10164 }
10165
10166 //----------------------------------------------------------------
10174 void MessageToOwnerStatus(string text)
10175 {
10176 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10177
10178 if (player)
10179 {
10180 player.MessageStatus(text);
10181 }
10182 }
10183
10184 //----------------------------------------------------------------
10192 void MessageToOwnerAction(string text)
10193 {
10194 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10195
10196 if (player)
10197 {
10198 player.MessageAction(text);
10199 }
10200 }
10201
10202 //----------------------------------------------------------------
10210 void MessageToOwnerFriendly(string text)
10211 {
10212 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10213
10214 if (player)
10215 {
10216 player.MessageFriendly(text);
10217 }
10218 }
10219
10220 //----------------------------------------------------------------
10228 void MessageToOwnerImportant(string text)
10229 {
10230 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10231
10232 if (player)
10233 {
10234 player.MessageImportant(text);
10235 }
10236 }
10237
10238 override bool IsItemBase()
10239 {
10240 return true;
10241 }
10242
10243 // Checks if item is of questioned kind
10244 override bool KindOf(string tag)
10245 {
10246 bool found = false;
10247 string item_name = this.GetType();
10248 ref TStringArray item_tag_array = new TStringArray;
10249 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
10250
10251 int array_size = item_tag_array.Count();
10252 for (int i = 0; i < array_size; i++)
10253 {
10254 if (item_tag_array.Get(i) == tag)
10255 {
10256 found = true;
10257 break;
10258 }
10259 }
10260 return found;
10261 }
10262
10263
10264 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
10265 {
10266 //Debug.Log("OnRPC called");
10267 super.OnRPC(sender, rpc_type,ctx);
10268
10269 //Play soundset for attachment locking (ActionLockAttachment.c)
10270 switch (rpc_type)
10271 {
10272 #ifndef SERVER
10273 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10274 Param2<bool, string> p = new Param2<bool, string>(false, "");
10275
10276 if (!ctx.Read(p))
10277 return;
10278
10279 bool play = p.param1;
10280 string soundSet = p.param2;
10281
10282 if (play)
10283 {
10284 if (m_LockingSound)
10285 {
10287 {
10288 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10289 }
10290 }
10291 else
10292 {
10293 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10294 }
10295 }
10296 else
10297 {
10298 SEffectManager.DestroyEffect(m_LockingSound);
10299 }
10300
10301 break;
10302 #endif
10303
10304 }
10305
10306 if (GetWrittenNoteData())
10307 {
10308 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
10309 }
10310 }
10311
10312 //-----------------------------
10313 // VARIABLE MANIPULATION SYSTEM
10314 //-----------------------------
10315 int NameToID(string name)
10316 {
10317 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10318 return plugin.GetID(name);
10319 }
10320
10321 string IDToName(int id)
10322 {
10323 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10324 return plugin.GetName(id);
10325 }
10326
10328 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
10329 {
10330 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
10331 //read the flags
10332 int varFlags;
10333 if (!ctx.Read(varFlags))
10334 return;
10335
10336 if (varFlags & ItemVariableFlags.FLOAT)
10337 {
10338 ReadVarsFromCTX(ctx);
10339 }
10340 }
10341
10342 override void SerializeNumericalVars(array<float> floats_out)
10343 {
10344 //some variables handled on EntityAI level already!
10345 super.SerializeNumericalVars(floats_out);
10346
10347 // the order of serialization must be the same as the order of de-serialization
10348 //--------------------------------------------
10349 if (IsVariableSet(VARIABLE_QUANTITY))
10350 {
10351 floats_out.Insert(m_VarQuantity);
10352 }
10353 //--------------------------------------------
10354 if (IsVariableSet(VARIABLE_WET))
10355 {
10356 floats_out.Insert(m_VarWet);
10357 }
10358 //--------------------------------------------
10359 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10360 {
10361 floats_out.Insert(m_VarLiquidType);
10362 }
10363 //--------------------------------------------
10364 if (IsVariableSet(VARIABLE_COLOR))
10365 {
10366 floats_out.Insert(m_ColorComponentR);
10367 floats_out.Insert(m_ColorComponentG);
10368 floats_out.Insert(m_ColorComponentB);
10369 floats_out.Insert(m_ColorComponentA);
10370 }
10371 //--------------------------------------------
10372 if (IsVariableSet(VARIABLE_CLEANNESS))
10373 {
10374 floats_out.Insert(m_Cleanness);
10375 }
10376 }
10377
10378 override void DeSerializeNumericalVars(array<float> floats)
10379 {
10380 //some variables handled on EntityAI level already!
10381 super.DeSerializeNumericalVars(floats);
10382
10383 // the order of serialization must be the same as the order of de-serialization
10384 int index = 0;
10385 int mask = Math.Round(floats.Get(index));
10386
10387 index++;
10388 //--------------------------------------------
10389 if (mask & VARIABLE_QUANTITY)
10390 {
10391 if (m_IsStoreLoad)
10392 {
10393 SetStoreLoadedQuantity(floats.Get(index));
10394 }
10395 else
10396 {
10397 float quantity = floats.Get(index);
10398 SetQuantity(quantity, true, false, false, false);
10399 }
10400 index++;
10401 }
10402 //--------------------------------------------
10403 if (mask & VARIABLE_WET)
10404 {
10405 float wet = floats.Get(index);
10406 SetWet(wet);
10407 index++;
10408 }
10409 //--------------------------------------------
10410 if (mask & VARIABLE_LIQUIDTYPE)
10411 {
10412 int liquidtype = Math.Round(floats.Get(index));
10413 SetLiquidType(liquidtype);
10414 index++;
10415 }
10416 //--------------------------------------------
10417 if (mask & VARIABLE_COLOR)
10418 {
10419 m_ColorComponentR = Math.Round(floats.Get(index));
10420 index++;
10421 m_ColorComponentG = Math.Round(floats.Get(index));
10422 index++;
10423 m_ColorComponentB = Math.Round(floats.Get(index));
10424 index++;
10425 m_ColorComponentA = Math.Round(floats.Get(index));
10426 index++;
10427 }
10428 //--------------------------------------------
10429 if (mask & VARIABLE_CLEANNESS)
10430 {
10431 int cleanness = Math.Round(floats.Get(index));
10432 SetCleanness(cleanness);
10433 index++;
10434 }
10435 }
10436
10437 override void WriteVarsToCTX(ParamsWriteContext ctx)
10438 {
10439 super.WriteVarsToCTX(ctx);
10440
10441 //--------------------------------------------
10442 if (IsVariableSet(VARIABLE_QUANTITY))
10443 {
10444 ctx.Write(GetQuantity());
10445 }
10446 //--------------------------------------------
10447 if (IsVariableSet(VARIABLE_WET))
10448 {
10449 ctx.Write(GetWet());
10450 }
10451 //--------------------------------------------
10452 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10453 {
10454 ctx.Write(GetLiquidType());
10455 }
10456 //--------------------------------------------
10457 if (IsVariableSet(VARIABLE_COLOR))
10458 {
10459 int r,g,b,a;
10460 GetColor(r,g,b,a);
10461 ctx.Write(r);
10462 ctx.Write(g);
10463 ctx.Write(b);
10464 ctx.Write(a);
10465 }
10466 //--------------------------------------------
10467 if (IsVariableSet(VARIABLE_CLEANNESS))
10468 {
10469 ctx.Write(GetCleanness());
10470 }
10471 }
10472
10473 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
10474 {
10475 if (!super.ReadVarsFromCTX(ctx,version))
10476 return false;
10477
10478 int intValue;
10479 float value;
10480
10481 if (version < 140)
10482 {
10483 if (!ctx.Read(intValue))
10484 return false;
10485
10486 m_VariablesMask = intValue;
10487 }
10488
10489 if (m_VariablesMask & VARIABLE_QUANTITY)
10490 {
10491 if (!ctx.Read(value))
10492 return false;
10493
10494 if (IsStoreLoad())
10495 {
10497 }
10498 else
10499 {
10500 SetQuantity(value, true, false, false, false);
10501 }
10502 }
10503 //--------------------------------------------
10504 if (version < 140)
10505 {
10506 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10507 {
10508 if (!ctx.Read(value))
10509 return false;
10510 SetTemperatureDirect(value);
10511 }
10512 }
10513 //--------------------------------------------
10514 if (m_VariablesMask & VARIABLE_WET)
10515 {
10516 if (!ctx.Read(value))
10517 return false;
10518 SetWet(value);
10519 }
10520 //--------------------------------------------
10521 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
10522 {
10523 if (!ctx.Read(intValue))
10524 return false;
10525 SetLiquidType(intValue);
10526 }
10527 //--------------------------------------------
10528 if (m_VariablesMask & VARIABLE_COLOR)
10529 {
10530 int r,g,b,a;
10531 if (!ctx.Read(r))
10532 return false;
10533 if (!ctx.Read(g))
10534 return false;
10535 if (!ctx.Read(b))
10536 return false;
10537 if (!ctx.Read(a))
10538 return false;
10539
10540 SetColor(r,g,b,a);
10541 }
10542 //--------------------------------------------
10543 if (m_VariablesMask & VARIABLE_CLEANNESS)
10544 {
10545 if (!ctx.Read(intValue))
10546 return false;
10547 SetCleanness(intValue);
10548 }
10549 //--------------------------------------------
10550 if (version >= 138 && version < 140)
10551 {
10552 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10553 {
10554 if (!ctx.Read(intValue))
10555 return false;
10556 SetFrozen(intValue);
10557 }
10558 }
10559
10560 return true;
10561 }
10562
10563 //----------------------------------------------------------------
10564 override bool OnStoreLoad(ParamsReadContext ctx, int version)
10565 {
10566 m_IsStoreLoad = true;
10568 {
10569 m_FixDamageSystemInit = true;
10570 }
10571
10572 if (!super.OnStoreLoad(ctx, version))
10573 {
10574 m_IsStoreLoad = false;
10575 return false;
10576 }
10577
10578 if (version >= 114)
10579 {
10580 bool hasQuickBarIndexSaved;
10581
10582 if (!ctx.Read(hasQuickBarIndexSaved))
10583 {
10584 m_IsStoreLoad = false;
10585 return false;
10586 }
10587
10588 if (hasQuickBarIndexSaved)
10589 {
10590 int itmQBIndex;
10591
10592 //Load quickbar item bind
10593 if (!ctx.Read(itmQBIndex))
10594 {
10595 m_IsStoreLoad = false;
10596 return false;
10597 }
10598
10599 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10600 if (itmQBIndex != -1 && parentPlayer)
10601 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10602 }
10603 }
10604 else
10605 {
10606 // Backup of how it used to be
10607 PlayerBase player;
10608 int itemQBIndex;
10609 if (version == int.MAX)
10610 {
10611 if (!ctx.Read(itemQBIndex))
10612 {
10613 m_IsStoreLoad = false;
10614 return false;
10615 }
10616 }
10617 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10618 {
10619 //Load quickbar item bind
10620 if (!ctx.Read(itemQBIndex))
10621 {
10622 m_IsStoreLoad = false;
10623 return false;
10624 }
10625 if (itemQBIndex != -1 && player)
10626 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10627 }
10628 }
10629
10630 if (version < 140)
10631 {
10632 // variable management system
10633 if (!LoadVariables(ctx, version))
10634 {
10635 m_IsStoreLoad = false;
10636 return false;
10637 }
10638 }
10639
10640 //agent trasmission system
10641 if (!LoadAgents(ctx, version))
10642 {
10643 m_IsStoreLoad = false;
10644 return false;
10645 }
10646 if (version >= 132)
10647 {
10648 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10649 if (raib)
10650 {
10651 if (!raib.OnStoreLoad(ctx,version))
10652 {
10653 m_IsStoreLoad = false;
10654 return false;
10655 }
10656 }
10657 }
10658
10659 m_IsStoreLoad = false;
10660 return true;
10661 }
10662
10663 //----------------------------------------------------------------
10664
10665 override void OnStoreSave(ParamsWriteContext ctx)
10666 {
10667 super.OnStoreSave(ctx);
10668
10669 PlayerBase player;
10670 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10671 {
10672 ctx.Write(true); // Keep track of if we should actually read this in or not
10673 //Save quickbar item bind
10674 int itemQBIndex = -1;
10675 itemQBIndex = player.FindQuickBarEntityIndex(this);
10676 ctx.Write(itemQBIndex);
10677 }
10678 else
10679 {
10680 ctx.Write(false); // Keep track of if we should actually read this in or not
10681 }
10682
10683 SaveAgents(ctx);//agent trasmission system
10684
10685 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10686 if (raib)
10687 {
10688 raib.OnStoreSave(ctx);
10689 }
10690 }
10691 //----------------------------------------------------------------
10692
10693 override void AfterStoreLoad()
10694 {
10695 super.AfterStoreLoad();
10696
10698 {
10700 }
10701
10702 if (GetStoreLoadedQuantity() != float.LOWEST)
10703 {
10705 SetStoreLoadedQuantity(float.LOWEST);//IMPORTANT to do this !! we use 'm_StoreLoadedQuantity' inside SetQuantity to distinguish between initial quantity setting and the consequent(normal gameplay) calls
10706 }
10707 }
10708
10709 override void EEOnAfterLoad()
10710 {
10711 super.EEOnAfterLoad();
10712
10714 {
10715 m_FixDamageSystemInit = false;
10716 }
10717
10720 }
10721
10722 bool CanBeDisinfected()
10723 {
10724 return false;
10725 }
10726
10727
10728 //----------------------------------------------------------------
10729 override void OnVariablesSynchronized()
10730 {
10731 if (m_Initialized)
10732 {
10733 #ifdef PLATFORM_CONSOLE
10734 //bruteforce it is
10735 if (IsSplitable())
10736 {
10737 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
10738 if (menu)
10739 {
10740 menu.Refresh();
10741 }
10742 }
10743 #endif
10744 }
10745
10747 {
10748 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
10749 m_WantPlayImpactSound = false;
10750 }
10751
10753 {
10754 SetWeightDirty();
10756 }
10757 if (m_VarWet != m_VarWetPrev)
10758 {
10761 }
10762
10763 if (m_SoundSyncPlay != 0)
10764 {
10765 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
10766 m_SoundSyncPlay = 0;
10767 }
10768 if (m_SoundSyncStop != 0)
10769 {
10770 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
10771 m_SoundSyncStop = 0;
10772 }
10773
10774 super.OnVariablesSynchronized();
10775 }
10776
10777 //------------------------- Quantity
10778 //----------------------------------------------------------------
10780 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
10781 {
10782 if (!IsServerCheck(allow_client))
10783 return false;
10784
10785 if (!HasQuantity())
10786 return false;
10787
10788 float min = GetQuantityMin();
10789 float max = GetQuantityMax();
10790
10791 if (value <= (min + 0.001))
10792 value = min;
10793
10794 if (value == min)
10795 {
10796 if (destroy_config)
10797 {
10798 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10799 if (dstr)
10800 {
10801 m_VarQuantity = Math.Clamp(value, min, max);
10802 this.Delete();
10803 return true;
10804 }
10805 }
10806 else if (destroy_forced)
10807 {
10808 m_VarQuantity = Math.Clamp(value, min, max);
10809 this.Delete();
10810 return true;
10811 }
10812 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
10813 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
10814 }
10815
10816 float delta = m_VarQuantity;
10817 m_VarQuantity = Math.Clamp(value, min, max);
10818
10819 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
10820 {
10821 delta = m_VarQuantity - delta;
10822
10823 if (delta)
10824 OnQuantityChanged(delta);
10825 }
10826
10827 SetVariableMask(VARIABLE_QUANTITY);
10828
10829 return false;
10830 }
10831
10832 //----------------------------------------------------------------
10834 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
10835 {
10836 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
10837 }
10838 //----------------------------------------------------------------
10839 void SetQuantityMax()
10840 {
10841 float max = GetQuantityMax();
10842 SetQuantity(max);
10843 }
10844
10845 override void SetQuantityToMinimum()
10846 {
10847 float min = GetQuantityMin();
10848 SetQuantity(min);
10849 }
10850 //----------------------------------------------------------------
10852 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
10853 {
10854 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
10855 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
10856 SetQuantity(result, destroy_config, destroy_forced);
10857 }
10858
10859 //----------------------------------------------------------------
10861 override float GetQuantityNormalized()
10862 {
10863 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
10864 }
10865
10867 {
10868 return GetQuantityNormalized();
10869 }
10870
10871 /*void SetAmmoNormalized(float value)
10872 {
10873 float value_clamped = Math.Clamp(value, 0, 1);
10874 Magazine this_mag = Magazine.Cast(this);
10875 int max_rounds = this_mag.GetAmmoMax();
10876 int result = value * max_rounds;//can the rounded if higher precision is required
10877 this_mag.SetAmmoCount(result);
10878 }*/
10879 //----------------------------------------------------------------
10880 override int GetQuantityMax()
10881 {
10882 int slot = -1;
10883 if (GetInventory())
10884 {
10885 InventoryLocation il = new InventoryLocation;
10886 GetInventory().GetCurrentInventoryLocation(il);
10887 slot = il.GetSlot();
10888 }
10889
10890 return GetTargetQuantityMax(slot);
10891 }
10892
10893 override int GetTargetQuantityMax(int attSlotID = -1)
10894 {
10895 float quantity_max = 0;
10896
10897 if (IsSplitable()) //only stackable/splitable items can check for stack size
10898 {
10899 if (attSlotID != -1)
10900 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10901
10902 if (quantity_max <= 0)
10903 quantity_max = m_VarStackMax;
10904 }
10905
10906 if (quantity_max <= 0)
10907 quantity_max = m_VarQuantityMax;
10908
10909 return quantity_max;
10910 }
10911 //----------------------------------------------------------------
10912 override int GetQuantityMin()
10913 {
10914 return m_VarQuantityMin;
10915 }
10916 //----------------------------------------------------------------
10917 int GetQuantityInit()
10918 {
10919 return m_VarQuantityInit;
10920 }
10921
10922 //----------------------------------------------------------------
10923 override bool HasQuantity()
10924 {
10925 return !(GetQuantityMax() - GetQuantityMin() == 0);
10926 }
10927
10928 override float GetQuantity()
10929 {
10930 return m_VarQuantity;
10931 }
10932
10933 bool IsFullQuantity()
10934 {
10935 return GetQuantity() >= GetQuantityMax();
10936 }
10937
10938 //Calculates weight of single item without attachments and cargo
10939 override float GetSingleInventoryItemWeightEx()
10940 {
10941 //this needs to be first stored inside local variables, when returned directly during inside return call, the result is completely different due to enforce script bug
10942 float weightEx = GetWeightEx();//overall weight of the item
10943 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
10944 return weightEx - special;
10945 }
10946
10947 // Obsolete, use GetSingleInventoryItemWeightEx() instead
10949 {
10951 }
10952
10953 override protected float GetWeightSpecialized(bool forceRecalc = false)
10954 {
10955 if (IsSplitable()) //quantity determines size of the stack
10956 {
10957 #ifdef DEVELOPER
10958 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10959 {
10960 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10961 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
10962 }
10963 #endif
10964
10965 return GetQuantity() * GetConfigWeightModified();
10966 }
10967 else if (HasEnergyManager())// items with energy manager
10968 {
10969 #ifdef DEVELOPER
10970 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10971 {
10972 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10973 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
10974 }
10975 #endif
10976 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10977 }
10978 else//everything else
10979 {
10980 #ifdef DEVELOPER
10981 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10982 {
10983 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10984 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
10985 }
10986 #endif
10987 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10988 }
10989 }
10990
10992 int GetNumberOfItems()
10993 {
10994 int item_count = 0;
10995 ItemBase item;
10996
10997 if (GetInventory().GetCargo() != NULL)
10998 {
10999 item_count = GetInventory().GetCargo().GetItemCount();
11000 }
11001
11002 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11003 {
11004 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11005 if (item)
11006 item_count += item.GetNumberOfItems();
11007 }
11008 return item_count;
11009 }
11010
11012 float GetUnitWeight(bool include_wetness = true)
11013 {
11014 float weight = 0;
11015 float wetness = 1;
11016 if (include_wetness)
11017 wetness += GetWet();
11018 if (IsSplitable()) //quantity determines size of the stack
11019 {
11020 weight = wetness * m_ConfigWeight;
11021 }
11022 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
11023 {
11024 weight = 1;
11025 }
11026 return weight;
11027 }
11028
11029 //-----------------------------------------------------------------
11030
11031 override void ClearInventory()
11032 {
11033 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
11034 {
11035 GameInventory inv = GetInventory();
11036 array<EntityAI> items = new array<EntityAI>;
11037 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
11038 for (int i = 0; i < items.Count(); i++)
11039 {
11040 ItemBase item = ItemBase.Cast(items.Get(i));
11041 if (item)
11042 {
11043 GetGame().ObjectDelete(item);
11044 }
11045 }
11046 }
11047 }
11048
11049 //------------------------- Energy
11050
11051 //----------------------------------------------------------------
11052 float GetEnergy()
11053 {
11054 float energy = 0;
11055 if (HasEnergyManager())
11056 {
11057 energy = GetCompEM().GetEnergy();
11058 }
11059 return energy;
11060 }
11061
11062
11063 override void OnEnergyConsumed()
11064 {
11065 super.OnEnergyConsumed();
11066
11068 }
11069
11070 override void OnEnergyAdded()
11071 {
11072 super.OnEnergyAdded();
11073
11075 }
11076
11077 // Converts energy (from Energy Manager) to quantity, if enabled.
11079 {
11080 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11081 {
11082 if (HasQuantity())
11083 {
11084 float energy_0to1 = GetCompEM().GetEnergy0To1();
11085 SetQuantityNormalized(energy_0to1);
11086 }
11087 }
11088 }
11089
11090 //----------------------------------------------------------------
11091 float GetHeatIsolationInit()
11092 {
11093 return ConfigGetFloat("heatIsolation");
11094 }
11095
11096 float GetHeatIsolation()
11097 {
11098 return m_HeatIsolation;
11099 }
11100
11101 float GetDryingIncrement(string pIncrementName)
11102 {
11103 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11104 if (GetGame().ConfigIsExisting(paramPath))
11105 return GetGame().ConfigGetFloat(paramPath);
11106
11107 return 0.0;
11108 }
11109
11110 float GetSoakingIncrement(string pIncrementName)
11111 {
11112 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11113 if (GetGame().ConfigIsExisting(paramPath))
11114 return GetGame().ConfigGetFloat(paramPath);
11115
11116 return 0.0;
11117 }
11118 //----------------------------------------------------------------
11119 override void SetWet(float value, bool allow_client = false)
11120 {
11121 if (!IsServerCheck(allow_client))
11122 return;
11123
11124 float min = GetWetMin();
11125 float max = GetWetMax();
11126
11127 float previousValue = m_VarWet;
11128
11129 m_VarWet = Math.Clamp(value, min, max);
11130
11131 if (previousValue != m_VarWet)
11132 {
11133 SetVariableMask(VARIABLE_WET);
11134 OnWetChanged(m_VarWet, previousValue);
11135 }
11136 }
11137 //----------------------------------------------------------------
11138 override void AddWet(float value)
11139 {
11140 SetWet(GetWet() + value);
11141 }
11142 //----------------------------------------------------------------
11143 override void SetWetMax()
11144 {
11146 }
11147 //----------------------------------------------------------------
11148 override float GetWet()
11149 {
11150 return m_VarWet;
11151 }
11152 //----------------------------------------------------------------
11153 override float GetWetMax()
11154 {
11155 return m_VarWetMax;
11156 }
11157 //----------------------------------------------------------------
11158 override float GetWetMin()
11159 {
11160 return m_VarWetMin;
11161 }
11162 //----------------------------------------------------------------
11163 override float GetWetInit()
11164 {
11165 return m_VarWetInit;
11166 }
11167 //----------------------------------------------------------------
11168 override void OnWetChanged(float newVal, float oldVal)
11169 {
11170 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11171 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11172 if (newLevel != oldLevel)
11173 {
11174 OnWetLevelChanged(newLevel,oldLevel);
11175 }
11176 }
11177
11178 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
11179 {
11180 SetWeightDirty();
11181 }
11182
11183 override EWetnessLevel GetWetLevel()
11184 {
11185 return GetWetLevelInternal(m_VarWet);
11186 }
11187
11188 //----------------------------------------------------------------
11189
11190 override void SetStoreLoad(bool value)
11191 {
11192 m_IsStoreLoad = value;
11193 }
11194
11195 override bool IsStoreLoad()
11196 {
11197 return m_IsStoreLoad;
11198 }
11199
11200 override void SetStoreLoadedQuantity(float value)
11201 {
11202 m_StoreLoadedQuantity = value;
11203 }
11204
11205 override float GetStoreLoadedQuantity()
11206 {
11207 return m_StoreLoadedQuantity;
11208 }
11209
11210 //----------------------------------------------------------------
11211
11212 float GetItemModelLength()
11213 {
11214 if (ConfigIsExisting("itemModelLength"))
11215 {
11216 return ConfigGetFloat("itemModelLength");
11217 }
11218 return 0;
11219 }
11220
11221 float GetItemAttachOffset()
11222 {
11223 if (ConfigIsExisting("itemAttachOffset"))
11224 {
11225 return ConfigGetFloat("itemAttachOffset");
11226 }
11227 return 0;
11228 }
11229
11230 override void SetCleanness(int value, bool allow_client = false)
11231 {
11232 if (!IsServerCheck(allow_client))
11233 return;
11234
11235 int previousValue = m_Cleanness;
11236
11237 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
11238
11239 if (previousValue != m_Cleanness)
11240 SetVariableMask(VARIABLE_CLEANNESS);
11241 }
11242
11243 override int GetCleanness()
11244 {
11245 return m_Cleanness;
11246 }
11247
11249 {
11250 return true;
11251 }
11252
11253 //----------------------------------------------------------------
11254 // ATTACHMENT LOCKING
11255 // Getters relevant to generic ActionLockAttachment
11256 int GetLockType()
11257 {
11258 return m_LockType;
11259 }
11260
11261 string GetLockSoundSet()
11262 {
11263 return m_LockSoundSet;
11264 }
11265
11266 //----------------------------------------------------------------
11267 //------------------------- Color
11268 // sets items color variable given color components
11269 override void SetColor(int r, int g, int b, int a)
11270 {
11275 SetVariableMask(VARIABLE_COLOR);
11276 }
11278 override void GetColor(out int r,out int g,out int b,out int a)
11279 {
11284 }
11285
11286 bool IsColorSet()
11287 {
11288 return IsVariableSet(VARIABLE_COLOR);
11289 }
11290
11292 string GetColorString()
11293 {
11294 int r,g,b,a;
11295 GetColor(r,g,b,a);
11296 r = r/255;
11297 g = g/255;
11298 b = b/255;
11299 a = a/255;
11300 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11301 }
11302 //----------------------------------------------------------------
11303 //------------------------- LiquidType
11304
11305 override void SetLiquidType(int value, bool allow_client = false)
11306 {
11307 if (!IsServerCheck(allow_client))
11308 return;
11309
11310 int old = m_VarLiquidType;
11311 m_VarLiquidType = value;
11312 OnLiquidTypeChanged(old,value);
11313 SetVariableMask(VARIABLE_LIQUIDTYPE);
11314 }
11315
11316 int GetLiquidTypeInit()
11317 {
11318 return ConfigGetInt("varLiquidTypeInit");
11319 }
11320
11321 override int GetLiquidType()
11322 {
11323 return m_VarLiquidType;
11324 }
11325
11326 protected void OnLiquidTypeChanged(int oldType, int newType)
11327 {
11328 if (newType == LIQUID_NONE && GetIsFrozen())
11329 SetFrozen(false);
11330 }
11331
11333 void UpdateQuickbarShortcutVisibility(PlayerBase player)
11334 {
11335 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11336 }
11337
11338 // -------------------------------------------------------------------------
11340 void OnInventoryEnter(Man player)
11341 {
11342 PlayerBase nplayer;
11343 if (PlayerBase.CastTo(nplayer, player))
11344 {
11345 m_CanPlayImpactSound = true;
11346 //nplayer.OnItemInventoryEnter(this);
11347 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11348 }
11349 }
11350
11351 // -------------------------------------------------------------------------
11353 void OnInventoryExit(Man player)
11354 {
11355 PlayerBase nplayer;
11356 if (PlayerBase.CastTo(nplayer,player))
11357 {
11358 //nplayer.OnItemInventoryExit(this);
11359 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11360
11361 }
11362
11363 //if (!GetGame().IsDedicatedServer())
11364 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11365
11366
11367 if (HasEnergyManager())
11368 {
11369 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
11370 }
11371 }
11372
11373 // ADVANCED PLACEMENT EVENTS
11374 override void OnPlacementStarted(Man player)
11375 {
11376 super.OnPlacementStarted(player);
11377
11378 SetTakeable(false);
11379 }
11380
11381 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
11382 {
11383 if (m_AdminLog)
11384 {
11385 m_AdminLog.OnPlacementComplete(player, this);
11386 }
11387
11388 super.OnPlacementComplete(player, position, orientation);
11389 }
11390
11391 //-----------------------------
11392 // AGENT SYSTEM
11393 //-----------------------------
11394 //--------------------------------------------------------------------------
11395 bool ContainsAgent(int agent_id)
11396 {
11397 if (agent_id & m_AttachedAgents)
11398 {
11399 return true;
11400 }
11401 else
11402 {
11403 return false;
11404 }
11405 }
11406
11407 //--------------------------------------------------------------------------
11408 override void RemoveAgent(int agent_id)
11409 {
11410 if (ContainsAgent(agent_id))
11411 {
11412 m_AttachedAgents = ~agent_id & m_AttachedAgents;
11413 }
11414 }
11415
11416 //--------------------------------------------------------------------------
11417 override void RemoveAllAgents()
11418 {
11419 m_AttachedAgents = 0;
11420 }
11421 //--------------------------------------------------------------------------
11422 override void RemoveAllAgentsExcept(int agent_to_keep)
11423 {
11424 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
11425 }
11426 // -------------------------------------------------------------------------
11427 override void InsertAgent(int agent, float count = 1)
11428 {
11429 if (count < 1)
11430 return;
11431 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
11433 }
11434
11436 void TransferAgents(int agents)
11437 {
11439 }
11440
11441 // -------------------------------------------------------------------------
11442 override int GetAgents()
11443 {
11444 return m_AttachedAgents;
11445 }
11446 //----------------------------------------------------------------------
11447
11448 /*int GetContaminationType()
11449 {
11450 int contamination_type;
11451
11452 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
11453 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
11454 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
11455 const int DIRTY_MASK = eAgents.WOUND_AGENT;
11456
11457 Edible_Base edible = Edible_Base.Cast(this);
11458 int agents = GetAgents();
11459 if (edible)
11460 {
11461 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
11462 if (profile)
11463 {
11464 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
11465 }
11466 }
11467 if (agents & CONTAMINATED_MASK)
11468 {
11469 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
11470 }
11471 if (agents & POISONED_MASK)
11472 {
11473 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
11474 }
11475 if (agents & NERVE_GAS_MASK)
11476 {
11477 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
11478 }
11479 if (agents & DIRTY_MASK)
11480 {
11481 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
11482 }
11483
11484 return agents;
11485 }*/
11486
11487 // -------------------------------------------------------------------------
11488 bool LoadAgents(ParamsReadContext ctx, int version)
11489 {
11490 if (!ctx.Read(m_AttachedAgents))
11491 return false;
11492 return true;
11493 }
11494 // -------------------------------------------------------------------------
11496 {
11497
11499 }
11500 // -------------------------------------------------------------------------
11501
11503 override void CheckForRoofLimited(float timeTresholdMS = 3000)
11504 {
11505 super.CheckForRoofLimited(timeTresholdMS);
11506
11507 float time = GetGame().GetTime();
11508 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11509 {
11510 m_PreviousRoofTestTime = time;
11511 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11512 }
11513 }
11514
11515 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
11516 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
11517 {
11518 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
11519 {
11520 return 0;
11521 }
11522
11523 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
11524 {
11525 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
11526 if (filter)
11527 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
11528 else
11529 return 0;//otherwise return 0 when no filter attached
11530 }
11531
11532 string subclassPath, entryName;
11533
11534 switch (type)
11535 {
11536 case DEF_BIOLOGICAL:
11537 entryName = "biological";
11538 break;
11539 case DEF_CHEMICAL:
11540 entryName = "chemical";
11541 break;
11542 default:
11543 entryName = "biological";
11544 break;
11545 }
11546
11547 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
11548
11549 return GetGame().ConfigGetFloat(subclassPath + entryName);
11550 }
11551
11552
11553
11555 override void EEOnCECreate()
11556 {
11557 if (!IsMagazine())
11559
11561 }
11562
11563
11564 //-------------------------
11565 // OPEN/CLOSE USER ACTIONS
11566 //-------------------------
11568 void Open();
11569 void Close();
11570 bool IsOpen()
11571 {
11572 return true;
11573 }
11574
11575 override bool CanDisplayCargo()
11576 {
11577 return IsOpen();
11578 }
11579
11580
11581 // ------------------------------------------------------------
11582 // CONDITIONS
11583 // ------------------------------------------------------------
11584 override bool CanPutInCargo(EntityAI parent)
11585 {
11586 if (parent)
11587 {
11588 if (parent.IsInherited(DayZInfected))
11589 return true;
11590
11591 if (!parent.IsRuined())
11592 return true;
11593 }
11594
11595 return true;
11596 }
11597
11598 override bool CanPutAsAttachment(EntityAI parent)
11599 {
11600 if (!super.CanPutAsAttachment(parent))
11601 {
11602 return false;
11603 }
11604
11605 if (!IsRuined() && !parent.IsRuined())
11606 {
11607 return true;
11608 }
11609
11610 return false;
11611 }
11612
11613 override bool CanReceiveItemIntoCargo(EntityAI item)
11614 {
11615 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11616 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11617 // return false;
11618
11619 return super.CanReceiveItemIntoCargo(item);
11620 }
11621
11622 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
11623 {
11624 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11625 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11626 // return false;
11627
11628 GameInventory attachmentInv = attachment.GetInventory();
11629 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11630 {
11631 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11632 return false;
11633 }
11634
11635 InventoryLocation loc = new InventoryLocation();
11636 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11637 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
11638 return false;
11639
11640 return super.CanReceiveAttachment(attachment, slotId);
11641 }
11642
11643 override bool CanReleaseAttachment(EntityAI attachment)
11644 {
11645 if (!super.CanReleaseAttachment(attachment))
11646 return false;
11647
11648 return GetInventory().AreChildrenAccessible();
11649 }
11650
11651 /*override bool CanLoadAttachment(EntityAI attachment)
11652 {
11653 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11654 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11655 // return false;
11656
11657 GameInventory attachmentInv = attachment.GetInventory();
11658 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11659 {
11660 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
11661 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
11662
11663 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11664 return false;
11665 }
11666
11667 return super.CanLoadAttachment(attachment);
11668 }*/
11669
11670 // Plays muzzle flash particle effects
11671 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11672 {
11673 int id = muzzle_owner.GetMuzzleID();
11674 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
11675
11676 if (WPOF_array)
11677 {
11678 for (int i = 0; i < WPOF_array.Count(); i++)
11679 {
11680 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11681
11682 if (WPOF)
11683 {
11684 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11685 }
11686 }
11687 }
11688 }
11689
11690 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
11691 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11692 {
11693 int id = muzzle_owner.GetMuzzleID();
11694 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
11695
11696 if (WPOBE_array)
11697 {
11698 for (int i = 0; i < WPOBE_array.Count(); i++)
11699 {
11700 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11701
11702 if (WPOBE)
11703 {
11704 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11705 }
11706 }
11707 }
11708 }
11709
11710 // Plays all weapon overheating particles
11711 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11712 {
11713 int id = muzzle_owner.GetMuzzleID();
11714 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11715
11716 if (WPOOH_array)
11717 {
11718 for (int i = 0; i < WPOOH_array.Count(); i++)
11719 {
11720 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11721
11722 if (WPOOH)
11723 {
11724 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11725 }
11726 }
11727 }
11728 }
11729
11730 // Updates all weapon overheating particles
11731 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11732 {
11733 int id = muzzle_owner.GetMuzzleID();
11734 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11735
11736 if (WPOOH_array)
11737 {
11738 for (int i = 0; i < WPOOH_array.Count(); i++)
11739 {
11740 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11741
11742 if (WPOOH)
11743 {
11744 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11745 }
11746 }
11747 }
11748 }
11749
11750 // Stops overheating particles
11751 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11752 {
11753 int id = muzzle_owner.GetMuzzleID();
11754 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11755
11756 if (WPOOH_array)
11757 {
11758 for (int i = 0; i < WPOOH_array.Count(); i++)
11759 {
11760 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11761
11762 if (WPOOH)
11763 {
11764 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11765 }
11766 }
11767 }
11768 }
11769
11770 //----------------------------------------------------------------
11771 //Item Behaviour - unified approach
11772 override bool IsHeavyBehaviour()
11773 {
11774 if (m_ItemBehaviour == 0)
11775 {
11776 return true;
11777 }
11778
11779 return false;
11780 }
11781
11782 override bool IsOneHandedBehaviour()
11783 {
11784 if (m_ItemBehaviour == 1)
11785 {
11786 return true;
11787 }
11788
11789 return false;
11790 }
11791
11792 override bool IsTwoHandedBehaviour()
11793 {
11794 if (m_ItemBehaviour == 2)
11795 {
11796 return true;
11797 }
11798
11799 return false;
11800 }
11801
11802 bool IsDeployable()
11803 {
11804 return false;
11805 }
11806
11808 float GetDeployTime()
11809 {
11810 return UATimeSpent.DEFAULT_DEPLOY;
11811 }
11812
11813
11814 //----------------------------------------------------------------
11815 // Item Targeting (User Actions)
11816 override void SetTakeable(bool pState)
11817 {
11818 m_IsTakeable = pState;
11819 SetSynchDirty();
11820 }
11821
11822 override bool IsTakeable()
11823 {
11824 return m_IsTakeable;
11825 }
11826
11827 // For cases where we want to show object widget which cant be taken to hands
11829 {
11830 return false;
11831 }
11832
11834 protected void PreLoadSoundAttachmentType()
11835 {
11836 string att_type = "None";
11837
11838 if (ConfigIsExisting("soundAttType"))
11839 {
11840 att_type = ConfigGetString("soundAttType");
11841 }
11842
11843 m_SoundAttType = att_type;
11844 }
11845
11846 override string GetAttachmentSoundType()
11847 {
11848 return m_SoundAttType;
11849 }
11850
11851 //----------------------------------------------------------------
11852 //SOUNDS - ItemSoundHandler
11853 //----------------------------------------------------------------
11854
11855 string GetPlaceSoundset(); // played when deploy starts
11856 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
11857 string GetDeploySoundset(); // played when deploy sucessfully finishes
11858 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
11859 string GetFoldSoundset(); // played when fold sucessfully finishes
11860
11862 {
11863 if (!m_ItemSoundHandler)
11865
11866 return m_ItemSoundHandler;
11867 }
11868
11869 // override to initialize sounds
11870 protected void InitItemSounds()
11871 {
11872 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
11873 return;
11874
11876
11877 if (GetPlaceSoundset() != string.Empty)
11878 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
11879
11880 if (GetDeploySoundset() != string.Empty)
11881 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
11882
11883 SoundParameters params = new SoundParameters();
11884 params.m_Loop = true;
11885 if (GetLoopDeploySoundset() != string.Empty)
11886 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
11887 }
11888
11889 // Start sound using ItemSoundHandler
11890 void StartItemSoundServer(int id)
11891 {
11892 if (!GetGame().IsServer())
11893 return;
11894
11895 m_SoundSyncPlay = id;
11896 SetSynchDirty();
11897
11898 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
11900 }
11901
11902 // Stop sound using ItemSoundHandler
11903 void StopItemSoundServer(int id)
11904 {
11905 if (!GetGame().IsServer())
11906 return;
11907
11908 m_SoundSyncStop = id;
11909 SetSynchDirty();
11910
11911 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
11913 }
11914
11915 protected void ClearStartItemSoundServer()
11916 {
11917 m_SoundSyncPlay = 0;
11918 }
11919
11920 protected void ClearStopItemSoundServer()
11921 {
11922 m_SoundSyncStop = 0;
11923 }
11924
11926 void PlayAttachSound(string slot_type)
11927 {
11928 if (!GetGame().IsDedicatedServer())
11929 {
11930 if (ConfigIsExisting("attachSoundSet"))
11931 {
11932 string cfg_path = "";
11933 string soundset = "";
11934 string type_name = GetType();
11935
11936 TStringArray cfg_soundset_array = new TStringArray;
11937 TStringArray cfg_slot_array = new TStringArray;
11938 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11939 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11940
11941 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11942 {
11943 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11944 {
11945 if (cfg_slot_array[i] == slot_type)
11946 {
11947 soundset = cfg_soundset_array[i];
11948 break;
11949 }
11950 }
11951 }
11952
11953 if (soundset != "")
11954 {
11955 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
11956 sound.SetAutodestroy(true);
11957 }
11958 }
11959 }
11960 }
11961
11962 void PlayDetachSound(string slot_type)
11963 {
11964 //TODO - evaluate if needed and devise universal config structure if so
11965 }
11966
11967 void OnApply(PlayerBase player);
11968
11970 {
11971 return 1.0;
11972 };
11973 //returns applicable selection
11974 array<string> GetHeadHidingSelection()
11975 {
11977 }
11978
11980 {
11982 }
11983
11984 WrittenNoteData GetWrittenNoteData() {};
11985
11987 {
11988 SetDynamicPhysicsLifeTime(0.01);
11989 m_ItemBeingDroppedPhys = false;
11990 }
11991
11993 {
11994 array<string> zone_names = new array<string>;
11995 GetDamageZones(zone_names);
11996 for (int i = 0; i < zone_names.Count(); i++)
11997 {
11998 SetHealthMax(zone_names.Get(i),"Health");
11999 }
12000 SetHealthMax("","Health");
12001 }
12002
12004 void SetZoneDamageCEInit()
12005 {
12006 float global_health = GetHealth01("","Health");
12007 array<string> zones = new array<string>;
12008 GetDamageZones(zones);
12009 //set damage of all zones to match global health level
12010 for (int i = 0; i < zones.Count(); i++)
12011 {
12012 SetHealth01(zones.Get(i),"Health",global_health);
12013 }
12014 }
12015
12017 bool IsCoverFaceForShave(string slot_name)
12018 {
12019 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12020 }
12021
12022 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12023 {
12024 if (!hasRootAsPlayer)
12025 {
12026 if (refParentIB)
12027 {
12028 // parent is wet
12029 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
12030 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12031 // parent has liquid inside
12032 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
12033 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12034 // drying
12035 else if (m_VarWet > m_VarWetMin)
12036 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
12037 }
12038 else
12039 {
12040 // drying on ground or inside non-itembase (car, ...)
12041 if (m_VarWet > m_VarWetMin)
12042 AddWet(-1 * delta * GetDryingIncrement("ground"));
12043 }
12044 }
12045 }
12046
12047 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12048 {
12050 {
12051 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
12052 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12053 {
12054 float heatPermCoef = 1.0;
12055 EntityAI ent = this;
12056 while (ent)
12057 {
12058 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12059 ent = ent.GetHierarchyParent();
12060 }
12061
12062 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12063 }
12064 }
12065 }
12066
12067 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
12068 {
12069 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
12070 EntityAI parent = GetHierarchyParent();
12071 if (!parent)
12072 {
12073 hasParent = false;
12074 hasRootAsPlayer = false;
12075 }
12076 else
12077 {
12078 hasParent = true;
12079 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12080 refParentIB = ItemBase.Cast(parent);
12081 }
12082 }
12083
12084 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12085 {
12086 // this is stub, implemented on Edible_Base
12087 }
12088
12089 bool CanDecay()
12090 {
12091 // return true used on selected food clases so they can decay
12092 return false;
12093 }
12094
12095 protected bool CanProcessDecay()
12096 {
12097 // this is stub, implemented on Edible_Base class
12098 // used to determine whether it is still necessary for the food to decay
12099 return false;
12100 }
12101
12102 protected bool CanHaveWetness()
12103 {
12104 // return true used on selected items that have a wetness effect
12105 return false;
12106 }
12107
12109 bool CanBeConsumed(ConsumeConditionData data = null)
12110 {
12111 return !GetIsFrozen() && IsOpen();
12112 }
12113
12114 override void ProcessVariables()
12115 {
12116 bool hasParent = false, hasRootAsPlayer = false;
12117 ItemBase refParentIB;
12118
12119 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12120 bool foodDecay = g_Game.IsFoodDecayEnabled();
12121
12122 if (wwtu || foodDecay)
12123 {
12124 bool processWetness = wwtu && CanHaveWetness();
12125 bool processTemperature = wwtu && CanHaveTemperature();
12126 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12127
12128 if (processWetness || processTemperature || processDecay)
12129 {
12130 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12131
12132 if (processWetness)
12133 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12134
12135 if (processTemperature)
12136 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12137
12138 if (processDecay)
12139 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12140 }
12141 }
12142 }
12143
12146 {
12147 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12148 }
12149
12150 override float GetTemperatureFreezeThreshold()
12151 {
12153 return Liquid.GetFreezeThreshold(GetLiquidType());
12154
12155 return super.GetTemperatureFreezeThreshold();
12156 }
12157
12158 override float GetTemperatureThawThreshold()
12159 {
12161 return Liquid.GetThawThreshold(GetLiquidType());
12162
12163 return super.GetTemperatureThawThreshold();
12164 }
12165
12166 override float GetItemOverheatThreshold()
12167 {
12169 return Liquid.GetBoilThreshold(GetLiquidType());
12170
12171 return super.GetItemOverheatThreshold();
12172 }
12173
12174 override float GetTemperatureFreezeTime()
12175 {
12176 if (HasQuantity())
12177 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12178
12179 return super.GetTemperatureFreezeTime();
12180 }
12181
12182 override float GetTemperatureThawTime()
12183 {
12184 if (HasQuantity())
12185 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
12186
12187 return super.GetTemperatureThawTime();
12188 }
12189
12191 void AffectLiquidContainerOnFill(int liquid_type, float amount);
12193 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
12194
12195 bool IsCargoException4x3(EntityAI item)
12196 {
12197 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12198 }
12199
12201 {
12202 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12203 }
12204
12206 void AddLightSourceItem(ItemBase lightsource)
12207 {
12208 m_LightSourceItem = lightsource;
12209 }
12210
12212 {
12213 m_LightSourceItem = null;
12214 }
12215
12217 {
12218 return m_LightSourceItem;
12219 }
12220
12222 array<int> GetValidFinishers()
12223 {
12224 return null;
12225 }
12226
12228 bool GetActionWidgetOverride(out typename name)
12229 {
12230 return false;
12231 }
12232
12233 bool PairWithDevice(notnull ItemBase otherDevice)
12234 {
12235 if (GetGame().IsServer())
12236 {
12237 ItemBase explosive = otherDevice;
12239 if (!trg)
12240 {
12241 trg = RemoteDetonatorTrigger.Cast(otherDevice);
12242 explosive = this;
12243 }
12244
12245 explosive.PairRemote(trg);
12246 trg.SetControlledDevice(explosive);
12247
12248 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12249 trg.SetPersistentPairID(persistentID);
12250 explosive.SetPersistentPairID(persistentID);
12251
12252 return true;
12253 }
12254 return false;
12255 }
12256
12258 float GetBaitEffectivity()
12259 {
12260 float ret = 1.0;
12261 if (HasQuantity())
12262 ret *= GetQuantityNormalized();
12263 ret *= GetHealth01();
12264
12265 return ret;
12266 }
12267
12268 #ifdef DEVELOPER
12269 override void SetDebugItem()
12270 {
12271 super.SetDebugItem();
12272 _itemBase = this;
12273 }
12274
12275 override string GetDebugText()
12276 {
12277 string text = super.GetDebugText();
12278
12279 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
12280 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
12281
12282 return text;
12283 }
12284 #endif
12285
12286 bool CanBeUsedForSuicide()
12287 {
12288 return true;
12289 }
12290
12292 //DEPRECATED BELOW
12294 // Backwards compatibility
12295 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12296 {
12297 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
12298 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
12299 }
12300
12301 // replaced by ItemSoundHandler
12302 protected EffectSound m_SoundDeployFinish;
12303 protected EffectSound m_SoundPlace;
12304 protected EffectSound m_DeployLoopSoundEx;
12305 protected EffectSound m_SoundDeploy;
12306 bool m_IsPlaceSound;
12307 bool m_IsDeploySound;
12309
12310 string GetDeployFinishSoundset();
12311 void PlayDeploySound();
12312 void PlayDeployFinishSound();
12313 void PlayPlaceSound();
12314 void PlayDeployLoopSoundEx();
12315 void StopDeployLoopSoundEx();
12316 void SoundSynchRemoteReset();
12317 void SoundSynchRemote();
12318 bool UsesGlobalDeploy(){return false;}
12319 bool CanPlayDeployLoopSound(){return false;}
12321 bool IsPlaceSound(){return m_IsPlaceSound;}
12322 bool IsDeploySound(){return m_IsDeploySound;}
12323 void SetIsPlaceSound(bool is_place_sound);
12324 void SetIsDeploySound(bool is_deploy_sound);
12325}
12326
12327EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
12328{
12329 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
12330 if (entity)
12331 {
12332 bool is_item = entity.IsInherited(ItemBase);
12333 if (is_item && full_quantity)
12334 {
12335 ItemBase item = ItemBase.Cast(entity);
12336 item.SetQuantity(item.GetQuantityInit());
12337 }
12338 }
12339 else
12340 {
12341 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
12342 return NULL;
12343 }
12344 return entity;
12345}
12346
12347void SetupSpawnedItem(ItemBase item, float health, float quantity)
12348{
12349 if (item)
12350 {
12351 if (health > 0)
12352 item.SetHealth("", "", health);
12353
12354 if (item.CanHaveTemperature())
12355 {
12356 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
12357 if (item.CanFreeze())
12358 item.SetFrozen(false);
12359 }
12360
12361 if (item.HasEnergyManager())
12362 {
12363 if (quantity >= 0)
12364 {
12365 item.GetCompEM().SetEnergy0To1(quantity);
12366 }
12367 else
12368 {
12369 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
12370 }
12371 }
12372 else if (item.IsMagazine())
12373 {
12374 Magazine mag = Magazine.Cast(item);
12375 if (quantity >= 0)
12376 {
12377 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12378 }
12379 else
12380 {
12381 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
12382 }
12383
12384 }
12385 else
12386 {
12387 if (quantity >= 0)
12388 {
12389 item.SetQuantityNormalized(quantity, false);
12390 }
12391 else
12392 {
12393 item.SetQuantity(Math.AbsFloat(quantity));
12394 }
12395
12396 }
12397 }
12398}
12399
12400#ifdef DEVELOPER
12401ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
12402#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
int GetLiquidType()
Определения CCTWaterSurface.c:129
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
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...
Определения ItemBase.c:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
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()
Определения ItemBase.c:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
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)
Определения DayZGame.c:1187
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
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)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения 3_Game/Entities/Man.c:44
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
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
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override string GetFoldSoundset()
Определения BaseBuildingBase.c:108
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1238
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:489
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1032
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
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 native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения 3_Game/tools/Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
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.
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()