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

◆ SerializeNumericalVars()

override void SpawnItemOnLocation::SerializeNumericalVars ( array< float > floats_out)
private

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

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

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