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

◆ OnSyncVariables()

void SpawnItemOnLocation::OnSyncVariables ( ParamsReadContext ctx)
private

DEPRECATED (most likely)

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

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