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

◆ CanBeCombined()

override bool SpawnItemOnLocation::CanBeCombined ( EntityAI other_item,
bool reservation_check = true,
bool stack_max_limit = false )
private

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

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