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

◆ MessageToOwnerAction()

void SpawnItemOnLocation::MessageToOwnerAction ( string text)
protected

Send message to owner player in yellow color.

Возвращает
void
item_stone.MessageToOwnerAction("Some Action Message");

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

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