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

◆ SetCanBeMovedOverride()

void SpawnItemOnLocation::SetCanBeMovedOverride ( bool setting)
private

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

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