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

◆ MessageToOwnerStatus()

void SpawnItemOnLocation::MessageToOwnerStatus ( string text)
protected

Send message to owner player in grey color.

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

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

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