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

◆ OnQuantityChanged()

void SpawnItemOnLocation::OnQuantityChanged ( float delta)
private

Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first when overriding this event.

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

6777{
6778 override bool CanPutAsAttachment(EntityAI parent)
6779 {
6780 return true;
6781 }
6782};
6783
6784//const bool QUANTITY_DEBUG_REMOVE_ME = false;
6785
6786class ItemBase extends InventoryItem
6787{
6791
6793
6794 static int m_DebugActionsMask;
6796 // ============================================
6797 // Variable Manipulation System
6798 // ============================================
6799 // Quantity
6800
6801 float m_VarQuantity;
6802 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
6804 int m_VarQuantityMin;
6805 int m_VarQuantityMax;
6806 int m_Count;
6807 float m_VarStackMax;
6808 float m_StoreLoadedQuantity = float.LOWEST;
6809 // Wet
6810 float m_VarWet;
6811 float m_VarWetPrev;//for client to know wetness changed during synchronization
6812 float m_VarWetInit;
6813 float m_VarWetMin;
6814 float m_VarWetMax;
6815 // Cleanness
6816 int m_Cleanness;
6817 int m_CleannessInit;
6818 int m_CleannessMin;
6819 int m_CleannessMax;
6820 // impact sounds
6822 bool m_CanPlayImpactSound = true;
6823 float m_ImpactSpeed;
6825 //
6826 float m_HeatIsolation;
6827 float m_ItemModelLength;
6828 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
6830 int m_VarLiquidType;
6831 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
6832 int m_QuickBarBonus;
6833 bool m_IsBeingPlaced;
6834 bool m_IsHologram;
6835 bool m_IsTakeable;
6836 bool m_ThrowItemOnDrop;
6839 bool m_FixDamageSystemInit = false; //can be changed on storage version check
6840 bool can_this_be_combined; //Check if item can be combined
6841 bool m_CanThisBeSplit; //Check if item can be split
6842 bool m_IsStoreLoad = false;
6843 bool m_CanShowQuantity;
6844 bool m_HasQuantityBar;
6845 protected bool m_CanBeDigged;
6846 protected bool m_IsResultOfSplit
6847
6848 string m_SoundAttType;
6849 // items color variables
6854 //-------------------------------------------------------
6855
6856 // light source managing
6858
6862
6863 //==============================================
6864 // agent system
6865 private int m_AttachedAgents;
6866
6868 void TransferModifiers(PlayerBase reciever);
6869
6870
6871 // Weapons & suppressors particle effects
6876 static int m_LastRegisteredWeaponID = 0;
6877
6878 // Overheating effects
6880 float m_OverheatingShots;
6881 ref Timer m_CheckOverheating;
6882 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
6883 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
6884 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
6885 ref array <ref OverheatingParticle> m_OverheatingParticles;
6886
6888 protected bool m_HideSelectionsBySlot;
6889
6890 // Admin Log
6891 PluginAdminLog m_AdminLog;
6892
6893 // misc
6894 ref Timer m_PhysDropTimer;
6895
6896 // Attachment Locking variables
6897 ref array<int> m_CompatibleLocks;
6898 protected int m_LockType;
6899 protected ref EffectSound m_LockingSound;
6900 protected string m_LockSoundSet;
6901
6902 // ItemSoundHandler
6903 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
6904 protected int m_SoundSyncPlay; // id for sound to play
6905 protected int m_SoundSyncStop; // id for sound to stop
6907
6908 //temperature
6909 private float m_TemperaturePerQuantityWeight;
6910
6911 // -------------------------------------------------------------------------
6912 void ItemBase()
6913 {
6914 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
6918
6919 if (!GetGame().IsDedicatedServer())
6920 {
6921 if (HasMuzzle())
6922 {
6924
6926 {
6928 }
6929 }
6930
6932 m_ActionsInitialize = false;
6933 }
6934
6935 m_OldLocation = null;
6936
6937 if (GetGame().IsServer())
6938 {
6939 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
6940 }
6941
6942 if (ConfigIsExisting("headSelectionsToHide"))
6943 {
6945 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
6946 }
6947
6948 m_HideSelectionsBySlot = false;
6949 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6950 {
6951 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
6952 }
6953
6954 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
6955
6956 m_IsResultOfSplit = false;
6957
6959 }
6960
6961 override void InitItemVariables()
6962 {
6963 super.InitItemVariables();
6964
6965 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
6966 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
6967 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
6968 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
6969 m_VarStackMax = ConfigGetFloat("varStackMax");
6970 m_Count = ConfigGetInt("count");
6971
6972 m_CanShowQuantity = ConfigGetBool("quantityShow");
6973 m_HasQuantityBar = ConfigGetBool("quantityBar");
6974
6975 m_CleannessInit = ConfigGetInt("varCleannessInit");
6977 m_CleannessMin = ConfigGetInt("varCleannessMin");
6978 m_CleannessMax = ConfigGetInt("varCleannessMax");
6979
6980 m_WantPlayImpactSound = false;
6981 m_ImpactSpeed = 0.0;
6982
6983 m_VarWetInit = ConfigGetFloat("varWetInit");
6985 m_VarWetMin = ConfigGetFloat("varWetMin");
6986 m_VarWetMax = ConfigGetFloat("varWetMax");
6987
6988 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
6989 if (IsLiquidContainer() && GetQuantity() != 0)
6991 m_IsBeingPlaced = false;
6992 m_IsHologram = false;
6993 m_IsTakeable = true;
6994 m_CanBeMovedOverride = false;
6998 m_CanBeDigged = ConfigGetBool("canBeDigged");
6999
7000 m_CompatibleLocks = new array<int>();
7001 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
7002 m_LockType = ConfigGetInt("lockType");
7003
7004 //Define if item can be split and set ability to be combined accordingly
7005 m_CanThisBeSplit = false;
7006 can_this_be_combined = false;
7007 if (ConfigIsExisting("canBeSplit"))
7008 {
7009 can_this_be_combined = ConfigGetBool("canBeSplit");
7011 }
7012
7013 m_ItemBehaviour = -1;
7014 if (ConfigIsExisting("itemBehaviour"))
7015 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
7016
7017 //RegisterNetSyncVariableInt("m_VariablesMask");
7018 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7019 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
7020 RegisterNetSyncVariableInt("m_VarLiquidType");
7021 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7022
7023 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7024 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7025 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7026
7027 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7028 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7029 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7030 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7031
7032 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7033 RegisterNetSyncVariableBool("m_IsTakeable");
7034 RegisterNetSyncVariableBool("m_IsHologram");
7035
7036 InitItemSounds();
7038 {
7039 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
7040 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
7041 }
7042
7043 m_LockSoundSet = ConfigGetString("lockSoundSet");
7044
7046 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7047 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
7048
7049 }
7050
7051 override int GetQuickBarBonus()
7052 {
7053 return m_QuickBarBonus;
7054 }
7055
7056 void InitializeActions()
7057 {
7059 if (!m_InputActionMap)
7060 {
7062 m_InputActionMap = iam;
7063 SetActions();
7065 }
7066 }
7067
7068 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
7069 {
7071 {
7072 m_ActionsInitialize = true;
7074 }
7075
7076 actions = m_InputActionMap.Get(action_input_type);
7077 }
7078
7079 void SetActions()
7080 {
7081 AddAction(ActionTakeItem);
7082 AddAction(ActionTakeItemToHands);
7083 AddAction(ActionWorldCraft);
7085 AddAction(ActionAttachWithSwitch);
7086 }
7087
7088 void SetActionAnimOverrides(); // Override action animation for specific item
7089
7090 void AddAction(typename actionName)
7091 {
7092 ActionBase action = ActionManagerBase.GetAction(actionName);
7093
7094 if (!action)
7095 {
7096 Debug.LogError("Action " + actionName + " dosn't exist!");
7097 return;
7098 }
7099
7100 typename ai = action.GetInputType();
7101 if (!ai)
7102 {
7103 m_ActionsInitialize = false;
7104 return;
7105 }
7106
7107 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7108 if (!action_array)
7109 {
7110 action_array = new array<ActionBase_Basic>;
7111 m_InputActionMap.Insert(ai, action_array);
7112 }
7113 if (LogManager.IsActionLogEnable())
7114 {
7115 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
7116 }
7117
7118 if (action_array.Find(action) != -1)
7119 {
7120 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
7121 }
7122 else
7123 {
7124 action_array.Insert(action);
7125 }
7126 }
7127
7128 void RemoveAction(typename actionName)
7129 {
7130 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7131 ActionBase action = player.GetActionManager().GetAction(actionName);
7132 typename ai = action.GetInputType();
7133 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7134
7135 if (action_array)
7136 {
7137 action_array.RemoveItem(action);
7138 }
7139 }
7140
7141 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
7142 // Set -1 for params which should stay in default state
7143 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
7144 {
7145 ActionOverrideData overrideData = new ActionOverrideData();
7146 overrideData.m_CommandUID = commandUID;
7147 overrideData.m_CommandUIDProne = commandUIDProne;
7148 overrideData.m_StanceMask = stanceMask;
7149
7150 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
7151 if (!actionMap) // create new map of action > overidables map
7152 {
7153 actionMap = new TActionAnimOverrideMap();
7154 m_ItemActionOverrides.Insert(action, actionMap);
7155 }
7156
7157 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
7158
7159 }
7160
7161 void OnItemInHandsPlayerSwimStart(PlayerBase player);
7162
7163 ScriptedLightBase GetLight();
7164
7165 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7166 void LoadParticleConfigOnFire(int id)
7167 {
7168 if (!m_OnFireEffect)
7170
7173
7174 string config_to_search = "CfgVehicles";
7175 string muzzle_owner_config;
7176
7177 if (!m_OnFireEffect.Contains(id))
7178 {
7179 if (IsInherited(Weapon))
7180 config_to_search = "CfgWeapons";
7181
7182 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7183
7184 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7185
7186 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
7187
7188 if (config_OnFire_subclass_count > 0)
7189 {
7190 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7191
7192 for (int i = 0; i < config_OnFire_subclass_count; i++)
7193 {
7194 string particle_class = "";
7195 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
7196 string config_OnFire_entry = config_OnFire_class + particle_class;
7197 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7198 WPOF_array.Insert(WPOF);
7199 }
7200
7201
7202 m_OnFireEffect.Insert(id, WPOF_array);
7203 }
7204 }
7205
7206 if (!m_OnBulletCasingEjectEffect.Contains(id))
7207 {
7208 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
7209 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7210
7211 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7212
7213 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7214
7215 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7216 {
7217 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7218
7219 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7220 {
7221 string particle_class2 = "";
7222 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7223 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7224 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7225 WPOBE_array.Insert(WPOBE);
7226 }
7227
7228
7229 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
7230 }
7231 }
7232 }
7233
7234 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7236 {
7239
7240 if (!m_OnOverheatingEffect.Contains(id))
7241 {
7242 string config_to_search = "CfgVehicles";
7243
7244 if (IsInherited(Weapon))
7245 config_to_search = "CfgWeapons";
7246
7247 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
7248 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7249
7250 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
7251 {
7252
7253 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
7254
7256 {
7257 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
7258 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7259 Error(error);
7260 return;
7261 }
7262
7263 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
7264 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
7265
7266
7267
7268 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
7269 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7270
7271 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7272 {
7273 string particle_class = "";
7274 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7275 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7276 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
7277
7278 if (entry_type == CT_CLASS)
7279 {
7280 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7281 WPOOH_array.Insert(WPOF);
7282 }
7283 }
7284
7285
7286 m_OnOverheatingEffect.Insert(id, WPOOH_array);
7287 }
7288 }
7289 }
7290
7291 float GetOverheatingValue()
7292 {
7293 return m_OverheatingShots;
7294 }
7295
7296 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
7297 {
7298 if (m_MaxOverheatingValue > 0)
7299 {
7301
7302 if (!m_CheckOverheating)
7304
7306 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
7307
7308 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7309 }
7310 }
7311
7312 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
7313 {
7315 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7316
7318 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7319
7321 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7322
7324 {
7326 }
7327 }
7328
7330 {
7332 }
7333
7334 void OnOverheatingDecay()
7335 {
7336 if (m_MaxOverheatingValue > 0)
7337 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
7338 else
7340
7341 if (m_OverheatingShots <= 0)
7342 {
7345 }
7346 else
7347 {
7348 if (!m_CheckOverheating)
7350
7352 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
7353 }
7354
7355 CheckOverheating(this, "", this);
7356 }
7357
7358 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
7359 {
7361 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
7362 }
7363
7364 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
7365 {
7367 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
7369 }
7370
7371 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
7372 {
7374 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7375 }
7376
7377 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
7378 {
7380 m_OverheatingParticles = new array<ref OverheatingParticle>;
7381
7382 OverheatingParticle OP = new OverheatingParticle();
7383 OP.RegisterParticle(p);
7384 OP.SetOverheatingLimitMin(min_heat_coef);
7385 OP.SetOverheatingLimitMax(max_heat_coef);
7386 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
7387
7388 m_OverheatingParticles.Insert(OP);
7389 }
7390
7391 float GetOverheatingCoef()
7392 {
7393 if (m_MaxOverheatingValue > 0)
7395
7396 return -1;
7397 }
7398
7400 {
7402 {
7403 float overheat_coef = GetOverheatingCoef();
7404 int count = m_OverheatingParticles.Count();
7405
7406 for (int i = count; i > 0; --i)
7407 {
7408 int id = i - 1;
7409 OverheatingParticle OP = m_OverheatingParticles.Get(id);
7410 Particle p = OP.GetParticle();
7411
7412 float overheat_min = OP.GetOverheatingLimitMin();
7413 float overheat_max = OP.GetOverheatingLimitMax();
7414
7415 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7416 {
7417 if (p)
7418 {
7419 p.Stop();
7420 OP.RegisterParticle(null);
7421 }
7422 }
7423 }
7424 }
7425 }
7426
7428 {
7430 {
7431 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
7432 {
7433 int id = i - 1;
7434 OverheatingParticle OP = m_OverheatingParticles.Get(id);
7435
7436 if (OP)
7437 {
7438 Particle p = OP.GetParticle();
7439
7440 if (p)
7441 {
7442 p.Stop();
7443 }
7444
7445 delete OP;
7446 }
7447 }
7448
7449 m_OverheatingParticles.Clear();
7451 }
7452 }
7453
7455 float GetInfectionChance(int system = 0, Param param = null)
7456 {
7457 return 0.0;
7458 }
7459
7460
7461 float GetDisinfectQuantity(int system = 0, Param param1 = null)
7462 {
7463 return 250;//default value
7464 }
7465
7466 float GetFilterDamageRatio()
7467 {
7468 return 0;
7469 }
7470
7472 bool HasMuzzle()
7473 {
7474 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
7475 return true;
7476
7477 return false;
7478 }
7479
7481 int GetMuzzleID()
7482 {
7483 if (!m_WeaponTypeToID)
7485
7486 if (m_WeaponTypeToID.Contains(GetType()))
7487 {
7488 return m_WeaponTypeToID.Get(GetType());
7489 }
7490 else
7491 {
7492 // Register new weapon ID
7494 }
7495
7497 }
7498
7505 {
7506 return -1;
7507 }
7508
7509
7510
7511 // -------------------------------------------------------------------------
7512 void ~ItemBase()
7513 {
7514 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
7515 {
7516 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7517 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7518
7519 if (r_index >= 0)
7520 {
7521 InventoryLocation r_il = new InventoryLocation;
7522 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7523
7524 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7525 int r_type = r_il.GetType();
7526 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
7527 {
7528 r_il.GetParent().GetOnReleaseLock().Invoke(this);
7529 }
7530 else if (r_type == InventoryLocationType.ATTACHMENT)
7531 {
7532 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
7533 }
7534
7535 }
7536
7537 player.GetHumanInventory().ClearUserReservedLocation(this);
7538 }
7539
7540 if (m_LockingSound)
7541 SEffectManager.DestroyEffect(m_LockingSound);
7542 }
7543
7544
7545
7546 // -------------------------------------------------------------------------
7547 static int GetDebugActionsMask()
7548 {
7549 return ItemBase.m_DebugActionsMask;
7550 }
7551
7552 static bool HasDebugActionsMask(int mask)
7553 {
7554 return ItemBase.m_DebugActionsMask & mask;
7555 }
7556
7557 static void SetDebugActionsMask(int mask)
7558 {
7559 ItemBase.m_DebugActionsMask = mask;
7560 }
7561
7562 static void AddDebugActionsMask(int mask)
7563 {
7564 ItemBase.m_DebugActionsMask |= mask;
7565 }
7566
7567 static void RemoveDebugActionsMask(int mask)
7568 {
7569 ItemBase.m_DebugActionsMask &= ~mask;
7570 }
7571
7572 static void ToggleDebugActionsMask(int mask)
7573 {
7574 if (HasDebugActionsMask(mask))
7575 {
7577 }
7578 else
7579 {
7580 AddDebugActionsMask(mask);
7581 }
7582 }
7583
7584 // -------------------------------------------------------------------------
7585 void SetCEBasedQuantity()
7586 {
7587 if (GetEconomyProfile())
7588 {
7589 float q_max = GetEconomyProfile().GetQuantityMax();
7590 if (q_max > 0)
7591 {
7592 float q_min = GetEconomyProfile().GetQuantityMin();
7593 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7594
7595 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
7596 {
7597 ComponentEnergyManager comp = GetCompEM();
7598 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
7599 {
7600 comp.SetEnergy0To1(quantity_randomized);
7601 }
7602 }
7603 else if (HasQuantity())
7604 {
7605 SetQuantityNormalized(quantity_randomized, false);
7606 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
7607 }
7608
7609 }
7610 }
7611 }
7612
7614 void LockToParent()
7615 {
7616 EntityAI parent = GetHierarchyParent();
7617
7618 if (parent)
7619 {
7620 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7621 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7622 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
7623 }
7624 }
7625
7627 void UnlockFromParent()
7628 {
7629 EntityAI parent = GetHierarchyParent();
7630
7631 if (parent)
7632 {
7633 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7634 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7635 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
7636 }
7637 }
7638
7639 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
7640 {
7641 /*
7642 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
7643 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
7644 */
7645 ItemBase item2 = ItemBase.Cast(entity2);
7646
7647 if (GetGame().IsClient())
7648 {
7649 if (ScriptInputUserData.CanStoreInputUserData())
7650 {
7651 ScriptInputUserData ctx = new ScriptInputUserData;
7653 ctx.Write(-1);
7654 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7655 ctx.Write(i1);
7656 ctx.Write(item2);
7657 ctx.Write(use_stack_max);
7658 ctx.Write(-1);
7659 ctx.Send();
7660
7661 if (IsCombineAll(item2, use_stack_max))
7662 {
7663 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7664 }
7665 }
7666 }
7667 else if (!GetGame().IsMultiplayer())
7668 {
7669 CombineItems(item2, use_stack_max);
7670 }
7671 }
7672
7673 bool IsLiquidPresent()
7674 {
7675 return (GetLiquidType() != 0 && HasQuantity());
7676 }
7677
7678 bool IsLiquidContainer()
7679 {
7680 return m_LiquidContainerMask != 0;
7681 }
7682
7684 {
7685 return m_LiquidContainerMask;
7686 }
7687
7688 bool IsBloodContainer()
7689 {
7690 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
7691 return false;
7692 }
7693
7694 bool IsNVG()
7695 {
7696 return false;
7697 }
7698
7701 bool IsExplosive()
7702 {
7703 return false;
7704 }
7705
7707 {
7708 return "";
7709 }
7710
7712
7713 bool IsLightSource()
7714 {
7715 return false;
7716 }
7717
7719 {
7720 return true;
7721 }
7722
7723 //--- ACTION CONDITIONS
7724 //direction
7725 bool IsFacingPlayer(PlayerBase player, string selection)
7726 {
7727 return true;
7728 }
7729
7730 bool IsPlayerInside(PlayerBase player, string selection)
7731 {
7732 return true;
7733 }
7734
7735 override bool CanObstruct()
7736 {
7737 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
7738 return !player || !IsPlayerInside(player, "");
7739 }
7740
7741 override bool IsBeingPlaced()
7742 {
7743 return m_IsBeingPlaced;
7744 }
7745
7746 void SetIsBeingPlaced(bool is_being_placed)
7747 {
7748 m_IsBeingPlaced = is_being_placed;
7749 if (!is_being_placed)
7751 SetSynchDirty();
7752 }
7753
7754 //server-side
7755 void OnEndPlacement() {}
7756
7757 override bool IsHologram()
7758 {
7759 return m_IsHologram;
7760 }
7761
7762 bool CanBeDigged()
7763 {
7764 return m_CanBeDigged;
7765 }
7766
7768 {
7769 return 1;
7770 }
7771
7772 bool CanMakeGardenplot()
7773 {
7774 return false;
7775 }
7776
7777 void SetIsHologram(bool is_hologram)
7778 {
7779 m_IsHologram = is_hologram;
7780 SetSynchDirty();
7781 }
7782 /*
7783 protected float GetNutritionalEnergy()
7784 {
7785 Edible_Base edible = Edible_Base.Cast(this);
7786 return edible.GetFoodEnergy();
7787 }
7788
7789 protected float GetNutritionalWaterContent()
7790 {
7791 Edible_Base edible = Edible_Base.Cast(this);
7792 return edible.GetFoodWater();
7793 }
7794
7795 protected float GetNutritionalIndex()
7796 {
7797 Edible_Base edible = Edible_Base.Cast(this);
7798 return edible.GetFoodNutritionalIndex();
7799 }
7800
7801 protected float GetNutritionalFullnessIndex()
7802 {
7803 Edible_Base edible = Edible_Base.Cast(this);
7804 return edible.GetFoodTotalVolume();
7805 }
7806
7807 protected float GetNutritionalToxicity()
7808 {
7809 Edible_Base edible = Edible_Base.Cast(this);
7810 return edible.GetFoodToxicity();
7811
7812 }
7813 */
7814
7815
7816 // -------------------------------------------------------------------------
7817 override void OnMovedInsideCargo(EntityAI container)
7818 {
7819 super.OnMovedInsideCargo(container);
7820
7821 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7822 }
7823
7824 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7825 {
7826 super.EEItemLocationChanged(oldLoc,newLoc);
7827
7828 PlayerBase new_player = null;
7829 PlayerBase old_player = null;
7830
7831 if (newLoc.GetParent())
7832 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7833
7834 if (oldLoc.GetParent())
7835 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7836
7837 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
7838 {
7839 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7840
7841 if (r_index >= 0)
7842 {
7843 InventoryLocation r_il = new InventoryLocation;
7844 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7845
7846 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7847 int r_type = r_il.GetType();
7848 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
7849 {
7850 r_il.GetParent().GetOnReleaseLock().Invoke(this);
7851 }
7852 else if (r_type == InventoryLocationType.ATTACHMENT)
7853 {
7854 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
7855 }
7856
7857 }
7858 }
7859
7860 if (newLoc.GetType() == InventoryLocationType.HANDS)
7861 {
7862 if (new_player)
7863 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7864
7865 if (new_player == old_player)
7866 {
7867
7868 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7869 {
7870 if (oldLoc.GetType() == InventoryLocationType.CARGO)
7871 {
7872 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7873 {
7874 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7875 }
7876 }
7877 else
7878 {
7879 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7880 }
7881 }
7882
7883 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7884 {
7885 int type = oldLoc.GetType();
7886 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
7887 {
7888 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7889 }
7890 else if (type == InventoryLocationType.ATTACHMENT)
7891 {
7892 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7893 }
7894 }
7895 if (!m_OldLocation)
7896 {
7897 m_OldLocation = new InventoryLocation;
7898 }
7899 m_OldLocation.Copy(oldLoc);
7900 }
7901 else
7902 {
7903 if (m_OldLocation)
7904 {
7905 m_OldLocation.Reset();
7906 }
7907 }
7908
7910 }
7911 else
7912 {
7913 if (new_player)
7914 {
7915 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7916 if (res_index >= 0)
7917 {
7918 InventoryLocation il = new InventoryLocation;
7919 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7920 ItemBase it = ItemBase.Cast(il.GetItem());
7921 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7922 int rel_type = il.GetType();
7923 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
7924 {
7925 il.GetParent().GetOnReleaseLock().Invoke(it);
7926 }
7927 else if (rel_type == InventoryLocationType.ATTACHMENT)
7928 {
7929 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
7930 }
7931 //it.GetOnReleaseLock().Invoke(it);
7932 }
7933 }
7934 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
7935 {
7936 //ThrowPhysically(old_player, vector.Zero);
7937 m_ThrowItemOnDrop = false;
7938 }
7939
7940 if (m_OldLocation)
7941 {
7942 m_OldLocation.Reset();
7943 }
7944 }
7945 }
7946
7947 override void EOnContact(IEntity other, Contact extra)
7948 {
7950 {
7951 int liquidType = -1;
7952 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
7953 if (impactSpeed > 0.0)
7954 {
7955 m_ImpactSpeed = impactSpeed;
7956 #ifndef SERVER
7957 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
7958 #else
7959 m_WantPlayImpactSound = true;
7960 SetSynchDirty();
7961 #endif
7962 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
7963 }
7964 }
7965
7966 #ifdef SERVER
7967 if (GetCompEM() && GetCompEM().IsPlugged())
7968 {
7969 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
7970 GetCompEM().UnplugThis();
7971 }
7972 #endif
7973 }
7974
7975 void RefreshPhysics();
7976
7977 override void OnCreatePhysics()
7978 {
7980 }
7981
7982 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7983 {
7984
7985 }
7986 // -------------------------------------------------------------------------
7987 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
7988 {
7989 super.OnItemLocationChanged(old_owner, new_owner);
7990
7991 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7992 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7993
7994 if (!relatedPlayer && playerNew)
7995 relatedPlayer = playerNew;
7996
7997 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7998 {
7999 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
8000 if (actionMgr)
8001 {
8002 ActionBase currentAction = actionMgr.GetRunningAction();
8003 if (currentAction)
8004 currentAction.OnItemLocationChanged(this);
8005 }
8006 }
8007
8008 Man ownerPlayerOld = null;
8009 Man ownerPlayerNew = null;
8010
8011 if (old_owner)
8012 {
8013 if (old_owner.IsMan())
8014 {
8015 ownerPlayerOld = Man.Cast(old_owner);
8016 }
8017 else
8018 {
8019 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8020 }
8021 }
8022 else
8023 {
8024 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
8025 {
8026 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
8027
8028 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
8029 {
8030 GetCompEM().UnplugThis();
8031 }
8032 }
8033 }
8034
8035 if (new_owner)
8036 {
8037 if (new_owner.IsMan())
8038 {
8039 ownerPlayerNew = Man.Cast(new_owner);
8040 }
8041 else
8042 {
8043 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8044 }
8045 }
8046
8047 if (ownerPlayerOld != ownerPlayerNew)
8048 {
8049 if (ownerPlayerOld)
8050 {
8051 array<EntityAI> subItemsExit = new array<EntityAI>;
8052 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
8053 for (int i = 0; i < subItemsExit.Count(); i++)
8054 {
8055 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
8056 itemExit.OnInventoryExit(ownerPlayerOld);
8057 }
8058 }
8059
8060 if (ownerPlayerNew)
8061 {
8062 array<EntityAI> subItemsEnter = new array<EntityAI>;
8063 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
8064 for (int j = 0; j < subItemsEnter.Count(); j++)
8065 {
8066 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
8067 itemEnter.OnInventoryEnter(ownerPlayerNew);
8068 }
8069 }
8070 }
8071 else if (ownerPlayerNew != null)
8072 {
8073 PlayerBase nplayer;
8074 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8075 {
8076 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8077 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
8078 for (int k = 0; k < subItemsUpdate.Count(); k++)
8079 {
8080 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
8081 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8082 }
8083 }
8084 }
8085
8086 if (old_owner)
8087 old_owner.OnChildItemRemoved(this);
8088 if (new_owner)
8089 new_owner.OnChildItemReceived(this);
8090 }
8091
8092 // -------------------------------------------------------------------------------
8093 override void EEDelete(EntityAI parent)
8094 {
8095 super.EEDelete(parent);
8096 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8097 if (player)
8098 {
8099 OnInventoryExit(player);
8100
8101 if (player.IsAlive())
8102 {
8103 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8104 if (r_index >= 0)
8105 {
8106 InventoryLocation r_il = new InventoryLocation;
8107 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8108
8109 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8110 int r_type = r_il.GetType();
8111 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8112 {
8113 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8114 }
8115 else if (r_type == InventoryLocationType.ATTACHMENT)
8116 {
8117 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8118 }
8119
8120 }
8121
8122 player.RemoveQuickBarEntityShortcut(this);
8123 }
8124 }
8125 }
8126 // -------------------------------------------------------------------------------
8127 override void EEKilled(Object killer)
8128 {
8129 super.EEKilled(killer);
8130
8132 if (killer && killer.IsFireplace() && CanExplodeInFire())
8133 {
8134 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8135 {
8136 if (IsMagazine())
8137 {
8138 if (Magazine.Cast(this).GetAmmoCount() > 0)
8139 {
8140 ExplodeAmmo();
8141 }
8142 }
8143 else
8144 {
8145 Explode(DamageType.EXPLOSION);
8146 }
8147 }
8148 }
8149 }
8150
8151 override void OnWasAttached(EntityAI parent, int slot_id)
8152 {
8153 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8154
8155 super.OnWasAttached(parent, slot_id);
8156
8157 if (HasQuantity())
8158 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8159
8160 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
8161 }
8162
8163 override void OnWasDetached(EntityAI parent, int slot_id)
8164 {
8165 super.OnWasDetached(parent, slot_id);
8166
8167 if (HasQuantity())
8168 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8169 }
8170
8171 override string ChangeIntoOnAttach(string slot)
8172 {
8173 int idx;
8174 TStringArray inventory_slots = new TStringArray;
8175 TStringArray attach_types = new TStringArray;
8176
8177 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8178 if (inventory_slots.Count() < 1) //is string
8179 {
8180 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8181 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8182 }
8183 else //is array
8184 {
8185 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8186 }
8187
8188 idx = inventory_slots.Find(slot);
8189 if (idx < 0)
8190 return "";
8191
8192 return attach_types.Get(idx);
8193 }
8194
8195 override string ChangeIntoOnDetach()
8196 {
8197 int idx = -1;
8198 string slot;
8199
8200 TStringArray inventory_slots = new TStringArray;
8201 TStringArray detach_types = new TStringArray;
8202
8203 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8204 if (inventory_slots.Count() < 1) //is string
8205 {
8206 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8207 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8208 }
8209 else //is array
8210 {
8211 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8212 if (detach_types.Count() < 1)
8213 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8214 }
8215
8216 for (int i = 0; i < inventory_slots.Count(); i++)
8217 {
8218 slot = inventory_slots.Get(i);
8219 }
8220
8221 if (slot != "")
8222 {
8223 if (detach_types.Count() == 1)
8224 idx = 0;
8225 else
8226 idx = inventory_slots.Find(slot);
8227 }
8228 if (idx < 0)
8229 return "";
8230
8231 return detach_types.Get(idx);
8232 }
8233
8234 void ExplodeAmmo()
8235 {
8236 //timer
8237 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
8238
8239 //min/max time
8240 float min_time = 1;
8241 float max_time = 3;
8242 float delay = Math.RandomFloat(min_time, max_time);
8243
8244 explode_timer.Run(delay, this, "DoAmmoExplosion");
8245 }
8246
8247 void DoAmmoExplosion()
8248 {
8249 Magazine magazine = Magazine.Cast(this);
8250 int pop_sounds_count = 6;
8251 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8252
8253 //play sound
8254 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8255 string sound_name = pop_sounds[ sound_idx ];
8256 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
8257
8258 //remove ammo count
8259 magazine.ServerAddAmmoCount(-1);
8260
8261 //if condition then repeat -> ExplodeAmmo
8262 float min_temp_to_explode = 100; //min temperature for item to explode
8263
8264 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
8265 {
8266 ExplodeAmmo();
8267 }
8268 }
8269
8270 // -------------------------------------------------------------------------------
8271 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
8272 {
8273 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
8274
8275 const int CHANCE_DAMAGE_CARGO = 4;
8276 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8277 const int CHANCE_DAMAGE_NOTHING = 2;
8278
8279 if (IsClothing() || IsContainer() || IsItemTent())
8280 {
8281 float dmg = damageResult.GetDamage("","Health") * -0.5;
8282 int chances;
8283 int rnd;
8284
8285 if (GetInventory().GetCargo())
8286 {
8287 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8288 rnd = Math.RandomInt(0,chances);
8289
8290 if (rnd < CHANCE_DAMAGE_CARGO)
8291 {
8292 DamageItemInCargo(dmg);
8293 }
8294 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8295 {
8297 }
8298 }
8299 else
8300 {
8301 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8302 rnd = Math.RandomInt(0,chances);
8303
8304 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8305 {
8307 }
8308 }
8309 }
8310 }
8311
8312 bool DamageItemInCargo(float damage)
8313 {
8314 if (GetInventory().GetCargo())
8315 {
8316 int item_count = GetInventory().GetCargo().GetItemCount();
8317 if (item_count > 0)
8318 {
8319 int random_pick = Math.RandomInt(0, item_count);
8320 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
8321 if (!item.IsExplosive())
8322 {
8323 item.AddHealth("","",damage);
8324 return true;
8325 }
8326 }
8327 }
8328 return false;
8329 }
8330
8331 bool DamageItemAttachments(float damage)
8332 {
8333 int attachment_count = GetInventory().AttachmentCount();
8334 if (attachment_count > 0)
8335 {
8336 int random_pick = Math.RandomInt(0, attachment_count);
8337 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8338 if (!attachment.IsExplosive())
8339 {
8340 attachment.AddHealth("","",damage);
8341 return true;
8342 }
8343 }
8344 return false;
8345 }
8346
8347 override bool IsSplitable()
8348 {
8349 return m_CanThisBeSplit;
8350 }
8351 //----------------
8352 override bool CanBeSplit()
8353 {
8354 if (IsSplitable() && (GetQuantity() > 1))
8355 return GetInventory().CanRemoveEntity();
8356
8357 return false;
8358 }
8359
8360 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
8361 {
8362 if (!CanBeSplit())
8363 return;
8364
8365 if (GetGame().IsClient())
8366 {
8367 if (ScriptInputUserData.CanStoreInputUserData())
8368 {
8369 ScriptInputUserData ctx = new ScriptInputUserData;
8371 ctx.Write(1);
8372 ItemBase i1 = this; // @NOTE: workaround for correct serialization
8373 ctx.Write(i1);
8374 ctx.Write(destination_entity);
8375 ctx.Write(true);
8376 ctx.Write(slot_id);
8377 ctx.Send();
8378 }
8379 }
8380 else if (!GetGame().IsMultiplayer())
8381 {
8382 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
8383 }
8384 }
8385
8386 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
8387 {
8388 if (!CanBeSplit())
8389 return;
8390
8391 float split_quantity_new;
8392 ref ItemBase new_item;
8393 float quantity = GetQuantity();
8394 float stack_max = GetTargetQuantityMax(slot_id);
8395 InventoryLocation loc = new InventoryLocation;
8396
8397 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8398 {
8399 if (stack_max <= GetQuantity())
8400 split_quantity_new = stack_max;
8401 else
8402 split_quantity_new = GetQuantity();
8403
8404 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
8405 if (new_item)
8406 {
8407 new_item.SetResultOfSplit(true);
8408 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8409 AddQuantity(-split_quantity_new);
8410 new_item.SetQuantity(split_quantity_new);
8411 }
8412 }
8413 else if (destination_entity && slot_id == -1)
8414 {
8415 if (quantity > stack_max)
8416 split_quantity_new = stack_max;
8417 else
8418 split_quantity_new = quantity;
8419
8420 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
8421 {
8422 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
8423 new_item = ItemBase.Cast(o);
8424 }
8425
8426 if (new_item)
8427 {
8428 new_item.SetResultOfSplit(true);
8429 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8430 AddQuantity(-split_quantity_new);
8431 new_item.SetQuantity(split_quantity_new);
8432 }
8433 }
8434 else
8435 {
8436 if (stack_max != 0)
8437 {
8438 if (stack_max < GetQuantity())
8439 {
8440 split_quantity_new = GetQuantity() - stack_max;
8441 }
8442
8443 if (split_quantity_new == 0)
8444 {
8445 if (!GetGame().IsMultiplayer())
8446 player.PhysicalPredictiveDropItem(this);
8447 else
8448 player.ServerDropEntity(this);
8449 return;
8450 }
8451
8452 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
8453
8454 if (new_item)
8455 {
8456 new_item.SetResultOfSplit(true);
8457 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8458 SetQuantity(split_quantity_new);
8459 new_item.SetQuantity(stack_max);
8460 new_item.PlaceOnSurface();
8461 }
8462 }
8463 }
8464 }
8465
8466 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
8467 {
8468 if (!CanBeSplit())
8469 return;
8470
8471 float split_quantity_new;
8472 ref ItemBase new_item;
8473 float quantity = GetQuantity();
8474 float stack_max = GetTargetQuantityMax(slot_id);
8475 InventoryLocation loc = new InventoryLocation;
8476
8477 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8478 {
8479 if (stack_max <= GetQuantity())
8480 split_quantity_new = stack_max;
8481 else
8482 split_quantity_new = GetQuantity();
8483
8484 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
8485 if (new_item)
8486 {
8487 new_item.SetResultOfSplit(true);
8488 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8489 AddQuantity(-split_quantity_new);
8490 new_item.SetQuantity(split_quantity_new);
8491 }
8492 }
8493 else if (destination_entity && slot_id == -1)
8494 {
8495 if (quantity > stack_max)
8496 split_quantity_new = stack_max;
8497 else
8498 split_quantity_new = quantity;
8499
8500 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
8501 {
8502 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
8503 new_item = ItemBase.Cast(o);
8504 }
8505
8506 if (new_item)
8507 {
8508 new_item.SetResultOfSplit(true);
8509 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8510 AddQuantity(-split_quantity_new);
8511 new_item.SetQuantity(split_quantity_new);
8512 }
8513 }
8514 else
8515 {
8516 if (stack_max != 0)
8517 {
8518 if (stack_max < GetQuantity())
8519 {
8520 split_quantity_new = GetQuantity() - stack_max;
8521 }
8522
8523 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
8524
8525 if (new_item)
8526 {
8527 new_item.SetResultOfSplit(true);
8528 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8529 SetQuantity(split_quantity_new);
8530 new_item.SetQuantity(stack_max);
8531 new_item.PlaceOnSurface();
8532 }
8533 }
8534 }
8535 }
8536
8537 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
8538 {
8539 if (!CanBeSplit())
8540 return;
8541
8542 if (GetGame().IsClient())
8543 {
8544 if (ScriptInputUserData.CanStoreInputUserData())
8545 {
8546 ScriptInputUserData ctx = new ScriptInputUserData;
8548 ctx.Write(4);
8549 ItemBase thiz = this; // @NOTE: workaround for correct serialization
8550 ctx.Write(thiz);
8551 dst.WriteToContext(ctx);
8552 ctx.Send();
8553 }
8554 }
8555 else if (!GetGame().IsMultiplayer())
8556 {
8558 }
8559 }
8560
8561 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
8562 {
8563 if (!CanBeSplit())
8564 return;
8565
8566 if (GetGame().IsClient())
8567 {
8568 if (ScriptInputUserData.CanStoreInputUserData())
8569 {
8570 ScriptInputUserData ctx = new ScriptInputUserData;
8572 ctx.Write(2);
8573 ItemBase dummy = this; // @NOTE: workaround for correct serialization
8574 ctx.Write(dummy);
8575 ctx.Write(destination_entity);
8576 ctx.Write(true);
8577 ctx.Write(idx);
8578 ctx.Write(row);
8579 ctx.Write(col);
8580 ctx.Send();
8581 }
8582 }
8583 else if (!GetGame().IsMultiplayer())
8584 {
8585 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
8586 }
8587 }
8588
8589 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
8590 {
8592 }
8593
8594 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
8595 {
8596 if (!CanBeSplit())
8597 return this;
8598
8599 float quantity = GetQuantity();
8600 float split_quantity_new;
8601 ItemBase new_item;
8602 if (dst.IsValid())
8603 {
8604 int slot_id = dst.GetSlot();
8605 float stack_max = GetTargetQuantityMax(slot_id);
8606
8607 if (quantity > stack_max)
8608 split_quantity_new = stack_max;
8609 else
8610 split_quantity_new = quantity;
8611
8612 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
8613
8614 if (new_item)
8615 {
8616 new_item.SetResultOfSplit(true);
8617 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8618 AddQuantity(-split_quantity_new);
8619 new_item.SetQuantity(split_quantity_new);
8620 }
8621
8622 return new_item;
8623 }
8624
8625 return null;
8626 }
8627
8628 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
8629 {
8630 if (!CanBeSplit())
8631 return;
8632
8633 float quantity = GetQuantity();
8634 float split_quantity_new;
8635 ref ItemBase new_item;
8636 if (destination_entity)
8637 {
8638 float stackable = GetTargetQuantityMax();
8639 if (quantity > stackable)
8640 split_quantity_new = stackable;
8641 else
8642 split_quantity_new = quantity;
8643
8644 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
8645 if (new_item)
8646 {
8647 new_item.SetResultOfSplit(true);
8648 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8649 AddQuantity(-split_quantity_new);
8650 new_item.SetQuantity(split_quantity_new);
8651 }
8652 }
8653 }
8654
8655 void SplitIntoStackMaxHandsClient(PlayerBase player)
8656 {
8657 if (!CanBeSplit())
8658 return;
8659
8660 if (GetGame().IsClient())
8661 {
8662 if (ScriptInputUserData.CanStoreInputUserData())
8663 {
8664 ScriptInputUserData ctx = new ScriptInputUserData;
8666 ctx.Write(3);
8667 ItemBase i1 = this; // @NOTE: workaround for correct serialization
8668 ctx.Write(i1);
8669 ItemBase destination_entity = this;
8670 ctx.Write(destination_entity);
8671 ctx.Write(true);
8672 ctx.Write(0);
8673 ctx.Send();
8674 }
8675 }
8676 else if (!GetGame().IsMultiplayer())
8677 {
8678 SplitIntoStackMaxHands(player);
8679 }
8680 }
8681
8682 void SplitIntoStackMaxHands(PlayerBase player)
8683 {
8684 if (!CanBeSplit())
8685 return;
8686
8687 float quantity = GetQuantity();
8688 float split_quantity_new;
8689 ref ItemBase new_item;
8690 if (player)
8691 {
8692 float stackable = GetTargetQuantityMax();
8693 if (quantity > stackable)
8694 split_quantity_new = stackable;
8695 else
8696 split_quantity_new = quantity;
8697
8698 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
8699 new_item = ItemBase.Cast(in_hands);
8700 if (new_item)
8701 {
8702 new_item.SetResultOfSplit(true);
8703 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8704 AddQuantity(-split_quantity_new);
8705 new_item.SetQuantity(split_quantity_new);
8706 }
8707 }
8708 }
8709
8710 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
8711 {
8712 if (!CanBeSplit())
8713 return;
8714
8715 float quantity = GetQuantity();
8716 float split_quantity_new = Math.Floor(quantity * 0.5);
8717
8718 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
8719
8720 if (new_item)
8721 {
8722 if (new_item.GetQuantityMax() < split_quantity_new)
8723 {
8724 split_quantity_new = new_item.GetQuantityMax();
8725 }
8726
8727 new_item.SetResultOfSplit(true);
8728 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8729
8730 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
8731 {
8732 AddQuantity(-1);
8733 new_item.SetQuantity(1);
8734 }
8735 else
8736 {
8737 AddQuantity(-split_quantity_new);
8738 new_item.SetQuantity(split_quantity_new);
8739 }
8740 }
8741 }
8742
8743 void SplitItem(PlayerBase player)
8744 {
8745 if (!CanBeSplit())
8746 return;
8747
8748 float quantity = GetQuantity();
8749 float split_quantity_new = Math.Floor(quantity / 2);
8750
8751 InventoryLocation invloc = new InventoryLocation;
8752 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
8753
8754 ItemBase new_item;
8755 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8756
8757 if (new_item)
8758 {
8759 if (new_item.GetQuantityMax() < split_quantity_new)
8760 {
8761 split_quantity_new = new_item.GetQuantityMax();
8762 }
8763 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
8764 {
8765 AddQuantity(-1);
8766 new_item.SetQuantity(1);
8767 }
8768 else
8769 {
8770 AddQuantity(-split_quantity_new);
8771 new_item.SetQuantity(split_quantity_new);
8772 }
8773 }
8774 }
8775
8777 void OnQuantityChanged(float delta)
8778 {
8779 SetWeightDirty();
8780 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
8781
8782 if (parent)
8783 parent.OnAttachmentQuantityChangedEx(this, delta);
8784
8785 if (IsLiquidContainer())
8786 {
8787 if (GetQuantityNormalized() <= 0.0)
8788 {
8790 }
8791 else if (GetLiquidType() == LIQUID_NONE)
8792 {
8793 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
8795 }
8796 }
8797
8798 }
8799
8802 {
8803 // insert code here
8804 }
8805
8807 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
8808 {
8810 }
8811
8812 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
8813 {
8814 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8815
8816 if (GetGame().IsServer())
8817 {
8818 if (newLevel == GameConstants.STATE_RUINED)
8819 {
8821 EntityAI parent = GetHierarchyParent();
8822 if (parent && parent.IsFireplace())
8823 {
8824 CargoBase cargo = GetInventory().GetCargo();
8825 if (cargo)
8826 {
8827 for (int i = 0; i < cargo.GetItemCount(); ++i)
8828 {
8829 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
8830 }
8831 }
8832 }
8833 }
8834
8835 if (IsResultOfSplit())
8836 {
8837 // reset the splitting result flag, return to normal item behavior
8838 SetResultOfSplit(false);
8839 return;
8840 }
8841
8842 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8843 {
8844 SetCleanness(0);//unclean the item upon damage dealt
8845 }
8846 }
8847 }
8848
8849 // just the split? TODO: verify
8850 override void OnRightClick()
8851 {
8852 super.OnRightClick();
8853
8854 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
8855 {
8856 if (GetGame().IsClient())
8857 {
8858 if (ScriptInputUserData.CanStoreInputUserData())
8859 {
8860 vector m4[4];
8861 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8862
8863 EntityAI root = GetHierarchyRoot();
8864
8865 InventoryLocation dst = new InventoryLocation;
8866 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
8867 {
8868 if (root)
8869 {
8870 root.GetTransform(m4);
8871 dst.SetGround(this, m4);
8872 }
8873 else
8874 GetInventory().GetCurrentInventoryLocation(dst);
8875 }
8876 else
8877 {
8878 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
8879 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
8880 this shouldnt cause issues within this scope*/
8881 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
8882 {
8883 if (root)
8884 {
8885 root.GetTransform(m4);
8886 dst.SetGround(this, m4);
8887 }
8888 else
8889 GetInventory().GetCurrentInventoryLocation(dst);
8890 }
8891 else
8892 {
8893 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8894 }
8895 }
8896
8897 ScriptInputUserData ctx = new ScriptInputUserData;
8899 ctx.Write(4);
8900 ItemBase thiz = this; // @NOTE: workaround for correct serialization
8901 ctx.Write(thiz);
8902 dst.WriteToContext(ctx);
8903 ctx.Write(true); // dummy
8904 ctx.Send();
8905 }
8906 }
8907 else if (!GetGame().IsMultiplayer())
8908 {
8909 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
8910 }
8911 }
8912 }
8913
8914 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
8915 {
8916 //TODO: delete check zero quantity check after fix double posts hands fsm events
8917 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
8918 return false;
8919
8920 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8921 return false;
8922
8923 //can_this_be_combined = ConfigGetBool("canBeSplit");
8925 return false;
8926
8927
8928 Magazine mag = Magazine.Cast(this);
8929 if (mag)
8930 {
8931 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8932 return false;
8933
8934 if (stack_max_limit)
8935 {
8936 Magazine other_mag = Magazine.Cast(other_item);
8937 if (other_item)
8938 {
8939 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8940 return false;
8941 }
8942
8943 }
8944 }
8945 else
8946 {
8947 //TODO: delete check zero quantity check after fix double posts hands fsm events
8948 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
8949 return false;
8950
8951 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
8952 return false;
8953 }
8954
8955 PlayerBase player = null;
8956 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
8957 {
8958 if (player.GetInventory().HasAttachment(this))
8959 return false;
8960
8961 if (player.IsItemsToDelete())
8962 return false;
8963 }
8964
8965 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8966 return false;
8967
8968 int slotID;
8969 string slotName;
8970 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8971 return false;
8972
8973 return true;
8974 }
8975
8976 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
8977 {
8978 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
8979 }
8980
8981 bool IsResultOfSplit()
8982 {
8983 return m_IsResultOfSplit;
8984 }
8985
8986 void SetResultOfSplit(bool value)
8987 {
8988 m_IsResultOfSplit = value;
8989 }
8990
8991 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
8992 {
8993 return ComputeQuantityUsedEx(other_item, use_stack_max);
8994 }
8995
8996 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
8997 {
8998 float other_item_quantity = other_item.GetQuantity();
8999 float this_free_space;
9000
9001 float stack_max = GetQuantityMax();
9002
9003 this_free_space = stack_max - GetQuantity();
9004
9005 if (other_item_quantity > this_free_space)
9006 {
9007 return this_free_space;
9008 }
9009 else
9010 {
9011 return other_item_quantity;
9012 }
9013 }
9014
9015 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
9016 {
9017 CombineItems(ItemBase.Cast(entity2),use_stack_max);
9018 }
9019
9020 void CombineItems(ItemBase other_item, bool use_stack_max = true)
9021 {
9022 if (!CanBeCombined(other_item, false))
9023 return;
9024
9025 if (!IsMagazine() && other_item)
9026 {
9027 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
9028 if (quantity_used != 0)
9029 {
9030 float hp1 = GetHealth01("","");
9031 float hp2 = other_item.GetHealth01("","");
9032 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
9033 hpResult = hpResult / (GetQuantity() + quantity_used);
9034
9035 hpResult *= GetMaxHealth();
9036 Math.Round(hpResult);
9037 SetHealth("", "Health", hpResult);
9038
9039 AddQuantity(quantity_used);
9040 other_item.AddQuantity(-quantity_used);
9041 }
9042 }
9043 OnCombine(other_item);
9044 }
9045
9046 void OnCombine(ItemBase other_item)
9047 {
9048 #ifdef SERVER
9049 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9050 GetHierarchyParent().IncreaseLifetimeUp();
9051 #endif
9052 };
9053
9054 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
9055 {
9056 PlayerBase p = PlayerBase.Cast(player);
9057
9058 array<int> recipesIds = p.m_Recipes;
9059 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9060 if (moduleRecipesManager)
9061 {
9062 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9063 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
9064 }
9065
9066 for (int i = 0;i < recipesIds.Count(); i++)
9067 {
9068 int key = recipesIds.Get(i);
9069 string recipeName = moduleRecipesManager.GetRecipeName(key);
9070 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
9071 }
9072 }
9073
9074 // -------------------------------------------------------------------------
9075 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9076 {
9077 super.GetDebugActions(outputList);
9078
9079 //quantity
9080 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
9081 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
9082 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
9083 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
9084
9085 //health
9086 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
9087 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
9088 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
9089 //temperature
9090 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
9091 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
9092 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
9093
9094 //wet
9095 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
9096 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
9097
9098 //liquidtype
9099 if (IsLiquidContainer())
9100 {
9101 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
9102 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
9103 }
9104
9105 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
9106 // watch
9107 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
9108 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
9109
9110 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
9111 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
9112 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
9113 }
9114
9115 // -------------------------------------------------------------------------
9116 // -------------------------------------------------------------------------
9117 // -------------------------------------------------------------------------
9118 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
9119 {
9120 super.OnAction(action_id, player, ctx);
9121 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
9122 {
9123 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9124 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
9125 PlayerBase p = PlayerBase.Cast(player);
9126 if (EActions.RECIPES_RANGE_START < 1000)
9127 {
9128 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9129 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9130 }
9131 }
9132 #ifndef SERVER
9133 else if (action_id == EActions.WATCH_PLAYER)
9134 {
9135 PluginDeveloper.SetDeveloperItemClientEx(player);
9136 }
9137 #endif
9138 if (GetGame().IsServer())
9139 {
9140 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9141 {
9142 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9143 OnDebugButtonPressServer(id + 1);
9144 }
9145
9146 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9147 {
9148 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9149 InsertAgent(agent_id,100);
9150 }
9151
9152 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9153 {
9154 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9155 RemoveAgent(agent_id2);
9156 }
9157
9158 else if (action_id == EActions.ADD_QUANTITY)
9159 {
9160 if (IsMagazine())
9161 {
9162 Magazine mag = Magazine.Cast(this);
9163 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9164 }
9165 else
9166 {
9167 AddQuantity(GetQuantityMax() * 0.2);
9168 }
9169
9170 if (m_EM)
9171 {
9172 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9173 }
9174 //PrintVariables();
9175 }
9176
9177 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
9178 {
9179 if (IsMagazine())
9180 {
9181 Magazine mag2 = Magazine.Cast(this);
9182 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9183 }
9184 else
9185 {
9186 AddQuantity(- GetQuantityMax() * 0.2);
9187 }
9188 if (m_EM)
9189 {
9190 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9191 }
9192 //PrintVariables();
9193 }
9194
9195 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
9196 {
9197 SetQuantity(0);
9198
9199 if (m_EM)
9200 {
9201 m_EM.SetEnergy(0);
9202 }
9203 }
9204
9205 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
9206 {
9208
9209 if (m_EM)
9210 {
9211 m_EM.SetEnergy(m_EM.GetEnergyMax());
9212 }
9213 }
9214
9215 else if (action_id == EActions.ADD_HEALTH)
9216 {
9217 AddHealth("","",GetMaxHealth("","Health")/5);
9218 }
9219 else if (action_id == EActions.REMOVE_HEALTH)
9220 {
9221 AddHealth("","",-GetMaxHealth("","Health")/5);
9222 }
9223 else if (action_id == EActions.DESTROY_HEALTH)
9224 {
9225 SetHealth01("","",0);
9226 }
9227 else if (action_id == EActions.WATCH_ITEM)
9228 {
9230 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
9231 #ifdef DEVELOPER
9232 SetDebugDeveloper_item(this);
9233 #endif
9234 }
9235
9236 else if (action_id == EActions.ADD_TEMPERATURE)
9237 {
9238 AddTemperature(20);
9239 //PrintVariables();
9240 }
9241
9242 else if (action_id == EActions.REMOVE_TEMPERATURE)
9243 {
9244 AddTemperature(-20);
9245 //PrintVariables();
9246 }
9247
9248 else if (action_id == EActions.FLIP_FROZEN)
9249 {
9250 SetFrozen(!GetIsFrozen());
9251 //PrintVariables();
9252 }
9253
9254 else if (action_id == EActions.ADD_WETNESS)
9255 {
9256 AddWet(GetWetMax()/5);
9257 //PrintVariables();
9258 }
9259
9260 else if (action_id == EActions.REMOVE_WETNESS)
9261 {
9262 AddWet(-GetWetMax()/5);
9263 //PrintVariables();
9264 }
9265
9266 else if (action_id == EActions.LIQUIDTYPE_UP)
9267 {
9268 int curr_type = GetLiquidType();
9269 SetLiquidType(curr_type * 2);
9270 //AddWet(1);
9271 //PrintVariables();
9272 }
9273
9274 else if (action_id == EActions.LIQUIDTYPE_DOWN)
9275 {
9276 int curr_type2 = GetLiquidType();
9277 SetLiquidType(curr_type2 / 2);
9278 }
9279
9280 else if (action_id == EActions.MAKE_SPECIAL)
9281 {
9282 auto debugParams = DebugSpawnParams.WithPlayer(player);
9283 OnDebugSpawnEx(debugParams);
9284 }
9285
9286 else if (action_id == EActions.DELETE)
9287 {
9288 Delete();
9289 }
9290
9291 }
9292
9293
9294 return false;
9295 }
9296
9297 // -------------------------------------------------------------------------
9298
9299
9302 void OnActivatedByTripWire();
9303
9305 void OnActivatedByItem(notnull ItemBase item);
9306
9307 //----------------------------------------------------------------
9308 //returns true if item is able to explode when put in fire
9309 bool CanExplodeInFire()
9310 {
9311 return false;
9312 }
9313
9314 //----------------------------------------------------------------
9315 bool CanEat()
9316 {
9317 return true;
9318 }
9319
9320 //----------------------------------------------------------------
9321 override bool IsIgnoredByConstruction()
9322 {
9323 return true;
9324 }
9325
9326 //----------------------------------------------------------------
9327 //has FoodStages in config?
9328 bool HasFoodStage()
9329 {
9330 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
9331 return GetGame().ConfigIsExisting(config_path);
9332 }
9333
9335 FoodStage GetFoodStage()
9336 {
9337 return null;
9338 }
9339
9340 bool CanBeCooked()
9341 {
9342 return false;
9343 }
9344
9345 bool CanBeCookedOnStick()
9346 {
9347 return false;
9348 }
9349
9351 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
9353
9354 //----------------------------------------------------------------
9355 bool CanRepair(ItemBase item_repair_kit)
9356 {
9357 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
9358 return module_repairing.CanRepair(this, item_repair_kit);
9359 }
9360
9361 //----------------------------------------------------------------
9362 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
9363 {
9364 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
9365 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9366 }
9367
9368 //----------------------------------------------------------------
9369 int GetItemSize()
9370 {
9371 /*
9372 vector v_size = this.ConfigGetVector("itemSize");
9373 int v_size_x = v_size[0];
9374 int v_size_y = v_size[1];
9375 int size = v_size_x * v_size_y;
9376 return size;
9377 */
9378
9379 return 1;
9380 }
9381
9382 //----------------------------------------------------------------
9383 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
9384 bool CanBeMovedOverride()
9385 {
9386 return m_CanBeMovedOverride;
9387 }
9388
9389 //----------------------------------------------------------------
9390 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
9391 void SetCanBeMovedOverride(bool setting)
9392 {
9393 m_CanBeMovedOverride = setting;
9394 }
9395
9396 //----------------------------------------------------------------
9404 void MessageToOwnerStatus(string text)
9405 {
9406 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9407
9408 if (player)
9409 {
9410 player.MessageStatus(text);
9411 }
9412 }
9413
9414 //----------------------------------------------------------------
9422 void MessageToOwnerAction(string text)
9423 {
9424 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9425
9426 if (player)
9427 {
9428 player.MessageAction(text);
9429 }
9430 }
9431
9432 //----------------------------------------------------------------
9440 void MessageToOwnerFriendly(string text)
9441 {
9442 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9443
9444 if (player)
9445 {
9446 player.MessageFriendly(text);
9447 }
9448 }
9449
9450 //----------------------------------------------------------------
9458 void MessageToOwnerImportant(string text)
9459 {
9460 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9461
9462 if (player)
9463 {
9464 player.MessageImportant(text);
9465 }
9466 }
9467
9468 override bool IsItemBase()
9469 {
9470 return true;
9471 }
9472
9473 // Checks if item is of questioned kind
9474 override bool KindOf(string tag)
9475 {
9476 bool found = false;
9477 string item_name = this.GetType();
9478 ref TStringArray item_tag_array = new TStringArray;
9479 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
9480
9481 int array_size = item_tag_array.Count();
9482 for (int i = 0; i < array_size; i++)
9483 {
9484 if (item_tag_array.Get(i) == tag)
9485 {
9486 found = true;
9487 break;
9488 }
9489 }
9490 return found;
9491 }
9492
9493
9494 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
9495 {
9496 //Debug.Log("OnRPC called");
9497 super.OnRPC(sender, rpc_type,ctx);
9498
9499 //Play soundset for attachment locking (ActionLockAttachment.c)
9500 switch (rpc_type)
9501 {
9502 #ifndef SERVER
9503 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9504 Param2<bool, string> p = new Param2<bool, string>(false, "");
9505
9506 if (!ctx.Read(p))
9507 return;
9508
9509 bool play = p.param1;
9510 string soundSet = p.param2;
9511
9512 if (play)
9513 {
9514 if (m_LockingSound)
9515 {
9517 {
9518 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
9519 }
9520 }
9521 else
9522 {
9523 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
9524 }
9525 }
9526 else
9527 {
9528 SEffectManager.DestroyEffect(m_LockingSound);
9529 }
9530
9531 break;
9532 #endif
9533
9534 }
9535
9536 if (GetWrittenNoteData())
9537 {
9538 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
9539 }
9540 }
9541
9542 //-----------------------------
9543 // VARIABLE MANIPULATION SYSTEM
9544 //-----------------------------
9545 int NameToID(string name)
9546 {
9547 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
9548 return plugin.GetID(name);
9549 }
9550
9551 string IDToName(int id)
9552 {
9553 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
9554 return plugin.GetName(id);
9555 }
9556
9558 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
9559 {
9560 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
9561 //read the flags
9562 int varFlags;
9563 if (!ctx.Read(varFlags))
9564 return;
9565
9566 if (varFlags & ItemVariableFlags.FLOAT)
9567 {
9568 ReadVarsFromCTX(ctx);
9569 }
9570 }
9571
9572 override void SerializeNumericalVars(array<float> floats_out)
9573 {
9574 //some variables handled on EntityAI level already!
9575 super.SerializeNumericalVars(floats_out);
9576
9577 // the order of serialization must be the same as the order of de-serialization
9578 //--------------------------------------------
9579 if (IsVariableSet(VARIABLE_QUANTITY))
9580 {
9581 floats_out.Insert(m_VarQuantity);
9582 }
9583 //--------------------------------------------
9584 if (IsVariableSet(VARIABLE_WET))
9585 {
9586 floats_out.Insert(m_VarWet);
9587 }
9588 //--------------------------------------------
9589 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
9590 {
9591 floats_out.Insert(m_VarLiquidType);
9592 }
9593 //--------------------------------------------
9594 if (IsVariableSet(VARIABLE_COLOR))
9595 {
9596 floats_out.Insert(m_ColorComponentR);
9597 floats_out.Insert(m_ColorComponentG);
9598 floats_out.Insert(m_ColorComponentB);
9599 floats_out.Insert(m_ColorComponentA);
9600 }
9601 //--------------------------------------------
9602 if (IsVariableSet(VARIABLE_CLEANNESS))
9603 {
9604 floats_out.Insert(m_Cleanness);
9605 }
9606 }
9607
9608 override void DeSerializeNumericalVars(array<float> floats)
9609 {
9610 //some variables handled on EntityAI level already!
9611 super.DeSerializeNumericalVars(floats);
9612
9613 // the order of serialization must be the same as the order of de-serialization
9614 int index = 0;
9615 int mask = Math.Round(floats.Get(index));
9616
9617 index++;
9618 //--------------------------------------------
9619 if (mask & VARIABLE_QUANTITY)
9620 {
9621 if (m_IsStoreLoad)
9622 {
9623 SetStoreLoadedQuantity(floats.Get(index));
9624 }
9625 else
9626 {
9627 float quantity = floats.Get(index);
9628 SetQuantity(quantity, true, false, false, false);
9629 }
9630 index++;
9631 }
9632 //--------------------------------------------
9633 if (mask & VARIABLE_WET)
9634 {
9635 float wet = floats.Get(index);
9636 SetWet(wet);
9637 index++;
9638 }
9639 //--------------------------------------------
9640 if (mask & VARIABLE_LIQUIDTYPE)
9641 {
9642 int liquidtype = Math.Round(floats.Get(index));
9643 SetLiquidType(liquidtype);
9644 index++;
9645 }
9646 //--------------------------------------------
9647 if (mask & VARIABLE_COLOR)
9648 {
9649 m_ColorComponentR = Math.Round(floats.Get(index));
9650 index++;
9651 m_ColorComponentG = Math.Round(floats.Get(index));
9652 index++;
9653 m_ColorComponentB = Math.Round(floats.Get(index));
9654 index++;
9655 m_ColorComponentA = Math.Round(floats.Get(index));
9656 index++;
9657 }
9658 //--------------------------------------------
9659 if (mask & VARIABLE_CLEANNESS)
9660 {
9661 int cleanness = Math.Round(floats.Get(index));
9662 SetCleanness(cleanness);
9663 index++;
9664 }
9665 }
9666
9667 override void WriteVarsToCTX(ParamsWriteContext ctx)
9668 {
9669 super.WriteVarsToCTX(ctx);
9670
9671 //--------------------------------------------
9672 if (IsVariableSet(VARIABLE_QUANTITY))
9673 {
9674 ctx.Write(GetQuantity());
9675 }
9676 //--------------------------------------------
9677 if (IsVariableSet(VARIABLE_WET))
9678 {
9679 ctx.Write(GetWet());
9680 }
9681 //--------------------------------------------
9682 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
9683 {
9684 ctx.Write(GetLiquidType());
9685 }
9686 //--------------------------------------------
9687 if (IsVariableSet(VARIABLE_COLOR))
9688 {
9689 int r,g,b,a;
9690 GetColor(r,g,b,a);
9691 ctx.Write(r);
9692 ctx.Write(g);
9693 ctx.Write(b);
9694 ctx.Write(a);
9695 }
9696 //--------------------------------------------
9697 if (IsVariableSet(VARIABLE_CLEANNESS))
9698 {
9699 ctx.Write(GetCleanness());
9700 }
9701 }
9702
9703 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
9704 {
9705 if (!super.ReadVarsFromCTX(ctx,version))
9706 return false;
9707
9708 int intValue;
9709 float value;
9710
9711 if (version < 140)
9712 {
9713 if (!ctx.Read(intValue))
9714 return false;
9715
9716 m_VariablesMask = intValue;
9717 }
9718
9719 if (m_VariablesMask & VARIABLE_QUANTITY)
9720 {
9721 if (!ctx.Read(value))
9722 return false;
9723
9724 if (IsStoreLoad())
9725 {
9727 }
9728 else
9729 {
9730 SetQuantity(value, true, false, false, false);
9731 }
9732 }
9733 //--------------------------------------------
9734 if (version < 140)
9735 {
9736 if (m_VariablesMask & VARIABLE_TEMPERATURE)
9737 {
9738 if (!ctx.Read(value))
9739 return false;
9740 SetTemperatureDirect(value);
9741 }
9742 }
9743 //--------------------------------------------
9744 if (m_VariablesMask & VARIABLE_WET)
9745 {
9746 if (!ctx.Read(value))
9747 return false;
9748 SetWet(value);
9749 }
9750 //--------------------------------------------
9751 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
9752 {
9753 if (!ctx.Read(intValue))
9754 return false;
9755 SetLiquidType(intValue);
9756 }
9757 //--------------------------------------------
9758 if (m_VariablesMask & VARIABLE_COLOR)
9759 {
9760 int r,g,b,a;
9761 if (!ctx.Read(r))
9762 return false;
9763 if (!ctx.Read(g))
9764 return false;
9765 if (!ctx.Read(b))
9766 return false;
9767 if (!ctx.Read(a))
9768 return false;
9769
9770 SetColor(r,g,b,a);
9771 }
9772 //--------------------------------------------
9773 if (m_VariablesMask & VARIABLE_CLEANNESS)
9774 {
9775 if (!ctx.Read(intValue))
9776 return false;
9777 SetCleanness(intValue);
9778 }
9779 //--------------------------------------------
9780 if (version >= 138 && version < 140)
9781 {
9782 if (m_VariablesMask & VARIABLE_TEMPERATURE)
9783 {
9784 if (!ctx.Read(intValue))
9785 return false;
9786 SetFrozen(intValue);
9787 }
9788 }
9789
9790 return true;
9791 }
9792
9793 //----------------------------------------------------------------
9794 override bool OnStoreLoad(ParamsReadContext ctx, int version)
9795 {
9796 m_IsStoreLoad = true;
9798 {
9799 m_FixDamageSystemInit = true;
9800 }
9801
9802 if (!super.OnStoreLoad(ctx, version))
9803 {
9804 m_IsStoreLoad = false;
9805 return false;
9806 }
9807
9808 if (version >= 114)
9809 {
9810 bool hasQuickBarIndexSaved;
9811
9812 if (!ctx.Read(hasQuickBarIndexSaved))
9813 {
9814 m_IsStoreLoad = false;
9815 return false;
9816 }
9817
9818 if (hasQuickBarIndexSaved)
9819 {
9820 int itmQBIndex;
9821
9822 //Load quickbar item bind
9823 if (!ctx.Read(itmQBIndex))
9824 {
9825 m_IsStoreLoad = false;
9826 return false;
9827 }
9828
9829 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9830 if (itmQBIndex != -1 && parentPlayer)
9831 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9832 }
9833 }
9834 else
9835 {
9836 // Backup of how it used to be
9837 PlayerBase player;
9838 int itemQBIndex;
9839 if (version == int.MAX)
9840 {
9841 if (!ctx.Read(itemQBIndex))
9842 {
9843 m_IsStoreLoad = false;
9844 return false;
9845 }
9846 }
9847 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9848 {
9849 //Load quickbar item bind
9850 if (!ctx.Read(itemQBIndex))
9851 {
9852 m_IsStoreLoad = false;
9853 return false;
9854 }
9855 if (itemQBIndex != -1 && player)
9856 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9857 }
9858 }
9859
9860 if (version < 140)
9861 {
9862 // variable management system
9863 if (!LoadVariables(ctx, version))
9864 {
9865 m_IsStoreLoad = false;
9866 return false;
9867 }
9868 }
9869
9870 //agent trasmission system
9871 if (!LoadAgents(ctx, version))
9872 {
9873 m_IsStoreLoad = false;
9874 return false;
9875 }
9876 if (version >= 132)
9877 {
9878 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
9879 if (raib)
9880 {
9881 if (!raib.OnStoreLoad(ctx,version))
9882 {
9883 m_IsStoreLoad = false;
9884 return false;
9885 }
9886 }
9887 }
9888
9889 m_IsStoreLoad = false;
9890 return true;
9891 }
9892
9893 //----------------------------------------------------------------
9894
9895 override void OnStoreSave(ParamsWriteContext ctx)
9896 {
9897 super.OnStoreSave(ctx);
9898
9899 PlayerBase player;
9900 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9901 {
9902 ctx.Write(true); // Keep track of if we should actually read this in or not
9903 //Save quickbar item bind
9904 int itemQBIndex = -1;
9905 itemQBIndex = player.FindQuickBarEntityIndex(this);
9906 ctx.Write(itemQBIndex);
9907 }
9908 else
9909 {
9910 ctx.Write(false); // Keep track of if we should actually read this in or not
9911 }
9912
9913 SaveAgents(ctx);//agent trasmission system
9914
9915 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
9916 if (raib)
9917 {
9918 raib.OnStoreSave(ctx);
9919 }
9920 }
9921 //----------------------------------------------------------------
9922
9923 override void AfterStoreLoad()
9924 {
9925 super.AfterStoreLoad();
9926
9928 {
9930 }
9931
9932 if (GetStoreLoadedQuantity() != float.LOWEST)
9933 {
9935 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
9936 }
9937 }
9938
9939 override void EEOnAfterLoad()
9940 {
9941 super.EEOnAfterLoad();
9942
9944 {
9945 m_FixDamageSystemInit = false;
9946 }
9947
9950 }
9951
9952 bool CanBeDisinfected()
9953 {
9954 return false;
9955 }
9956
9957
9958 //----------------------------------------------------------------
9959 override void OnVariablesSynchronized()
9960 {
9961 if (m_Initialized)
9962 {
9963 #ifdef PLATFORM_CONSOLE
9964 //bruteforce it is
9965 if (IsSplitable())
9966 {
9967 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
9968 if (menu)
9969 {
9970 menu.Refresh();
9971 }
9972 }
9973 #endif
9974 }
9975
9977 {
9978 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9979 m_WantPlayImpactSound = false;
9980 }
9981
9983 {
9984 SetWeightDirty();
9986 }
9987 if (m_VarWet != m_VarWetPrev)
9988 {
9991 }
9992
9993 if (m_SoundSyncPlay != 0)
9994 {
9995 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
9996 m_SoundSyncPlay = 0;
9997 }
9998 if (m_SoundSyncStop != 0)
9999 {
10000 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
10001 m_SoundSyncStop = 0;
10002 }
10003
10004 super.OnVariablesSynchronized();
10005 }
10006
10007 //------------------------- Quantity
10008 //----------------------------------------------------------------
10010 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
10011 {
10012 if (!IsServerCheck(allow_client))
10013 return false;
10014
10015 if (!HasQuantity())
10016 return false;
10017
10018 float min = GetQuantityMin();
10019 float max = GetQuantityMax();
10020
10021 if (value <= (min + 0.001))
10022 value = min;
10023
10024 if (value == min)
10025 {
10026 if (destroy_config)
10027 {
10028 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10029 if (dstr)
10030 {
10031 m_VarQuantity = Math.Clamp(value, min, max);
10032 this.Delete();
10033 return true;
10034 }
10035 }
10036 else if (destroy_forced)
10037 {
10038 m_VarQuantity = Math.Clamp(value, min, max);
10039 this.Delete();
10040 return true;
10041 }
10042 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
10043 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
10044 }
10045
10046 float delta = m_VarQuantity;
10047 m_VarQuantity = Math.Clamp(value, min, max);
10048
10049 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
10050 {
10051 delta = m_VarQuantity - delta;
10052
10053 if (delta)
10054 OnQuantityChanged(delta);
10055 }
10056
10057 SetVariableMask(VARIABLE_QUANTITY);
10058
10059 return false;
10060 }
10061
10062 //----------------------------------------------------------------
10064 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
10065 {
10066 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
10067 }
10068 //----------------------------------------------------------------
10069 void SetQuantityMax()
10070 {
10071 float max = GetQuantityMax();
10072 SetQuantity(max);
10073 }
10074
10075 override void SetQuantityToMinimum()
10076 {
10077 float min = GetQuantityMin();
10078 SetQuantity(min);
10079 }
10080 //----------------------------------------------------------------
10082 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
10083 {
10084 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
10085 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
10086 SetQuantity(result, destroy_config, destroy_forced);
10087 }
10088
10089 //----------------------------------------------------------------
10091 override float GetQuantityNormalized()
10092 {
10093 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
10094 }
10095
10097 {
10098 return GetQuantityNormalized();
10099 }
10100
10101 /*void SetAmmoNormalized(float value)
10102 {
10103 float value_clamped = Math.Clamp(value, 0, 1);
10104 Magazine this_mag = Magazine.Cast(this);
10105 int max_rounds = this_mag.GetAmmoMax();
10106 int result = value * max_rounds;//can the rounded if higher precision is required
10107 this_mag.SetAmmoCount(result);
10108 }*/
10109 //----------------------------------------------------------------
10110 override int GetQuantityMax()
10111 {
10112 int slot = -1;
10113 if (GetInventory())
10114 {
10115 InventoryLocation il = new InventoryLocation;
10116 GetInventory().GetCurrentInventoryLocation(il);
10117 slot = il.GetSlot();
10118 }
10119
10120 return GetTargetQuantityMax(slot);
10121 }
10122
10123 override int GetTargetQuantityMax(int attSlotID = -1)
10124 {
10125 float quantity_max = 0;
10126
10127 if (IsSplitable()) //only stackable/splitable items can check for stack size
10128 {
10129 if (attSlotID != -1)
10130 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10131
10132 if (quantity_max <= 0)
10133 quantity_max = m_VarStackMax;
10134 }
10135
10136 if (quantity_max <= 0)
10137 quantity_max = m_VarQuantityMax;
10138
10139 return quantity_max;
10140 }
10141 //----------------------------------------------------------------
10142 override int GetQuantityMin()
10143 {
10144 return m_VarQuantityMin;
10145 }
10146 //----------------------------------------------------------------
10147 int GetQuantityInit()
10148 {
10149 return m_VarQuantityInit;
10150 }
10151
10152 //----------------------------------------------------------------
10153 override bool HasQuantity()
10154 {
10155 return !(GetQuantityMax() - GetQuantityMin() == 0);
10156 }
10157
10158 override float GetQuantity()
10159 {
10160 return m_VarQuantity;
10161 }
10162
10163 bool IsFullQuantity()
10164 {
10165 return GetQuantity() >= GetQuantityMax();
10166 }
10167
10168 //Calculates weight of single item without attachments and cargo
10169 override float GetSingleInventoryItemWeightEx()
10170 {
10171 //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
10172 float weightEx = GetWeightEx();//overall weight of the item
10173 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
10174 return weightEx - special;
10175 }
10176
10177 // Obsolete, use GetSingleInventoryItemWeightEx() instead
10179 {
10181 }
10182
10183 override protected float GetWeightSpecialized(bool forceRecalc = false)
10184 {
10185 if (IsSplitable()) //quantity determines size of the stack
10186 {
10187 #ifdef DEVELOPER
10188 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10189 {
10190 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10191 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
10192 }
10193 #endif
10194
10195 return GetQuantity() * GetConfigWeightModified();
10196 }
10197 else if (HasEnergyManager())// items with energy manager
10198 {
10199 #ifdef DEVELOPER
10200 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10201 {
10202 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10203 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
10204 }
10205 #endif
10206 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10207 }
10208 else//everything else
10209 {
10210 #ifdef DEVELOPER
10211 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10212 {
10213 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10214 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
10215 }
10216 #endif
10217 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10218 }
10219 }
10220
10222 int GetNumberOfItems()
10223 {
10224 int item_count = 0;
10225 ItemBase item;
10226
10227 if (GetInventory().GetCargo() != NULL)
10228 {
10229 item_count = GetInventory().GetCargo().GetItemCount();
10230 }
10231
10232 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10233 {
10234 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10235 if (item)
10236 item_count += item.GetNumberOfItems();
10237 }
10238 return item_count;
10239 }
10240
10242 float GetUnitWeight(bool include_wetness = true)
10243 {
10244 float weight = 0;
10245 float wetness = 1;
10246 if (include_wetness)
10247 wetness += GetWet();
10248 if (IsSplitable()) //quantity determines size of the stack
10249 {
10250 weight = wetness * m_ConfigWeight;
10251 }
10252 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
10253 {
10254 weight = 1;
10255 }
10256 return weight;
10257 }
10258
10259 //-----------------------------------------------------------------
10260
10261 override void ClearInventory()
10262 {
10263 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
10264 {
10265 GameInventory inv = GetInventory();
10266 array<EntityAI> items = new array<EntityAI>;
10267 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
10268 for (int i = 0; i < items.Count(); i++)
10269 {
10270 ItemBase item = ItemBase.Cast(items.Get(i));
10271 if (item)
10272 {
10273 GetGame().ObjectDelete(item);
10274 }
10275 }
10276 }
10277 }
10278
10279 //------------------------- Energy
10280
10281 //----------------------------------------------------------------
10282 float GetEnergy()
10283 {
10284 float energy = 0;
10285 if (HasEnergyManager())
10286 {
10287 energy = GetCompEM().GetEnergy();
10288 }
10289 return energy;
10290 }
10291
10292
10293 override void OnEnergyConsumed()
10294 {
10295 super.OnEnergyConsumed();
10296
10298 }
10299
10300 override void OnEnergyAdded()
10301 {
10302 super.OnEnergyAdded();
10303
10305 }
10306
10307 // Converts energy (from Energy Manager) to quantity, if enabled.
10309 {
10310 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10311 {
10312 if (HasQuantity())
10313 {
10314 float energy_0to1 = GetCompEM().GetEnergy0To1();
10315 SetQuantityNormalized(energy_0to1);
10316 }
10317 }
10318 }
10319
10320 //----------------------------------------------------------------
10321 float GetHeatIsolationInit()
10322 {
10323 return ConfigGetFloat("heatIsolation");
10324 }
10325
10326 float GetHeatIsolation()
10327 {
10328 return m_HeatIsolation;
10329 }
10330
10331 float GetDryingIncrement(string pIncrementName)
10332 {
10333 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
10334 if (GetGame().ConfigIsExisting(paramPath))
10335 return GetGame().ConfigGetFloat(paramPath);
10336
10337 return 0.0;
10338 }
10339
10340 float GetSoakingIncrement(string pIncrementName)
10341 {
10342 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
10343 if (GetGame().ConfigIsExisting(paramPath))
10344 return GetGame().ConfigGetFloat(paramPath);
10345
10346 return 0.0;
10347 }
10348 //----------------------------------------------------------------
10349 override void SetWet(float value, bool allow_client = false)
10350 {
10351 if (!IsServerCheck(allow_client))
10352 return;
10353
10354 float min = GetWetMin();
10355 float max = GetWetMax();
10356
10357 float previousValue = m_VarWet;
10358
10359 m_VarWet = Math.Clamp(value, min, max);
10360
10361 if (previousValue != m_VarWet)
10362 {
10363 SetVariableMask(VARIABLE_WET);
10364 OnWetChanged(m_VarWet, previousValue);
10365 }
10366 }
10367 //----------------------------------------------------------------
10368 override void AddWet(float value)
10369 {
10370 SetWet(GetWet() + value);
10371 }
10372 //----------------------------------------------------------------
10373 override void SetWetMax()
10374 {
10376 }
10377 //----------------------------------------------------------------
10378 override float GetWet()
10379 {
10380 return m_VarWet;
10381 }
10382 //----------------------------------------------------------------
10383 override float GetWetMax()
10384 {
10385 return m_VarWetMax;
10386 }
10387 //----------------------------------------------------------------
10388 override float GetWetMin()
10389 {
10390 return m_VarWetMin;
10391 }
10392 //----------------------------------------------------------------
10393 override float GetWetInit()
10394 {
10395 return m_VarWetInit;
10396 }
10397 //----------------------------------------------------------------
10398 override void OnWetChanged(float newVal, float oldVal)
10399 {
10400 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
10401 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
10402 if (newLevel != oldLevel)
10403 {
10404 OnWetLevelChanged(newLevel,oldLevel);
10405 }
10406 }
10407
10408 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
10409 {
10410 SetWeightDirty();
10411 }
10412
10413 override EWetnessLevel GetWetLevel()
10414 {
10415 return GetWetLevelInternal(m_VarWet);
10416 }
10417
10418 //----------------------------------------------------------------
10419
10420 override void SetStoreLoad(bool value)
10421 {
10422 m_IsStoreLoad = value;
10423 }
10424
10425 override bool IsStoreLoad()
10426 {
10427 return m_IsStoreLoad;
10428 }
10429
10430 override void SetStoreLoadedQuantity(float value)
10431 {
10432 m_StoreLoadedQuantity = value;
10433 }
10434
10435 override float GetStoreLoadedQuantity()
10436 {
10437 return m_StoreLoadedQuantity;
10438 }
10439
10440 //----------------------------------------------------------------
10441
10442 float GetItemModelLength()
10443 {
10444 if (ConfigIsExisting("itemModelLength"))
10445 {
10446 return ConfigGetFloat("itemModelLength");
10447 }
10448 return 0;
10449 }
10450
10451 float GetItemAttachOffset()
10452 {
10453 if (ConfigIsExisting("itemAttachOffset"))
10454 {
10455 return ConfigGetFloat("itemAttachOffset");
10456 }
10457 return 0;
10458 }
10459
10460 override void SetCleanness(int value, bool allow_client = false)
10461 {
10462 if (!IsServerCheck(allow_client))
10463 return;
10464
10465 int previousValue = m_Cleanness;
10466
10467 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
10468
10469 if (previousValue != m_Cleanness)
10470 SetVariableMask(VARIABLE_CLEANNESS);
10471 }
10472
10473 override int GetCleanness()
10474 {
10475 return m_Cleanness;
10476 }
10477
10479 {
10480 return true;
10481 }
10482
10483 //----------------------------------------------------------------
10484 // ATTACHMENT LOCKING
10485 // Getters relevant to generic ActionLockAttachment
10486 int GetLockType()
10487 {
10488 return m_LockType;
10489 }
10490
10491 string GetLockSoundSet()
10492 {
10493 return m_LockSoundSet;
10494 }
10495
10496 //----------------------------------------------------------------
10497 //------------------------- Color
10498 // sets items color variable given color components
10499 override void SetColor(int r, int g, int b, int a)
10500 {
10505 SetVariableMask(VARIABLE_COLOR);
10506 }
10508 override void GetColor(out int r,out int g,out int b,out int a)
10509 {
10514 }
10515
10516 bool IsColorSet()
10517 {
10518 return IsVariableSet(VARIABLE_COLOR);
10519 }
10520
10522 string GetColorString()
10523 {
10524 int r,g,b,a;
10525 GetColor(r,g,b,a);
10526 r = r/255;
10527 g = g/255;
10528 b = b/255;
10529 a = a/255;
10530 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10531 }
10532 //----------------------------------------------------------------
10533 //------------------------- LiquidType
10534
10535 override void SetLiquidType(int value, bool allow_client = false)
10536 {
10537 if (!IsServerCheck(allow_client))
10538 return;
10539
10540 int old = m_VarLiquidType;
10541 m_VarLiquidType = value;
10542 OnLiquidTypeChanged(old,value);
10543 SetVariableMask(VARIABLE_LIQUIDTYPE);
10544 }
10545
10546 int GetLiquidTypeInit()
10547 {
10548 return ConfigGetInt("varLiquidTypeInit");
10549 }
10550
10551 override int GetLiquidType()
10552 {
10553 return m_VarLiquidType;
10554 }
10555
10556 protected void OnLiquidTypeChanged(int oldType, int newType)
10557 {
10558 if (newType == LIQUID_NONE && GetIsFrozen())
10559 SetFrozen(false);
10560 }
10561
10563 void UpdateQuickbarShortcutVisibility(PlayerBase player)
10564 {
10565 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10566 }
10567
10568 // -------------------------------------------------------------------------
10570 void OnInventoryEnter(Man player)
10571 {
10572 PlayerBase nplayer;
10573 if (PlayerBase.CastTo(nplayer, player))
10574 {
10575 m_CanPlayImpactSound = true;
10576 //nplayer.OnItemInventoryEnter(this);
10577 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10578 }
10579 }
10580
10581 // -------------------------------------------------------------------------
10583 void OnInventoryExit(Man player)
10584 {
10585 PlayerBase nplayer;
10586 if (PlayerBase.CastTo(nplayer,player))
10587 {
10588 //nplayer.OnItemInventoryExit(this);
10589 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10590
10591 }
10592
10593 //if (!GetGame().IsDedicatedServer())
10594 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10595
10596
10597 if (HasEnergyManager())
10598 {
10599 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
10600 }
10601 }
10602
10603 // ADVANCED PLACEMENT EVENTS
10604 override void OnPlacementStarted(Man player)
10605 {
10606 super.OnPlacementStarted(player);
10607
10608 SetTakeable(false);
10609 }
10610
10611 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
10612 {
10613 if (m_AdminLog)
10614 {
10615 m_AdminLog.OnPlacementComplete(player, this);
10616 }
10617
10618 super.OnPlacementComplete(player, position, orientation);
10619 }
10620
10621 //-----------------------------
10622 // AGENT SYSTEM
10623 //-----------------------------
10624 //--------------------------------------------------------------------------
10625 bool ContainsAgent(int agent_id)
10626 {
10627 if (agent_id & m_AttachedAgents)
10628 {
10629 return true;
10630 }
10631 else
10632 {
10633 return false;
10634 }
10635 }
10636
10637 //--------------------------------------------------------------------------
10638 override void RemoveAgent(int agent_id)
10639 {
10640 if (ContainsAgent(agent_id))
10641 {
10642 m_AttachedAgents = ~agent_id & m_AttachedAgents;
10643 }
10644 }
10645
10646 //--------------------------------------------------------------------------
10647 override void RemoveAllAgents()
10648 {
10649 m_AttachedAgents = 0;
10650 }
10651 //--------------------------------------------------------------------------
10652 override void RemoveAllAgentsExcept(int agent_to_keep)
10653 {
10654 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
10655 }
10656 // -------------------------------------------------------------------------
10657 override void InsertAgent(int agent, float count = 1)
10658 {
10659 if (count < 1)
10660 return;
10661 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
10663 }
10664
10666 void TransferAgents(int agents)
10667 {
10669 }
10670
10671 // -------------------------------------------------------------------------
10672 override int GetAgents()
10673 {
10674 return m_AttachedAgents;
10675 }
10676 //----------------------------------------------------------------------
10677
10678 /*int GetContaminationType()
10679 {
10680 int contamination_type;
10681
10682 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
10683 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
10684 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
10685 const int DIRTY_MASK = eAgents.WOUND_AGENT;
10686
10687 Edible_Base edible = Edible_Base.Cast(this);
10688 int agents = GetAgents();
10689 if (edible)
10690 {
10691 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
10692 if (profile)
10693 {
10694 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
10695 }
10696 }
10697 if (agents & CONTAMINATED_MASK)
10698 {
10699 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
10700 }
10701 if (agents & POISONED_MASK)
10702 {
10703 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
10704 }
10705 if (agents & NERVE_GAS_MASK)
10706 {
10707 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
10708 }
10709 if (agents & DIRTY_MASK)
10710 {
10711 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
10712 }
10713
10714 return agents;
10715 }*/
10716
10717 // -------------------------------------------------------------------------
10718 bool LoadAgents(ParamsReadContext ctx, int version)
10719 {
10720 if (!ctx.Read(m_AttachedAgents))
10721 return false;
10722 return true;
10723 }
10724 // -------------------------------------------------------------------------
10726 {
10727
10729 }
10730 // -------------------------------------------------------------------------
10731
10733 override void CheckForRoofLimited(float timeTresholdMS = 3000)
10734 {
10735 super.CheckForRoofLimited(timeTresholdMS);
10736
10737 float time = GetGame().GetTime();
10738 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10739 {
10740 m_PreviousRoofTestTime = time;
10741 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10742 }
10743 }
10744
10745 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
10746 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
10747 {
10748 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
10749 {
10750 return 0;
10751 }
10752
10753 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
10754 {
10755 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
10756 if (filter)
10757 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
10758 else
10759 return 0;//otherwise return 0 when no filter attached
10760 }
10761
10762 string subclassPath, entryName;
10763
10764 switch (type)
10765 {
10766 case DEF_BIOLOGICAL:
10767 entryName = "biological";
10768 break;
10769 case DEF_CHEMICAL:
10770 entryName = "chemical";
10771 break;
10772 default:
10773 entryName = "biological";
10774 break;
10775 }
10776
10777 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
10778
10779 return GetGame().ConfigGetFloat(subclassPath + entryName);
10780 }
10781
10782
10783
10785 override void EEOnCECreate()
10786 {
10787 if (!IsMagazine())
10789
10791 }
10792
10793
10794 //-------------------------
10795 // OPEN/CLOSE USER ACTIONS
10796 //-------------------------
10798 void Open();
10799 void Close();
10800 bool IsOpen()
10801 {
10802 return true;
10803 }
10804
10805 override bool CanDisplayCargo()
10806 {
10807 return IsOpen();
10808 }
10809
10810
10811 // ------------------------------------------------------------
10812 // CONDITIONS
10813 // ------------------------------------------------------------
10814 override bool CanPutInCargo(EntityAI parent)
10815 {
10816 if (parent)
10817 {
10818 if (parent.IsInherited(DayZInfected))
10819 return true;
10820
10821 if (!parent.IsRuined())
10822 return true;
10823 }
10824
10825 return true;
10826 }
10827
10828 override bool CanPutAsAttachment(EntityAI parent)
10829 {
10830 if (!super.CanPutAsAttachment(parent))
10831 {
10832 return false;
10833 }
10834
10835 if (!IsRuined() && !parent.IsRuined())
10836 {
10837 return true;
10838 }
10839
10840 return false;
10841 }
10842
10843 override bool CanReceiveItemIntoCargo(EntityAI item)
10844 {
10845 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
10846 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
10847 // return false;
10848
10849 return super.CanReceiveItemIntoCargo(item);
10850 }
10851
10852 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
10853 {
10854 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
10855 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
10856 // return false;
10857
10858 GameInventory attachmentInv = attachment.GetInventory();
10859 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
10860 {
10861 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10862 return false;
10863 }
10864
10865 InventoryLocation loc = new InventoryLocation();
10866 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10867 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
10868 return false;
10869
10870 return super.CanReceiveAttachment(attachment, slotId);
10871 }
10872
10873 override bool CanReleaseAttachment(EntityAI attachment)
10874 {
10875 if (!super.CanReleaseAttachment(attachment))
10876 return false;
10877
10878 return GetInventory().AreChildrenAccessible();
10879 }
10880
10881 /*override bool CanLoadAttachment(EntityAI attachment)
10882 {
10883 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
10884 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
10885 // return false;
10886
10887 GameInventory attachmentInv = attachment.GetInventory();
10888 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
10889 {
10890 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
10891 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
10892
10893 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10894 return false;
10895 }
10896
10897 return super.CanLoadAttachment(attachment);
10898 }*/
10899
10900 // Plays muzzle flash particle effects
10901 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10902 {
10903 int id = muzzle_owner.GetMuzzleID();
10904 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
10905
10906 if (WPOF_array)
10907 {
10908 for (int i = 0; i < WPOF_array.Count(); i++)
10909 {
10910 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10911
10912 if (WPOF)
10913 {
10914 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10915 }
10916 }
10917 }
10918 }
10919
10920 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
10921 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10922 {
10923 int id = muzzle_owner.GetMuzzleID();
10924 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
10925
10926 if (WPOBE_array)
10927 {
10928 for (int i = 0; i < WPOBE_array.Count(); i++)
10929 {
10930 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10931
10932 if (WPOBE)
10933 {
10934 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10935 }
10936 }
10937 }
10938 }
10939
10940 // Plays all weapon overheating particles
10941 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10942 {
10943 int id = muzzle_owner.GetMuzzleID();
10944 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10945
10946 if (WPOOH_array)
10947 {
10948 for (int i = 0; i < WPOOH_array.Count(); i++)
10949 {
10950 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10951
10952 if (WPOOH)
10953 {
10954 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10955 }
10956 }
10957 }
10958 }
10959
10960 // Updates all weapon overheating particles
10961 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10962 {
10963 int id = muzzle_owner.GetMuzzleID();
10964 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10965
10966 if (WPOOH_array)
10967 {
10968 for (int i = 0; i < WPOOH_array.Count(); i++)
10969 {
10970 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10971
10972 if (WPOOH)
10973 {
10974 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10975 }
10976 }
10977 }
10978 }
10979
10980 // Stops overheating particles
10981 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10982 {
10983 int id = muzzle_owner.GetMuzzleID();
10984 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10985
10986 if (WPOOH_array)
10987 {
10988 for (int i = 0; i < WPOOH_array.Count(); i++)
10989 {
10990 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10991
10992 if (WPOOH)
10993 {
10994 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10995 }
10996 }
10997 }
10998 }
10999
11000 //----------------------------------------------------------------
11001 //Item Behaviour - unified approach
11002 override bool IsHeavyBehaviour()
11003 {
11004 if (m_ItemBehaviour == 0)
11005 {
11006 return true;
11007 }
11008
11009 return false;
11010 }
11011
11012 override bool IsOneHandedBehaviour()
11013 {
11014 if (m_ItemBehaviour == 1)
11015 {
11016 return true;
11017 }
11018
11019 return false;
11020 }
11021
11022 override bool IsTwoHandedBehaviour()
11023 {
11024 if (m_ItemBehaviour == 2)
11025 {
11026 return true;
11027 }
11028
11029 return false;
11030 }
11031
11032 bool IsDeployable()
11033 {
11034 return false;
11035 }
11036
11038 float GetDeployTime()
11039 {
11040 return UATimeSpent.DEFAULT_DEPLOY;
11041 }
11042
11043
11044 //----------------------------------------------------------------
11045 // Item Targeting (User Actions)
11046 override void SetTakeable(bool pState)
11047 {
11048 m_IsTakeable = pState;
11049 SetSynchDirty();
11050 }
11051
11052 override bool IsTakeable()
11053 {
11054 return m_IsTakeable;
11055 }
11056
11057 // For cases where we want to show object widget which cant be taken to hands
11059 {
11060 return false;
11061 }
11062
11064 protected void PreLoadSoundAttachmentType()
11065 {
11066 string att_type = "None";
11067
11068 if (ConfigIsExisting("soundAttType"))
11069 {
11070 att_type = ConfigGetString("soundAttType");
11071 }
11072
11073 m_SoundAttType = att_type;
11074 }
11075
11076 override string GetAttachmentSoundType()
11077 {
11078 return m_SoundAttType;
11079 }
11080
11081 //----------------------------------------------------------------
11082 //SOUNDS - ItemSoundHandler
11083 //----------------------------------------------------------------
11084
11085 string GetPlaceSoundset(); // played when deploy starts
11086 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
11087 string GetDeploySoundset(); // played when deploy sucessfully finishes
11088
11090 {
11091 if (!m_ItemSoundHandler)
11093
11094 return m_ItemSoundHandler;
11095 }
11096
11097 // override to initialize sounds
11098 protected void InitItemSounds()
11099 {
11100 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
11101 return;
11102
11104
11105 if (GetPlaceSoundset() != string.Empty)
11106 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
11107
11108 if (GetDeploySoundset() != string.Empty)
11109 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
11110
11111 SoundParameters params = new SoundParameters();
11112 params.m_Loop = true;
11113 if (GetLoopDeploySoundset() != string.Empty)
11114 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
11115 }
11116
11117 // Start sound using ItemSoundHandler
11118 void StartItemSoundServer(int id)
11119 {
11120 if (!GetGame().IsServer())
11121 return;
11122
11123 m_SoundSyncPlay = id;
11124 SetSynchDirty();
11125
11126 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
11128 }
11129
11130 // Stop sound using ItemSoundHandler
11131 void StopItemSoundServer(int id)
11132 {
11133 if (!GetGame().IsServer())
11134 return;
11135
11136 m_SoundSyncStop = id;
11137 SetSynchDirty();
11138
11139 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
11141 }
11142
11143 protected void ClearStartItemSoundServer()
11144 {
11145 m_SoundSyncPlay = 0;
11146 }
11147
11148 protected void ClearStopItemSoundServer()
11149 {
11150 m_SoundSyncStop = 0;
11151 }
11152
11154 void PlayAttachSound(string slot_type)
11155 {
11156 if (!GetGame().IsDedicatedServer())
11157 {
11158 if (ConfigIsExisting("attachSoundSet"))
11159 {
11160 string cfg_path = "";
11161 string soundset = "";
11162 string type_name = GetType();
11163
11164 TStringArray cfg_soundset_array = new TStringArray;
11165 TStringArray cfg_slot_array = new TStringArray;
11166 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11167 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11168
11169 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11170 {
11171 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11172 {
11173 if (cfg_slot_array[i] == slot_type)
11174 {
11175 soundset = cfg_soundset_array[i];
11176 break;
11177 }
11178 }
11179 }
11180
11181 if (soundset != "")
11182 {
11183 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
11184 sound.SetAutodestroy(true);
11185 }
11186 }
11187 }
11188 }
11189
11190 void PlayDetachSound(string slot_type)
11191 {
11192 //TODO - evaluate if needed and devise universal config structure if so
11193 }
11194
11195 void OnApply(PlayerBase player);
11196
11198 {
11199 return 1.0;
11200 };
11201 //returns applicable selection
11202 array<string> GetHeadHidingSelection()
11203 {
11205 }
11206
11208 {
11210 }
11211
11212 WrittenNoteData GetWrittenNoteData() {};
11213
11215 {
11216 SetDynamicPhysicsLifeTime(0.01);
11217 m_ItemBeingDroppedPhys = false;
11218 }
11219
11221 {
11222 array<string> zone_names = new array<string>;
11223 GetDamageZones(zone_names);
11224 for (int i = 0; i < zone_names.Count(); i++)
11225 {
11226 SetHealthMax(zone_names.Get(i),"Health");
11227 }
11228 SetHealthMax("","Health");
11229 }
11230
11232 void SetZoneDamageCEInit()
11233 {
11234 float global_health = GetHealth01("","Health");
11235 array<string> zones = new array<string>;
11236 GetDamageZones(zones);
11237 //set damage of all zones to match global health level
11238 for (int i = 0; i < zones.Count(); i++)
11239 {
11240 SetHealth01(zones.Get(i),"Health",global_health);
11241 }
11242 }
11243
11245 bool IsCoverFaceForShave(string slot_name)
11246 {
11247 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11248 }
11249
11250 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
11251 {
11252 if (!hasRootAsPlayer)
11253 {
11254 if (refParentIB)
11255 {
11256 // parent is wet
11257 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
11258 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11259 // parent has liquid inside
11260 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
11261 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11262 // drying
11263 else if (m_VarWet > m_VarWetMin)
11264 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
11265 }
11266 else
11267 {
11268 // drying on ground or inside non-itembase (car, ...)
11269 if (m_VarWet > m_VarWetMin)
11270 AddWet(-1 * delta * GetDryingIncrement("ground"));
11271 }
11272 }
11273 }
11274
11275 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
11276 {
11278 {
11279 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
11280 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11281 {
11282 float heatPermCoef = 1.0;
11283 EntityAI ent = this;
11284 while (ent)
11285 {
11286 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11287 ent = ent.GetHierarchyParent();
11288 }
11289
11290 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11291 }
11292 }
11293 }
11294
11295 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
11296 {
11297 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
11298 EntityAI parent = GetHierarchyParent();
11299 if (!parent)
11300 {
11301 hasParent = false;
11302 hasRootAsPlayer = false;
11303 }
11304 else
11305 {
11306 hasParent = true;
11307 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11308 refParentIB = ItemBase.Cast(parent);
11309 }
11310 }
11311
11312 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
11313 {
11314 // this is stub, implemented on Edible_Base
11315 }
11316
11317 bool CanDecay()
11318 {
11319 // return true used on selected food clases so they can decay
11320 return false;
11321 }
11322
11323 protected bool CanProcessDecay()
11324 {
11325 // this is stub, implemented on Edible_Base class
11326 // used to determine whether it is still necessary for the food to decay
11327 return false;
11328 }
11329
11330 protected bool CanHaveWetness()
11331 {
11332 // return true used on selected items that have a wetness effect
11333 return false;
11334 }
11335
11337 bool CanBeConsumed(ConsumeConditionData data = null)
11338 {
11339 return !GetIsFrozen() && IsOpen();
11340 }
11341
11342 override void ProcessVariables()
11343 {
11344 bool hasParent = false, hasRootAsPlayer = false;
11345 ItemBase refParentIB;
11346
11347 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
11348 bool foodDecay = g_Game.IsFoodDecayEnabled();
11349
11350 if (wwtu || foodDecay)
11351 {
11352 bool processWetness = wwtu && CanHaveWetness();
11353 bool processTemperature = wwtu && CanHaveTemperature();
11354 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
11355
11356 if (processWetness || processTemperature || processDecay)
11357 {
11358 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
11359
11360 if (processWetness)
11361 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11362
11363 if (processTemperature)
11364 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11365
11366 if (processDecay)
11367 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11368 }
11369 }
11370 }
11371
11374 {
11375 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
11376 }
11377
11378 override float GetTemperatureFreezeThreshold()
11379 {
11381 return Liquid.GetFreezeThreshold(GetLiquidType());
11382
11383 return super.GetTemperatureFreezeThreshold();
11384 }
11385
11386 override float GetTemperatureThawThreshold()
11387 {
11389 return Liquid.GetThawThreshold(GetLiquidType());
11390
11391 return super.GetTemperatureThawThreshold();
11392 }
11393
11394 override float GetItemOverheatThreshold()
11395 {
11397 return Liquid.GetBoilThreshold(GetLiquidType());
11398
11399 return super.GetItemOverheatThreshold();
11400 }
11401
11402 override float GetTemperatureFreezeTime()
11403 {
11404 if (HasQuantity())
11405 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
11406
11407 return super.GetTemperatureFreezeTime();
11408 }
11409
11410 override float GetTemperatureThawTime()
11411 {
11412 if (HasQuantity())
11413 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
11414
11415 return super.GetTemperatureThawTime();
11416 }
11417
11419 void AffectLiquidContainerOnFill(int liquid_type, float amount);
11421 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
11422
11423 bool IsCargoException4x3(EntityAI item)
11424 {
11425 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11426 }
11427
11429 {
11430 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11431 }
11432
11434 void AddLightSourceItem(ItemBase lightsource)
11435 {
11436 m_LightSourceItem = lightsource;
11437 }
11438
11440 {
11441 m_LightSourceItem = null;
11442 }
11443
11445 {
11446 return m_LightSourceItem;
11447 }
11448
11450 array<int> GetValidFinishers()
11451 {
11452 return null;
11453 }
11454
11456 bool GetActionWidgetOverride(out typename name)
11457 {
11458 return false;
11459 }
11460
11461 bool PairWithDevice(notnull ItemBase otherDevice)
11462 {
11463 if (GetGame().IsServer())
11464 {
11465 ItemBase explosive = otherDevice;
11467 if (!trg)
11468 {
11469 trg = RemoteDetonatorTrigger.Cast(otherDevice);
11470 explosive = this;
11471 }
11472
11473 explosive.PairRemote(trg);
11474 trg.SetControlledDevice(explosive);
11475
11476 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11477 trg.SetPersistentPairID(persistentID);
11478 explosive.SetPersistentPairID(persistentID);
11479
11480 return true;
11481 }
11482 return false;
11483 }
11484
11486 float GetBaitEffectivity()
11487 {
11488 float ret = 1.0;
11489 if (HasQuantity())
11490 ret *= GetQuantityNormalized();
11491 ret *= GetHealth01();
11492
11493 return ret;
11494 }
11495
11496 #ifdef DEVELOPER
11497 override void SetDebugItem()
11498 {
11499 super.SetDebugItem();
11500 _itemBase = this;
11501 }
11502
11503 override string GetDebugText()
11504 {
11505 string text = super.GetDebugText();
11506
11507 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
11508 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
11509
11510 return text;
11511 }
11512 #endif
11513
11514 bool CanBeUsedForSuicide()
11515 {
11516 return true;
11517 }
11518
11520 //DEPRECATED BELOW
11522 // Backwards compatibility
11523 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
11524 {
11525 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
11526 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
11527 }
11528
11529 // replaced by ItemSoundHandler
11530 protected EffectSound m_SoundDeployFinish;
11531 protected EffectSound m_SoundPlace;
11532 protected EffectSound m_DeployLoopSoundEx;
11533 protected EffectSound m_SoundDeploy;
11534 bool m_IsPlaceSound;
11535 bool m_IsDeploySound;
11537
11538 string GetDeployFinishSoundset();
11539 void PlayDeploySound();
11540 void PlayDeployFinishSound();
11541 void PlayPlaceSound();
11542 void PlayDeployLoopSoundEx();
11543 void StopDeployLoopSoundEx();
11544 void SoundSynchRemoteReset();
11545 void SoundSynchRemote();
11546 bool UsesGlobalDeploy(){return false;}
11547 bool CanPlayDeployLoopSound(){return false;}
11549 bool IsPlaceSound(){return m_IsPlaceSound;}
11550 bool IsDeploySound(){return m_IsDeploySound;}
11551 void SetIsPlaceSound(bool is_place_sound);
11552 void SetIsDeploySound(bool is_deploy_sound);
11553}
11554
11555EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
11556{
11557 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
11558 if (entity)
11559 {
11560 bool is_item = entity.IsInherited(ItemBase);
11561 if (is_item && full_quantity)
11562 {
11563 ItemBase item = ItemBase.Cast(entity);
11564 item.SetQuantity(item.GetQuantityInit());
11565 }
11566 }
11567 else
11568 {
11569 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
11570 return NULL;
11571 }
11572 return entity;
11573}
11574
11575void SetupSpawnedItem(ItemBase item, float health, float quantity)
11576{
11577 if (item)
11578 {
11579 if (health > 0)
11580 item.SetHealth("", "", health);
11581
11582 if (item.CanHaveTemperature())
11583 {
11584 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
11585 if (item.CanFreeze())
11586 item.SetFrozen(false);
11587 }
11588
11589 if (item.HasEnergyManager())
11590 {
11591 if (quantity >= 0)
11592 {
11593 item.GetCompEM().SetEnergy0To1(quantity);
11594 }
11595 else
11596 {
11597 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
11598 }
11599 }
11600 else if (item.IsMagazine())
11601 {
11602 Magazine mag = Magazine.Cast(item);
11603 if (quantity >= 0)
11604 {
11605 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11606 }
11607 else
11608 {
11609 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
11610 }
11611
11612 }
11613 else
11614 {
11615 if (quantity >= 0)
11616 {
11617 item.SetQuantityNormalized(quantity, false);
11618 }
11619 else
11620 {
11621 item.SetQuantity(Math.AbsFloat(quantity));
11622 }
11623
11624 }
11625 }
11626}
11627
11628#ifdef DEVELOPER
11629ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
11630#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()

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