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

◆ IDToName()

string SpawnItemOnLocation::IDToName ( int id)
private

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

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