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

◆ OnAttachmentQuantityChanged()

void SpawnItemOnLocation::OnAttachmentQuantityChanged ( ItemBase item)
private

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

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

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