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

◆ MessageToOwnerFriendly()

void SpawnItemOnLocation::MessageToOwnerFriendly ( string text)
protected

Send message to owner player in green color.

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

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

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