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

◆ CanEat()

bool SpawnItemOnLocation::CanEat ( )
private

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

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