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

◆ IsIgnoredByConstruction()

override bool SpawnItemOnLocation::IsIgnoredByConstruction ( )
protected

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

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