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

◆ NameToID()

int SpawnItemOnLocation::NameToID ( string name)
private

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

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