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

◆ ReadVarsFromCTX()

override bool SpawnItemOnLocation::ReadVarsFromCTX ( ParamsReadContext ctx,
int version = -1 )
private

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

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