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

◆ SplitItem()

void SpawnItemOnLocation::SplitItem ( PlayerBase player)
private

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

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