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

◆ DeSerializeNumericalVars()

override void SpawnItemOnLocation::DeSerializeNumericalVars ( array< float > floats)
private

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

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

Используется в Entity::TransferVariablesFloat().