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

◆ EEHealthLevelChanged()

override void SpawnItemOnLocation::EEHealthLevelChanged ( int oldLevel,
int newLevel,
string zone )
private

drops content of container when ruined in fireplace

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

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