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

◆ MessageToOwnerImportant()

void SpawnItemOnLocation::MessageToOwnerImportant ( string text)
protected

Send message to owner player in red color.

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

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

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