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

◆ IsItemBase()

override bool SpawnItemOnLocation::IsItemBase ( )
protected

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

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

Используется в IEntity::CanBeIgnoredByDroppedItem().