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

◆ OnRightClick()

override void SpawnItemOnLocation::OnRightClick ( )
private

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

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