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

◆ GetDebugActions()

override void SpawnItemOnLocation::GetDebugActions ( out TSelectableActionInfoArrayEx outputList)
protected

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

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