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

◆ UpdateQuickbarShortcutVisibility()

void SpawnItemOnLocation::UpdateQuickbarShortcutVisibility ( PlayerBase player)
protected

To be called on moving item within character's inventory; 'player' should never be null.

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

8563{
8564 override bool CanPutAsAttachment(EntityAI parent)
8565 {
8566 return true;
8567 }
8568};
8569
8570//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8571
8572class ItemBase extends InventoryItem
8573{
8577
8579
8580 static int m_DebugActionsMask;
8582 // ============================================
8583 // Variable Manipulation System
8584 // ============================================
8585 // Quantity
8586
8587 float m_VarQuantity;
8588 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8590 int m_VarQuantityMin;
8591 int m_VarQuantityMax;
8592 int m_Count;
8593 float m_VarStackMax;
8594 float m_StoreLoadedQuantity = float.LOWEST;
8595 // Wet
8596 float m_VarWet;
8597 float m_VarWetPrev;//for client to know wetness changed during synchronization
8598 float m_VarWetInit;
8599 float m_VarWetMin;
8600 float m_VarWetMax;
8601 // Cleanness
8602 int m_Cleanness;
8603 int m_CleannessInit;
8604 int m_CleannessMin;
8605 int m_CleannessMax;
8606 // impact sounds
8608 bool m_CanPlayImpactSound = true;
8609 float m_ImpactSpeed;
8611 //
8612 float m_HeatIsolation;
8613 float m_ItemModelLength;
8614 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8616 int m_VarLiquidType;
8617 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8618 int m_QuickBarBonus;
8619 bool m_IsBeingPlaced;
8620 bool m_IsHologram;
8621 bool m_IsTakeable;
8622 bool m_ThrowItemOnDrop;
8625 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8626 bool can_this_be_combined; //Check if item can be combined
8627 bool m_CanThisBeSplit; //Check if item can be split
8628 bool m_IsStoreLoad = false;
8629 bool m_CanShowQuantity;
8630 bool m_HasQuantityBar;
8631 protected bool m_CanBeDigged;
8632 protected bool m_IsResultOfSplit
8633
8634 string m_SoundAttType;
8635 // items color variables
8640 //-------------------------------------------------------
8641
8642 // light source managing
8644
8648
8649 //==============================================
8650 // agent system
8651 private int m_AttachedAgents;
8652
8654 void TransferModifiers(PlayerBase reciever);
8655
8656
8657 // Weapons & suppressors particle effects
8662 static int m_LastRegisteredWeaponID = 0;
8663
8664 // Overheating effects
8666 float m_OverheatingShots;
8667 ref Timer m_CheckOverheating;
8668 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8669 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8670 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8671 ref array <ref OverheatingParticle> m_OverheatingParticles;
8672
8674 protected bool m_HideSelectionsBySlot;
8675
8676 // Admin Log
8677 PluginAdminLog m_AdminLog;
8678
8679 // misc
8680 ref Timer m_PhysDropTimer;
8681
8682 // Attachment Locking variables
8683 ref array<int> m_CompatibleLocks;
8684 protected int m_LockType;
8685 protected ref EffectSound m_LockingSound;
8686 protected string m_LockSoundSet;
8687
8688 // ItemSoundHandler
8689 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8690 protected int m_SoundSyncPlay; // id for sound to play
8691 protected int m_SoundSyncStop; // id for sound to stop
8693
8694 //temperature
8695 private float m_TemperaturePerQuantityWeight;
8696
8697 // -------------------------------------------------------------------------
8698 void ItemBase()
8699 {
8700 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8704
8705 if (!GetGame().IsDedicatedServer())
8706 {
8707 if (HasMuzzle())
8708 {
8710
8712 {
8714 }
8715 }
8716
8718 m_ActionsInitialize = false;
8719 }
8720
8721 m_OldLocation = null;
8722
8723 if (GetGame().IsServer())
8724 {
8725 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8726 }
8727
8728 if (ConfigIsExisting("headSelectionsToHide"))
8729 {
8731 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8732 }
8733
8734 m_HideSelectionsBySlot = false;
8735 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8736 {
8737 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8738 }
8739
8740 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8741
8742 m_IsResultOfSplit = false;
8743
8745 }
8746
8747 override void InitItemVariables()
8748 {
8749 super.InitItemVariables();
8750
8751 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8752 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8753 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8754 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8755 m_VarStackMax = ConfigGetFloat("varStackMax");
8756 m_Count = ConfigGetInt("count");
8757
8758 m_CanShowQuantity = ConfigGetBool("quantityShow");
8759 m_HasQuantityBar = ConfigGetBool("quantityBar");
8760
8761 m_CleannessInit = ConfigGetInt("varCleannessInit");
8763 m_CleannessMin = ConfigGetInt("varCleannessMin");
8764 m_CleannessMax = ConfigGetInt("varCleannessMax");
8765
8766 m_WantPlayImpactSound = false;
8767 m_ImpactSpeed = 0.0;
8768
8769 m_VarWetInit = ConfigGetFloat("varWetInit");
8771 m_VarWetMin = ConfigGetFloat("varWetMin");
8772 m_VarWetMax = ConfigGetFloat("varWetMax");
8773
8774 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8775 if (IsLiquidContainer() && GetQuantity() != 0)
8777 m_IsBeingPlaced = false;
8778 m_IsHologram = false;
8779 m_IsTakeable = true;
8780 m_CanBeMovedOverride = false;
8784 m_CanBeDigged = ConfigGetBool("canBeDigged");
8785
8786 m_CompatibleLocks = new array<int>();
8787 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8788 m_LockType = ConfigGetInt("lockType");
8789
8790 //Define if item can be split and set ability to be combined accordingly
8791 m_CanThisBeSplit = false;
8792 can_this_be_combined = false;
8793 if (ConfigIsExisting("canBeSplit"))
8794 {
8795 can_this_be_combined = ConfigGetBool("canBeSplit");
8797 }
8798
8799 m_ItemBehaviour = -1;
8800 if (ConfigIsExisting("itemBehaviour"))
8801 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8802
8803 //RegisterNetSyncVariableInt("m_VariablesMask");
8804 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8805 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8806 RegisterNetSyncVariableInt("m_VarLiquidType");
8807 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8808
8809 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8810 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8811 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8812
8813 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8814 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8815 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8816 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8817
8818 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8819 RegisterNetSyncVariableBool("m_IsTakeable");
8820 RegisterNetSyncVariableBool("m_IsHologram");
8821
8822 InitItemSounds();
8824 {
8825 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8826 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8827 }
8828
8829 m_LockSoundSet = ConfigGetString("lockSoundSet");
8830
8832 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8833 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8834
8835 }
8836
8837 override int GetQuickBarBonus()
8838 {
8839 return m_QuickBarBonus;
8840 }
8841
8842 void InitializeActions()
8843 {
8845 if (!m_InputActionMap)
8846 {
8848 m_InputActionMap = iam;
8849 SetActions();
8851 }
8852 }
8853
8854 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
8855 {
8857 {
8858 m_ActionsInitialize = true;
8860 }
8861
8862 actions = m_InputActionMap.Get(action_input_type);
8863 }
8864
8865 void SetActions()
8866 {
8867 AddAction(ActionTakeItem);
8868 AddAction(ActionTakeItemToHands);
8869 AddAction(ActionWorldCraft);
8871 AddAction(ActionAttachWithSwitch);
8872 }
8873
8874 void SetActionAnimOverrides(); // Override action animation for specific item
8875
8876 void AddAction(typename actionName)
8877 {
8878 ActionBase action = ActionManagerBase.GetAction(actionName);
8879
8880 if (!action)
8881 {
8882 Debug.LogError("Action " + actionName + " dosn't exist!");
8883 return;
8884 }
8885
8886 typename ai = action.GetInputType();
8887 if (!ai)
8888 {
8889 m_ActionsInitialize = false;
8890 return;
8891 }
8892
8893 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8894 if (!action_array)
8895 {
8896 action_array = new array<ActionBase_Basic>;
8897 m_InputActionMap.Insert(ai, action_array);
8898 }
8899 if (LogManager.IsActionLogEnable())
8900 {
8901 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
8902 }
8903
8904 if (action_array.Find(action) != -1)
8905 {
8906 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
8907 }
8908 else
8909 {
8910 action_array.Insert(action);
8911 }
8912 }
8913
8914 void RemoveAction(typename actionName)
8915 {
8916 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8917 ActionBase action = player.GetActionManager().GetAction(actionName);
8918 typename ai = action.GetInputType();
8919 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8920
8921 if (action_array)
8922 {
8923 action_array.RemoveItem(action);
8924 }
8925 }
8926
8927 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
8928 // Set -1 for params which should stay in default state
8929 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
8930 {
8931 ActionOverrideData overrideData = new ActionOverrideData();
8932 overrideData.m_CommandUID = commandUID;
8933 overrideData.m_CommandUIDProne = commandUIDProne;
8934 overrideData.m_StanceMask = stanceMask;
8935
8936 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
8937 if (!actionMap) // create new map of action > overidables map
8938 {
8939 actionMap = new TActionAnimOverrideMap();
8940 m_ItemActionOverrides.Insert(action, actionMap);
8941 }
8942
8943 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
8944
8945 }
8946
8947 void OnItemInHandsPlayerSwimStart(PlayerBase player);
8948
8949 ScriptedLightBase GetLight();
8950
8951 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8952 void LoadParticleConfigOnFire(int id)
8953 {
8954 if (!m_OnFireEffect)
8956
8959
8960 string config_to_search = "CfgVehicles";
8961 string muzzle_owner_config;
8962
8963 if (!m_OnFireEffect.Contains(id))
8964 {
8965 if (IsInherited(Weapon))
8966 config_to_search = "CfgWeapons";
8967
8968 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8969
8970 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8971
8972 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
8973
8974 if (config_OnFire_subclass_count > 0)
8975 {
8976 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8977
8978 for (int i = 0; i < config_OnFire_subclass_count; i++)
8979 {
8980 string particle_class = "";
8981 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
8982 string config_OnFire_entry = config_OnFire_class + particle_class;
8983 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8984 WPOF_array.Insert(WPOF);
8985 }
8986
8987
8988 m_OnFireEffect.Insert(id, WPOF_array);
8989 }
8990 }
8991
8992 if (!m_OnBulletCasingEjectEffect.Contains(id))
8993 {
8994 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
8995 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8996
8997 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8998
8999 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9000
9001 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9002 {
9003 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9004
9005 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9006 {
9007 string particle_class2 = "";
9008 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9009 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9010 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9011 WPOBE_array.Insert(WPOBE);
9012 }
9013
9014
9015 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
9016 }
9017 }
9018 }
9019
9020 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9022 {
9025
9026 if (!m_OnOverheatingEffect.Contains(id))
9027 {
9028 string config_to_search = "CfgVehicles";
9029
9030 if (IsInherited(Weapon))
9031 config_to_search = "CfgWeapons";
9032
9033 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
9034 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9035
9036 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
9037 {
9038
9039 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
9040
9042 {
9043 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
9044 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9045 Error(error);
9046 return;
9047 }
9048
9049 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
9050 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
9051
9052
9053
9054 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
9055 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9056
9057 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9058 {
9059 string particle_class = "";
9060 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9061 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9062 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
9063
9064 if (entry_type == CT_CLASS)
9065 {
9066 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9067 WPOOH_array.Insert(WPOF);
9068 }
9069 }
9070
9071
9072 m_OnOverheatingEffect.Insert(id, WPOOH_array);
9073 }
9074 }
9075 }
9076
9077 float GetOverheatingValue()
9078 {
9079 return m_OverheatingShots;
9080 }
9081
9082 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9083 {
9084 if (m_MaxOverheatingValue > 0)
9085 {
9087
9088 if (!m_CheckOverheating)
9090
9092 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9093
9094 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9095 }
9096 }
9097
9098 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9099 {
9101 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9102
9104 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9105
9107 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9108
9110 {
9112 }
9113 }
9114
9116 {
9118 }
9119
9120 void OnOverheatingDecay()
9121 {
9122 if (m_MaxOverheatingValue > 0)
9123 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
9124 else
9126
9127 if (m_OverheatingShots <= 0)
9128 {
9131 }
9132 else
9133 {
9134 if (!m_CheckOverheating)
9136
9138 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9139 }
9140
9141 CheckOverheating(this, "", this);
9142 }
9143
9144 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9145 {
9147 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9148 }
9149
9150 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9151 {
9153 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9155 }
9156
9157 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9158 {
9160 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9161 }
9162
9163 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
9164 {
9166 m_OverheatingParticles = new array<ref OverheatingParticle>;
9167
9168 OverheatingParticle OP = new OverheatingParticle();
9169 OP.RegisterParticle(p);
9170 OP.SetOverheatingLimitMin(min_heat_coef);
9171 OP.SetOverheatingLimitMax(max_heat_coef);
9172 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
9173
9174 m_OverheatingParticles.Insert(OP);
9175 }
9176
9177 float GetOverheatingCoef()
9178 {
9179 if (m_MaxOverheatingValue > 0)
9181
9182 return -1;
9183 }
9184
9186 {
9188 {
9189 float overheat_coef = GetOverheatingCoef();
9190 int count = m_OverheatingParticles.Count();
9191
9192 for (int i = count; i > 0; --i)
9193 {
9194 int id = i - 1;
9195 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9196 Particle p = OP.GetParticle();
9197
9198 float overheat_min = OP.GetOverheatingLimitMin();
9199 float overheat_max = OP.GetOverheatingLimitMax();
9200
9201 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9202 {
9203 if (p)
9204 {
9205 p.Stop();
9206 OP.RegisterParticle(null);
9207 }
9208 }
9209 }
9210 }
9211 }
9212
9214 {
9216 {
9217 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
9218 {
9219 int id = i - 1;
9220 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9221
9222 if (OP)
9223 {
9224 Particle p = OP.GetParticle();
9225
9226 if (p)
9227 {
9228 p.Stop();
9229 }
9230
9231 delete OP;
9232 }
9233 }
9234
9235 m_OverheatingParticles.Clear();
9237 }
9238 }
9239
9241 float GetInfectionChance(int system = 0, Param param = null)
9242 {
9243 return 0.0;
9244 }
9245
9246
9247 float GetDisinfectQuantity(int system = 0, Param param1 = null)
9248 {
9249 return 250;//default value
9250 }
9251
9252 float GetFilterDamageRatio()
9253 {
9254 return 0;
9255 }
9256
9258 bool HasMuzzle()
9259 {
9260 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
9261 return true;
9262
9263 return false;
9264 }
9265
9267 int GetMuzzleID()
9268 {
9269 if (!m_WeaponTypeToID)
9271
9272 if (m_WeaponTypeToID.Contains(GetType()))
9273 {
9274 return m_WeaponTypeToID.Get(GetType());
9275 }
9276 else
9277 {
9278 // Register new weapon ID
9280 }
9281
9283 }
9284
9291 {
9292 return -1;
9293 }
9294
9295
9296
9297 // -------------------------------------------------------------------------
9298 void ~ItemBase()
9299 {
9300 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
9301 {
9302 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9303 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9304
9305 if (r_index >= 0)
9306 {
9307 InventoryLocation r_il = new InventoryLocation;
9308 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9309
9310 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9311 int r_type = r_il.GetType();
9312 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9313 {
9314 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9315 }
9316 else if (r_type == InventoryLocationType.ATTACHMENT)
9317 {
9318 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9319 }
9320
9321 }
9322
9323 player.GetHumanInventory().ClearUserReservedLocation(this);
9324 }
9325
9326 if (m_LockingSound)
9327 SEffectManager.DestroyEffect(m_LockingSound);
9328 }
9329
9330
9331
9332 // -------------------------------------------------------------------------
9333 static int GetDebugActionsMask()
9334 {
9335 return ItemBase.m_DebugActionsMask;
9336 }
9337
9338 static bool HasDebugActionsMask(int mask)
9339 {
9340 return ItemBase.m_DebugActionsMask & mask;
9341 }
9342
9343 static void SetDebugActionsMask(int mask)
9344 {
9345 ItemBase.m_DebugActionsMask = mask;
9346 }
9347
9348 static void AddDebugActionsMask(int mask)
9349 {
9350 ItemBase.m_DebugActionsMask |= mask;
9351 }
9352
9353 static void RemoveDebugActionsMask(int mask)
9354 {
9355 ItemBase.m_DebugActionsMask &= ~mask;
9356 }
9357
9358 static void ToggleDebugActionsMask(int mask)
9359 {
9360 if (HasDebugActionsMask(mask))
9361 {
9363 }
9364 else
9365 {
9366 AddDebugActionsMask(mask);
9367 }
9368 }
9369
9370 // -------------------------------------------------------------------------
9371 void SetCEBasedQuantity()
9372 {
9373 if (GetEconomyProfile())
9374 {
9375 float q_max = GetEconomyProfile().GetQuantityMax();
9376 if (q_max > 0)
9377 {
9378 float q_min = GetEconomyProfile().GetQuantityMin();
9379 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9380
9381 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9382 {
9383 ComponentEnergyManager comp = GetCompEM();
9384 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
9385 {
9386 comp.SetEnergy0To1(quantity_randomized);
9387 }
9388 }
9389 else if (HasQuantity())
9390 {
9391 SetQuantityNormalized(quantity_randomized, false);
9392 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9393 }
9394
9395 }
9396 }
9397 }
9398
9400 void LockToParent()
9401 {
9402 EntityAI parent = GetHierarchyParent();
9403
9404 if (parent)
9405 {
9406 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9407 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9408 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9409 }
9410 }
9411
9413 void UnlockFromParent()
9414 {
9415 EntityAI parent = GetHierarchyParent();
9416
9417 if (parent)
9418 {
9419 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9420 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9421 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9422 }
9423 }
9424
9425 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9426 {
9427 /*
9428 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9429 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9430 */
9431 ItemBase item2 = ItemBase.Cast(entity2);
9432
9433 if (GetGame().IsClient())
9434 {
9435 if (ScriptInputUserData.CanStoreInputUserData())
9436 {
9437 ScriptInputUserData ctx = new ScriptInputUserData;
9439 ctx.Write(-1);
9440 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9441 ctx.Write(i1);
9442 ctx.Write(item2);
9443 ctx.Write(use_stack_max);
9444 ctx.Write(-1);
9445 ctx.Send();
9446
9447 if (IsCombineAll(item2, use_stack_max))
9448 {
9449 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9450 }
9451 }
9452 }
9453 else if (!GetGame().IsMultiplayer())
9454 {
9455 CombineItems(item2, use_stack_max);
9456 }
9457 }
9458
9459 bool IsLiquidPresent()
9460 {
9461 return (GetLiquidType() != 0 && HasQuantity());
9462 }
9463
9464 bool IsLiquidContainer()
9465 {
9466 return m_LiquidContainerMask != 0;
9467 }
9468
9470 {
9471 return m_LiquidContainerMask;
9472 }
9473
9474 bool IsBloodContainer()
9475 {
9476 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9477 return false;
9478 }
9479
9480 bool IsNVG()
9481 {
9482 return false;
9483 }
9484
9487 bool IsExplosive()
9488 {
9489 return false;
9490 }
9491
9493 {
9494 return "";
9495 }
9496
9498
9499 bool IsLightSource()
9500 {
9501 return false;
9502 }
9503
9505 {
9506 return true;
9507 }
9508
9509 //--- ACTION CONDITIONS
9510 //direction
9511 bool IsFacingPlayer(PlayerBase player, string selection)
9512 {
9513 return true;
9514 }
9515
9516 bool IsPlayerInside(PlayerBase player, string selection)
9517 {
9518 return true;
9519 }
9520
9521 override bool CanObstruct()
9522 {
9523 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9524 return !player || !IsPlayerInside(player, "");
9525 }
9526
9527 override bool IsBeingPlaced()
9528 {
9529 return m_IsBeingPlaced;
9530 }
9531
9532 void SetIsBeingPlaced(bool is_being_placed)
9533 {
9534 m_IsBeingPlaced = is_being_placed;
9535 if (!is_being_placed)
9537 SetSynchDirty();
9538 }
9539
9540 //server-side
9541 void OnEndPlacement() {}
9542
9543 override bool IsHologram()
9544 {
9545 return m_IsHologram;
9546 }
9547
9548 bool CanBeDigged()
9549 {
9550 return m_CanBeDigged;
9551 }
9552
9554 {
9555 return 1;
9556 }
9557
9558 bool CanMakeGardenplot()
9559 {
9560 return false;
9561 }
9562
9563 void SetIsHologram(bool is_hologram)
9564 {
9565 m_IsHologram = is_hologram;
9566 SetSynchDirty();
9567 }
9568 /*
9569 protected float GetNutritionalEnergy()
9570 {
9571 Edible_Base edible = Edible_Base.Cast(this);
9572 return edible.GetFoodEnergy();
9573 }
9574
9575 protected float GetNutritionalWaterContent()
9576 {
9577 Edible_Base edible = Edible_Base.Cast(this);
9578 return edible.GetFoodWater();
9579 }
9580
9581 protected float GetNutritionalIndex()
9582 {
9583 Edible_Base edible = Edible_Base.Cast(this);
9584 return edible.GetFoodNutritionalIndex();
9585 }
9586
9587 protected float GetNutritionalFullnessIndex()
9588 {
9589 Edible_Base edible = Edible_Base.Cast(this);
9590 return edible.GetFoodTotalVolume();
9591 }
9592
9593 protected float GetNutritionalToxicity()
9594 {
9595 Edible_Base edible = Edible_Base.Cast(this);
9596 return edible.GetFoodToxicity();
9597
9598 }
9599 */
9600
9601
9602 // -------------------------------------------------------------------------
9603 override void OnMovedInsideCargo(EntityAI container)
9604 {
9605 super.OnMovedInsideCargo(container);
9606
9607 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9608 }
9609
9610 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9611 {
9612 super.EEItemLocationChanged(oldLoc,newLoc);
9613
9614 PlayerBase new_player = null;
9615 PlayerBase old_player = null;
9616
9617 if (newLoc.GetParent())
9618 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9619
9620 if (oldLoc.GetParent())
9621 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9622
9623 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9624 {
9625 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9626
9627 if (r_index >= 0)
9628 {
9629 InventoryLocation r_il = new InventoryLocation;
9630 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9631
9632 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9633 int r_type = r_il.GetType();
9634 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9635 {
9636 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9637 }
9638 else if (r_type == InventoryLocationType.ATTACHMENT)
9639 {
9640 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9641 }
9642
9643 }
9644 }
9645
9646 if (newLoc.GetType() == InventoryLocationType.HANDS)
9647 {
9648 if (new_player)
9649 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9650
9651 if (new_player == old_player)
9652 {
9653
9654 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9655 {
9656 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9657 {
9658 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9659 {
9660 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9661 }
9662 }
9663 else
9664 {
9665 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9666 }
9667 }
9668
9669 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9670 {
9671 int type = oldLoc.GetType();
9672 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9673 {
9674 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9675 }
9676 else if (type == InventoryLocationType.ATTACHMENT)
9677 {
9678 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9679 }
9680 }
9681 if (!m_OldLocation)
9682 {
9683 m_OldLocation = new InventoryLocation;
9684 }
9685 m_OldLocation.Copy(oldLoc);
9686 }
9687 else
9688 {
9689 if (m_OldLocation)
9690 {
9691 m_OldLocation.Reset();
9692 }
9693 }
9694
9696 }
9697 else
9698 {
9699 if (new_player)
9700 {
9701 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9702 if (res_index >= 0)
9703 {
9704 InventoryLocation il = new InventoryLocation;
9705 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9706 ItemBase it = ItemBase.Cast(il.GetItem());
9707 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9708 int rel_type = il.GetType();
9709 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9710 {
9711 il.GetParent().GetOnReleaseLock().Invoke(it);
9712 }
9713 else if (rel_type == InventoryLocationType.ATTACHMENT)
9714 {
9715 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9716 }
9717 //it.GetOnReleaseLock().Invoke(it);
9718 }
9719 }
9720 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9721 {
9722 //ThrowPhysically(old_player, vector.Zero);
9723 m_ThrowItemOnDrop = false;
9724 }
9725
9726 if (m_OldLocation)
9727 {
9728 m_OldLocation.Reset();
9729 }
9730 }
9731 }
9732
9733 override void EOnContact(IEntity other, Contact extra)
9734 {
9736 {
9737 int liquidType = -1;
9738 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9739 if (impactSpeed > 0.0)
9740 {
9741 m_ImpactSpeed = impactSpeed;
9742 #ifndef SERVER
9743 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9744 #else
9745 m_WantPlayImpactSound = true;
9746 SetSynchDirty();
9747 #endif
9748 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9749 }
9750 }
9751
9752 #ifdef SERVER
9753 if (GetCompEM() && GetCompEM().IsPlugged())
9754 {
9755 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9756 GetCompEM().UnplugThis();
9757 }
9758 #endif
9759 }
9760
9761 void RefreshPhysics();
9762
9763 override void OnCreatePhysics()
9764 {
9766 }
9767
9768 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9769 {
9770
9771 }
9772 // -------------------------------------------------------------------------
9773 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9774 {
9775 super.OnItemLocationChanged(old_owner, new_owner);
9776
9777 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9778 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9779
9780 if (!relatedPlayer && playerNew)
9781 relatedPlayer = playerNew;
9782
9783 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9784 {
9785 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9786 if (actionMgr)
9787 {
9788 ActionBase currentAction = actionMgr.GetRunningAction();
9789 if (currentAction)
9790 currentAction.OnItemLocationChanged(this);
9791 }
9792 }
9793
9794 Man ownerPlayerOld = null;
9795 Man ownerPlayerNew = null;
9796
9797 if (old_owner)
9798 {
9799 if (old_owner.IsMan())
9800 {
9801 ownerPlayerOld = Man.Cast(old_owner);
9802 }
9803 else
9804 {
9805 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9806 }
9807 }
9808 else
9809 {
9810 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9811 {
9812 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9813
9814 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9815 {
9816 GetCompEM().UnplugThis();
9817 }
9818 }
9819 }
9820
9821 if (new_owner)
9822 {
9823 if (new_owner.IsMan())
9824 {
9825 ownerPlayerNew = Man.Cast(new_owner);
9826 }
9827 else
9828 {
9829 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9830 }
9831 }
9832
9833 if (ownerPlayerOld != ownerPlayerNew)
9834 {
9835 if (ownerPlayerOld)
9836 {
9837 array<EntityAI> subItemsExit = new array<EntityAI>;
9838 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
9839 for (int i = 0; i < subItemsExit.Count(); i++)
9840 {
9841 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
9842 itemExit.OnInventoryExit(ownerPlayerOld);
9843 }
9844 }
9845
9846 if (ownerPlayerNew)
9847 {
9848 array<EntityAI> subItemsEnter = new array<EntityAI>;
9849 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
9850 for (int j = 0; j < subItemsEnter.Count(); j++)
9851 {
9852 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
9853 itemEnter.OnInventoryEnter(ownerPlayerNew);
9854 }
9855 }
9856 }
9857 else if (ownerPlayerNew != null)
9858 {
9859 PlayerBase nplayer;
9860 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9861 {
9862 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9863 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
9864 for (int k = 0; k < subItemsUpdate.Count(); k++)
9865 {
9866 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
9867 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9868 }
9869 }
9870 }
9871
9872 if (old_owner)
9873 old_owner.OnChildItemRemoved(this);
9874 if (new_owner)
9875 new_owner.OnChildItemReceived(this);
9876 }
9877
9878 // -------------------------------------------------------------------------------
9879 override void EEDelete(EntityAI parent)
9880 {
9881 super.EEDelete(parent);
9882 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9883 if (player)
9884 {
9885 OnInventoryExit(player);
9886
9887 if (player.IsAlive())
9888 {
9889 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9890 if (r_index >= 0)
9891 {
9892 InventoryLocation r_il = new InventoryLocation;
9893 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9894
9895 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9896 int r_type = r_il.GetType();
9897 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9898 {
9899 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9900 }
9901 else if (r_type == InventoryLocationType.ATTACHMENT)
9902 {
9903 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9904 }
9905
9906 }
9907
9908 player.RemoveQuickBarEntityShortcut(this);
9909 }
9910 }
9911 }
9912 // -------------------------------------------------------------------------------
9913 override void EEKilled(Object killer)
9914 {
9915 super.EEKilled(killer);
9916
9918 if (killer && killer.IsFireplace() && CanExplodeInFire())
9919 {
9920 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9921 {
9922 if (IsMagazine())
9923 {
9924 if (Magazine.Cast(this).GetAmmoCount() > 0)
9925 {
9926 ExplodeAmmo();
9927 }
9928 }
9929 else
9930 {
9931 Explode(DamageType.EXPLOSION);
9932 }
9933 }
9934 }
9935 }
9936
9937 override void OnWasAttached(EntityAI parent, int slot_id)
9938 {
9939 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9940
9941 super.OnWasAttached(parent, slot_id);
9942
9943 if (HasQuantity())
9944 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9945
9946 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
9947 }
9948
9949 override void OnWasDetached(EntityAI parent, int slot_id)
9950 {
9951 super.OnWasDetached(parent, slot_id);
9952
9953 if (HasQuantity())
9954 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9955 }
9956
9957 override string ChangeIntoOnAttach(string slot)
9958 {
9959 int idx;
9960 TStringArray inventory_slots = new TStringArray;
9961 TStringArray attach_types = new TStringArray;
9962
9963 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9964 if (inventory_slots.Count() < 1) //is string
9965 {
9966 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9967 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9968 }
9969 else //is array
9970 {
9971 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9972 }
9973
9974 idx = inventory_slots.Find(slot);
9975 if (idx < 0)
9976 return "";
9977
9978 return attach_types.Get(idx);
9979 }
9980
9981 override string ChangeIntoOnDetach()
9982 {
9983 int idx = -1;
9984 string slot;
9985
9986 TStringArray inventory_slots = new TStringArray;
9987 TStringArray detach_types = new TStringArray;
9988
9989 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9990 if (inventory_slots.Count() < 1) //is string
9991 {
9992 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9993 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9994 }
9995 else //is array
9996 {
9997 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9998 if (detach_types.Count() < 1)
9999 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10000 }
10001
10002 for (int i = 0; i < inventory_slots.Count(); i++)
10003 {
10004 slot = inventory_slots.Get(i);
10005 }
10006
10007 if (slot != "")
10008 {
10009 if (detach_types.Count() == 1)
10010 idx = 0;
10011 else
10012 idx = inventory_slots.Find(slot);
10013 }
10014 if (idx < 0)
10015 return "";
10016
10017 return detach_types.Get(idx);
10018 }
10019
10020 void ExplodeAmmo()
10021 {
10022 //timer
10023 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
10024
10025 //min/max time
10026 float min_time = 1;
10027 float max_time = 3;
10028 float delay = Math.RandomFloat(min_time, max_time);
10029
10030 explode_timer.Run(delay, this, "DoAmmoExplosion");
10031 }
10032
10033 void DoAmmoExplosion()
10034 {
10035 Magazine magazine = Magazine.Cast(this);
10036 int pop_sounds_count = 6;
10037 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10038
10039 //play sound
10040 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10041 string sound_name = pop_sounds[ sound_idx ];
10042 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
10043
10044 //remove ammo count
10045 magazine.ServerAddAmmoCount(-1);
10046
10047 //if condition then repeat -> ExplodeAmmo
10048 float min_temp_to_explode = 100; //min temperature for item to explode
10049
10050 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
10051 {
10052 ExplodeAmmo();
10053 }
10054 }
10055
10056 // -------------------------------------------------------------------------------
10057 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
10058 {
10059 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
10060
10061 const int CHANCE_DAMAGE_CARGO = 4;
10062 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10063 const int CHANCE_DAMAGE_NOTHING = 2;
10064
10065 if (IsClothing() || IsContainer() || IsItemTent())
10066 {
10067 float dmg = damageResult.GetDamage("","Health") * -0.5;
10068 int chances;
10069 int rnd;
10070
10071 if (GetInventory().GetCargo())
10072 {
10073 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10074 rnd = Math.RandomInt(0,chances);
10075
10076 if (rnd < CHANCE_DAMAGE_CARGO)
10077 {
10078 DamageItemInCargo(dmg);
10079 }
10080 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10081 {
10083 }
10084 }
10085 else
10086 {
10087 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10088 rnd = Math.RandomInt(0,chances);
10089
10090 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10091 {
10093 }
10094 }
10095 }
10096 }
10097
10098 bool DamageItemInCargo(float damage)
10099 {
10100 if (GetInventory().GetCargo())
10101 {
10102 int item_count = GetInventory().GetCargo().GetItemCount();
10103 if (item_count > 0)
10104 {
10105 int random_pick = Math.RandomInt(0, item_count);
10106 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
10107 if (!item.IsExplosive())
10108 {
10109 item.AddHealth("","",damage);
10110 return true;
10111 }
10112 }
10113 }
10114 return false;
10115 }
10116
10117 bool DamageItemAttachments(float damage)
10118 {
10119 int attachment_count = GetInventory().AttachmentCount();
10120 if (attachment_count > 0)
10121 {
10122 int random_pick = Math.RandomInt(0, attachment_count);
10123 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10124 if (!attachment.IsExplosive())
10125 {
10126 attachment.AddHealth("","",damage);
10127 return true;
10128 }
10129 }
10130 return false;
10131 }
10132
10133 override bool IsSplitable()
10134 {
10135 return m_CanThisBeSplit;
10136 }
10137 //----------------
10138 override bool CanBeSplit()
10139 {
10140 if (IsSplitable() && (GetQuantity() > 1))
10141 return GetInventory().CanRemoveEntity();
10142
10143 return false;
10144 }
10145
10146 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
10147 {
10148 if (!CanBeSplit())
10149 return;
10150
10151 if (GetGame().IsClient())
10152 {
10153 if (ScriptInputUserData.CanStoreInputUserData())
10154 {
10155 ScriptInputUserData ctx = new ScriptInputUserData;
10157 ctx.Write(1);
10158 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10159 ctx.Write(i1);
10160 ctx.Write(destination_entity);
10161 ctx.Write(true);
10162 ctx.Write(slot_id);
10163 ctx.Send();
10164 }
10165 }
10166 else if (!GetGame().IsMultiplayer())
10167 {
10168 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
10169 }
10170 }
10171
10172 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
10173 {
10174 if (!CanBeSplit())
10175 return;
10176
10177 float split_quantity_new;
10178 ref ItemBase new_item;
10179 float quantity = GetQuantity();
10180 float stack_max = GetTargetQuantityMax(slot_id);
10181 InventoryLocation loc = new InventoryLocation;
10182
10183 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10184 {
10185 if (stack_max <= GetQuantity())
10186 split_quantity_new = stack_max;
10187 else
10188 split_quantity_new = GetQuantity();
10189
10190 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10191 if (new_item)
10192 {
10193 new_item.SetResultOfSplit(true);
10194 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10195 AddQuantity(-split_quantity_new);
10196 new_item.SetQuantity(split_quantity_new);
10197 }
10198 }
10199 else if (destination_entity && slot_id == -1)
10200 {
10201 if (quantity > stack_max)
10202 split_quantity_new = stack_max;
10203 else
10204 split_quantity_new = quantity;
10205
10206 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10207 {
10208 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10209 new_item = ItemBase.Cast(o);
10210 }
10211
10212 if (new_item)
10213 {
10214 new_item.SetResultOfSplit(true);
10215 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10216 AddQuantity(-split_quantity_new);
10217 new_item.SetQuantity(split_quantity_new);
10218 }
10219 }
10220 else
10221 {
10222 if (stack_max != 0)
10223 {
10224 if (stack_max < GetQuantity())
10225 {
10226 split_quantity_new = GetQuantity() - stack_max;
10227 }
10228
10229 if (split_quantity_new == 0)
10230 {
10231 if (!GetGame().IsMultiplayer())
10232 player.PhysicalPredictiveDropItem(this);
10233 else
10234 player.ServerDropEntity(this);
10235 return;
10236 }
10237
10238 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10239
10240 if (new_item)
10241 {
10242 new_item.SetResultOfSplit(true);
10243 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10244 SetQuantity(split_quantity_new);
10245 new_item.SetQuantity(stack_max);
10246 new_item.PlaceOnSurface();
10247 }
10248 }
10249 }
10250 }
10251
10252 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
10253 {
10254 if (!CanBeSplit())
10255 return;
10256
10257 float split_quantity_new;
10258 ref ItemBase new_item;
10259 float quantity = GetQuantity();
10260 float stack_max = GetTargetQuantityMax(slot_id);
10261 InventoryLocation loc = new InventoryLocation;
10262
10263 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10264 {
10265 if (stack_max <= GetQuantity())
10266 split_quantity_new = stack_max;
10267 else
10268 split_quantity_new = GetQuantity();
10269
10270 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10271 if (new_item)
10272 {
10273 new_item.SetResultOfSplit(true);
10274 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10275 AddQuantity(-split_quantity_new);
10276 new_item.SetQuantity(split_quantity_new);
10277 }
10278 }
10279 else if (destination_entity && slot_id == -1)
10280 {
10281 if (quantity > stack_max)
10282 split_quantity_new = stack_max;
10283 else
10284 split_quantity_new = quantity;
10285
10286 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10287 {
10288 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10289 new_item = ItemBase.Cast(o);
10290 }
10291
10292 if (new_item)
10293 {
10294 new_item.SetResultOfSplit(true);
10295 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10296 AddQuantity(-split_quantity_new);
10297 new_item.SetQuantity(split_quantity_new);
10298 }
10299 }
10300 else
10301 {
10302 if (stack_max != 0)
10303 {
10304 if (stack_max < GetQuantity())
10305 {
10306 split_quantity_new = GetQuantity() - stack_max;
10307 }
10308
10309 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10310
10311 if (new_item)
10312 {
10313 new_item.SetResultOfSplit(true);
10314 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10315 SetQuantity(split_quantity_new);
10316 new_item.SetQuantity(stack_max);
10317 new_item.PlaceOnSurface();
10318 }
10319 }
10320 }
10321 }
10322
10323 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10324 {
10325 if (!CanBeSplit())
10326 return;
10327
10328 if (GetGame().IsClient())
10329 {
10330 if (ScriptInputUserData.CanStoreInputUserData())
10331 {
10332 ScriptInputUserData ctx = new ScriptInputUserData;
10334 ctx.Write(4);
10335 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10336 ctx.Write(thiz);
10337 dst.WriteToContext(ctx);
10338 ctx.Send();
10339 }
10340 }
10341 else if (!GetGame().IsMultiplayer())
10342 {
10344 }
10345 }
10346
10347 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10348 {
10349 if (!CanBeSplit())
10350 return;
10351
10352 if (GetGame().IsClient())
10353 {
10354 if (ScriptInputUserData.CanStoreInputUserData())
10355 {
10356 ScriptInputUserData ctx = new ScriptInputUserData;
10358 ctx.Write(2);
10359 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10360 ctx.Write(dummy);
10361 ctx.Write(destination_entity);
10362 ctx.Write(true);
10363 ctx.Write(idx);
10364 ctx.Write(row);
10365 ctx.Write(col);
10366 ctx.Send();
10367 }
10368 }
10369 else if (!GetGame().IsMultiplayer())
10370 {
10371 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10372 }
10373 }
10374
10375 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10376 {
10378 }
10379
10380 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10381 {
10382 if (!CanBeSplit())
10383 return this;
10384
10385 float quantity = GetQuantity();
10386 float split_quantity_new;
10387 ItemBase new_item;
10388 if (dst.IsValid())
10389 {
10390 int slot_id = dst.GetSlot();
10391 float stack_max = GetTargetQuantityMax(slot_id);
10392
10393 if (quantity > stack_max)
10394 split_quantity_new = stack_max;
10395 else
10396 split_quantity_new = quantity;
10397
10398 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10399
10400 if (new_item)
10401 {
10402 new_item.SetResultOfSplit(true);
10403 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10404 AddQuantity(-split_quantity_new);
10405 new_item.SetQuantity(split_quantity_new);
10406 }
10407
10408 return new_item;
10409 }
10410
10411 return null;
10412 }
10413
10414 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10415 {
10416 if (!CanBeSplit())
10417 return;
10418
10419 float quantity = GetQuantity();
10420 float split_quantity_new;
10421 ref ItemBase new_item;
10422 if (destination_entity)
10423 {
10424 float stackable = GetTargetQuantityMax();
10425 if (quantity > stackable)
10426 split_quantity_new = stackable;
10427 else
10428 split_quantity_new = quantity;
10429
10430 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10431 if (new_item)
10432 {
10433 new_item.SetResultOfSplit(true);
10434 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10435 AddQuantity(-split_quantity_new);
10436 new_item.SetQuantity(split_quantity_new);
10437 }
10438 }
10439 }
10440
10441 void SplitIntoStackMaxHandsClient(PlayerBase player)
10442 {
10443 if (!CanBeSplit())
10444 return;
10445
10446 if (GetGame().IsClient())
10447 {
10448 if (ScriptInputUserData.CanStoreInputUserData())
10449 {
10450 ScriptInputUserData ctx = new ScriptInputUserData;
10452 ctx.Write(3);
10453 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10454 ctx.Write(i1);
10455 ItemBase destination_entity = this;
10456 ctx.Write(destination_entity);
10457 ctx.Write(true);
10458 ctx.Write(0);
10459 ctx.Send();
10460 }
10461 }
10462 else if (!GetGame().IsMultiplayer())
10463 {
10464 SplitIntoStackMaxHands(player);
10465 }
10466 }
10467
10468 void SplitIntoStackMaxHands(PlayerBase player)
10469 {
10470 if (!CanBeSplit())
10471 return;
10472
10473 float quantity = GetQuantity();
10474 float split_quantity_new;
10475 ref ItemBase new_item;
10476 if (player)
10477 {
10478 float stackable = GetTargetQuantityMax();
10479 if (quantity > stackable)
10480 split_quantity_new = stackable;
10481 else
10482 split_quantity_new = quantity;
10483
10484 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10485 new_item = ItemBase.Cast(in_hands);
10486 if (new_item)
10487 {
10488 new_item.SetResultOfSplit(true);
10489 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10490 AddQuantity(-split_quantity_new);
10491 new_item.SetQuantity(split_quantity_new);
10492 }
10493 }
10494 }
10495
10496 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10497 {
10498 if (!CanBeSplit())
10499 return;
10500
10501 float quantity = GetQuantity();
10502 float split_quantity_new = Math.Floor(quantity * 0.5);
10503
10504 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10505
10506 if (new_item)
10507 {
10508 if (new_item.GetQuantityMax() < split_quantity_new)
10509 {
10510 split_quantity_new = new_item.GetQuantityMax();
10511 }
10512
10513 new_item.SetResultOfSplit(true);
10514 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10515
10516 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10517 {
10518 AddQuantity(-1);
10519 new_item.SetQuantity(1);
10520 }
10521 else
10522 {
10523 AddQuantity(-split_quantity_new);
10524 new_item.SetQuantity(split_quantity_new);
10525 }
10526 }
10527 }
10528
10529 void SplitItem(PlayerBase player)
10530 {
10531 if (!CanBeSplit())
10532 return;
10533
10534 float quantity = GetQuantity();
10535 float split_quantity_new = Math.Floor(quantity / 2);
10536
10537 InventoryLocation invloc = new InventoryLocation;
10538 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10539
10540 ItemBase new_item;
10541 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10542
10543 if (new_item)
10544 {
10545 if (new_item.GetQuantityMax() < split_quantity_new)
10546 {
10547 split_quantity_new = new_item.GetQuantityMax();
10548 }
10549 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10550 {
10551 AddQuantity(-1);
10552 new_item.SetQuantity(1);
10553 }
10554 else
10555 {
10556 AddQuantity(-split_quantity_new);
10557 new_item.SetQuantity(split_quantity_new);
10558 }
10559 }
10560 }
10561
10563 void OnQuantityChanged(float delta)
10564 {
10565 SetWeightDirty();
10566 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10567
10568 if (parent)
10569 parent.OnAttachmentQuantityChangedEx(this, delta);
10570
10571 if (IsLiquidContainer())
10572 {
10573 if (GetQuantityNormalized() <= 0.0)
10574 {
10576 }
10577 else if (GetLiquidType() == LIQUID_NONE)
10578 {
10579 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10581 }
10582 }
10583
10584 }
10585
10588 {
10589 // insert code here
10590 }
10591
10593 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10594 {
10596 }
10597
10598 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10599 {
10600 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10601
10602 if (GetGame().IsServer())
10603 {
10604 if (newLevel == GameConstants.STATE_RUINED)
10605 {
10607 EntityAI parent = GetHierarchyParent();
10608 if (parent && parent.IsFireplace())
10609 {
10610 CargoBase cargo = GetInventory().GetCargo();
10611 if (cargo)
10612 {
10613 for (int i = 0; i < cargo.GetItemCount(); ++i)
10614 {
10615 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10616 }
10617 }
10618 }
10619 }
10620
10621 if (IsResultOfSplit())
10622 {
10623 // reset the splitting result flag, return to normal item behavior
10624 SetResultOfSplit(false);
10625 return;
10626 }
10627
10628 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10629 {
10630 SetCleanness(0);//unclean the item upon damage dealt
10631 }
10632 }
10633 }
10634
10635 // just the split? TODO: verify
10636 override void OnRightClick()
10637 {
10638 super.OnRightClick();
10639
10640 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10641 {
10642 if (GetGame().IsClient())
10643 {
10644 if (ScriptInputUserData.CanStoreInputUserData())
10645 {
10646 vector m4[4];
10647 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10648
10649 EntityAI root = GetHierarchyRoot();
10650
10651 InventoryLocation dst = new InventoryLocation;
10652 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
10653 {
10654 if (root)
10655 {
10656 root.GetTransform(m4);
10657 dst.SetGround(this, m4);
10658 }
10659 else
10660 GetInventory().GetCurrentInventoryLocation(dst);
10661 }
10662 else
10663 {
10664 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10665 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10666 this shouldnt cause issues within this scope*/
10667 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10668 {
10669 if (root)
10670 {
10671 root.GetTransform(m4);
10672 dst.SetGround(this, m4);
10673 }
10674 else
10675 GetInventory().GetCurrentInventoryLocation(dst);
10676 }
10677 else
10678 {
10679 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10680 }
10681 }
10682
10683 ScriptInputUserData ctx = new ScriptInputUserData;
10685 ctx.Write(4);
10686 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10687 ctx.Write(thiz);
10688 dst.WriteToContext(ctx);
10689 ctx.Write(true); // dummy
10690 ctx.Send();
10691 }
10692 }
10693 else if (!GetGame().IsMultiplayer())
10694 {
10695 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10696 }
10697 }
10698 }
10699
10700 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10701 {
10702 //TODO: delete check zero quantity check after fix double posts hands fsm events
10703 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10704 return false;
10705
10706 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10707 return false;
10708
10709 //can_this_be_combined = ConfigGetBool("canBeSplit");
10711 return false;
10712
10713
10714 Magazine mag = Magazine.Cast(this);
10715 if (mag)
10716 {
10717 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10718 return false;
10719
10720 if (stack_max_limit)
10721 {
10722 Magazine other_mag = Magazine.Cast(other_item);
10723 if (other_item)
10724 {
10725 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10726 return false;
10727 }
10728
10729 }
10730 }
10731 else
10732 {
10733 //TODO: delete check zero quantity check after fix double posts hands fsm events
10734 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10735 return false;
10736
10737 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10738 return false;
10739 }
10740
10741 PlayerBase player = null;
10742 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10743 {
10744 if (player.GetInventory().HasAttachment(this))
10745 return false;
10746
10747 if (player.IsItemsToDelete())
10748 return false;
10749 }
10750
10751 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10752 return false;
10753
10754 int slotID;
10755 string slotName;
10756 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10757 return false;
10758
10759 return true;
10760 }
10761
10762 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
10763 {
10764 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
10765 }
10766
10767 bool IsResultOfSplit()
10768 {
10769 return m_IsResultOfSplit;
10770 }
10771
10772 void SetResultOfSplit(bool value)
10773 {
10774 m_IsResultOfSplit = value;
10775 }
10776
10777 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10778 {
10779 return ComputeQuantityUsedEx(other_item, use_stack_max);
10780 }
10781
10782 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10783 {
10784 float other_item_quantity = other_item.GetQuantity();
10785 float this_free_space;
10786
10787 float stack_max = GetQuantityMax();
10788
10789 this_free_space = stack_max - GetQuantity();
10790
10791 if (other_item_quantity > this_free_space)
10792 {
10793 return this_free_space;
10794 }
10795 else
10796 {
10797 return other_item_quantity;
10798 }
10799 }
10800
10801 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10802 {
10803 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10804 }
10805
10806 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10807 {
10808 if (!CanBeCombined(other_item, false))
10809 return;
10810
10811 if (!IsMagazine() && other_item)
10812 {
10813 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10814 if (quantity_used != 0)
10815 {
10816 float hp1 = GetHealth01("","");
10817 float hp2 = other_item.GetHealth01("","");
10818 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10819 hpResult = hpResult / (GetQuantity() + quantity_used);
10820
10821 hpResult *= GetMaxHealth();
10822 Math.Round(hpResult);
10823 SetHealth("", "Health", hpResult);
10824
10825 AddQuantity(quantity_used);
10826 other_item.AddQuantity(-quantity_used);
10827 }
10828 }
10829 OnCombine(other_item);
10830 }
10831
10832 void OnCombine(ItemBase other_item)
10833 {
10834 #ifdef SERVER
10835 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10836 GetHierarchyParent().IncreaseLifetimeUp();
10837 #endif
10838 };
10839
10840 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
10841 {
10842 PlayerBase p = PlayerBase.Cast(player);
10843
10844 array<int> recipesIds = p.m_Recipes;
10845 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10846 if (moduleRecipesManager)
10847 {
10848 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10849 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
10850 }
10851
10852 for (int i = 0;i < recipesIds.Count(); i++)
10853 {
10854 int key = recipesIds.Get(i);
10855 string recipeName = moduleRecipesManager.GetRecipeName(key);
10856 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
10857 }
10858 }
10859
10860 // -------------------------------------------------------------------------
10861 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10862 {
10863 super.GetDebugActions(outputList);
10864
10865 //quantity
10866 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
10867 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
10868 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
10869 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
10870
10871 //health
10872 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
10873 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
10874 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
10875 //temperature
10876 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
10877 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
10878 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
10879
10880 //wet
10881 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
10882 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
10883
10884 //liquidtype
10885 if (IsLiquidContainer())
10886 {
10887 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
10888 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
10889 }
10890
10891 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
10892 // watch
10893 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
10894 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
10895
10896 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10897 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
10898 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10899 }
10900
10901 // -------------------------------------------------------------------------
10902 // -------------------------------------------------------------------------
10903 // -------------------------------------------------------------------------
10904 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
10905 {
10906 super.OnAction(action_id, player, ctx);
10907 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
10908 {
10909 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10910 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
10911 PlayerBase p = PlayerBase.Cast(player);
10912 if (EActions.RECIPES_RANGE_START < 1000)
10913 {
10914 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10915 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10916 }
10917 }
10918 #ifndef SERVER
10919 else if (action_id == EActions.WATCH_PLAYER)
10920 {
10921 PluginDeveloper.SetDeveloperItemClientEx(player);
10922 }
10923 #endif
10924 if (GetGame().IsServer())
10925 {
10926 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10927 {
10928 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10929 OnDebugButtonPressServer(id + 1);
10930 }
10931
10932 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10933 {
10934 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10935 InsertAgent(agent_id,100);
10936 }
10937
10938 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10939 {
10940 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10941 RemoveAgent(agent_id2);
10942 }
10943
10944 else if (action_id == EActions.ADD_QUANTITY)
10945 {
10946 if (IsMagazine())
10947 {
10948 Magazine mag = Magazine.Cast(this);
10949 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10950 }
10951 else
10952 {
10953 AddQuantity(GetQuantityMax() * 0.2);
10954 }
10955
10956 if (m_EM)
10957 {
10958 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10959 }
10960 //PrintVariables();
10961 }
10962
10963 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
10964 {
10965 if (IsMagazine())
10966 {
10967 Magazine mag2 = Magazine.Cast(this);
10968 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10969 }
10970 else
10971 {
10972 AddQuantity(- GetQuantityMax() * 0.2);
10973 }
10974 if (m_EM)
10975 {
10976 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10977 }
10978 //PrintVariables();
10979 }
10980
10981 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
10982 {
10983 SetQuantity(0);
10984
10985 if (m_EM)
10986 {
10987 m_EM.SetEnergy(0);
10988 }
10989 }
10990
10991 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
10992 {
10994
10995 if (m_EM)
10996 {
10997 m_EM.SetEnergy(m_EM.GetEnergyMax());
10998 }
10999 }
11000
11001 else if (action_id == EActions.ADD_HEALTH)
11002 {
11003 AddHealth("","",GetMaxHealth("","Health")/5);
11004 }
11005 else if (action_id == EActions.REMOVE_HEALTH)
11006 {
11007 AddHealth("","",-GetMaxHealth("","Health")/5);
11008 }
11009 else if (action_id == EActions.DESTROY_HEALTH)
11010 {
11011 SetHealth01("","",0);
11012 }
11013 else if (action_id == EActions.WATCH_ITEM)
11014 {
11016 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
11017 #ifdef DEVELOPER
11018 SetDebugDeveloper_item(this);
11019 #endif
11020 }
11021
11022 else if (action_id == EActions.ADD_TEMPERATURE)
11023 {
11024 AddTemperature(20);
11025 //PrintVariables();
11026 }
11027
11028 else if (action_id == EActions.REMOVE_TEMPERATURE)
11029 {
11030 AddTemperature(-20);
11031 //PrintVariables();
11032 }
11033
11034 else if (action_id == EActions.FLIP_FROZEN)
11035 {
11036 SetFrozen(!GetIsFrozen());
11037 //PrintVariables();
11038 }
11039
11040 else if (action_id == EActions.ADD_WETNESS)
11041 {
11042 AddWet(GetWetMax()/5);
11043 //PrintVariables();
11044 }
11045
11046 else if (action_id == EActions.REMOVE_WETNESS)
11047 {
11048 AddWet(-GetWetMax()/5);
11049 //PrintVariables();
11050 }
11051
11052 else if (action_id == EActions.LIQUIDTYPE_UP)
11053 {
11054 int curr_type = GetLiquidType();
11055 SetLiquidType(curr_type * 2);
11056 //AddWet(1);
11057 //PrintVariables();
11058 }
11059
11060 else if (action_id == EActions.LIQUIDTYPE_DOWN)
11061 {
11062 int curr_type2 = GetLiquidType();
11063 SetLiquidType(curr_type2 / 2);
11064 }
11065
11066 else if (action_id == EActions.MAKE_SPECIAL)
11067 {
11068 auto debugParams = DebugSpawnParams.WithPlayer(player);
11069 OnDebugSpawnEx(debugParams);
11070 }
11071
11072 else if (action_id == EActions.DELETE)
11073 {
11074 Delete();
11075 }
11076
11077 }
11078
11079
11080 return false;
11081 }
11082
11083 // -------------------------------------------------------------------------
11084
11085
11088 void OnActivatedByTripWire();
11089
11091 void OnActivatedByItem(notnull ItemBase item);
11092
11093 //----------------------------------------------------------------
11094 //returns true if item is able to explode when put in fire
11095 bool CanExplodeInFire()
11096 {
11097 return false;
11098 }
11099
11100 //----------------------------------------------------------------
11101 bool CanEat()
11102 {
11103 return true;
11104 }
11105
11106 //----------------------------------------------------------------
11107 override bool IsIgnoredByConstruction()
11108 {
11109 return true;
11110 }
11111
11112 //----------------------------------------------------------------
11113 //has FoodStages in config?
11114 bool HasFoodStage()
11115 {
11116 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
11117 return GetGame().ConfigIsExisting(config_path);
11118 }
11119
11121 FoodStage GetFoodStage()
11122 {
11123 return null;
11124 }
11125
11126 bool CanBeCooked()
11127 {
11128 return false;
11129 }
11130
11131 bool CanBeCookedOnStick()
11132 {
11133 return false;
11134 }
11135
11137 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
11139
11140 //----------------------------------------------------------------
11141 bool CanRepair(ItemBase item_repair_kit)
11142 {
11143 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11144 return module_repairing.CanRepair(this, item_repair_kit);
11145 }
11146
11147 //----------------------------------------------------------------
11148 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
11149 {
11150 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11151 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11152 }
11153
11154 //----------------------------------------------------------------
11155 int GetItemSize()
11156 {
11157 /*
11158 vector v_size = this.ConfigGetVector("itemSize");
11159 int v_size_x = v_size[0];
11160 int v_size_y = v_size[1];
11161 int size = v_size_x * v_size_y;
11162 return size;
11163 */
11164
11165 return 1;
11166 }
11167
11168 //----------------------------------------------------------------
11169 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11170 bool CanBeMovedOverride()
11171 {
11172 return m_CanBeMovedOverride;
11173 }
11174
11175 //----------------------------------------------------------------
11176 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11177 void SetCanBeMovedOverride(bool setting)
11178 {
11179 m_CanBeMovedOverride = setting;
11180 }
11181
11182 //----------------------------------------------------------------
11190 void MessageToOwnerStatus(string text)
11191 {
11192 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11193
11194 if (player)
11195 {
11196 player.MessageStatus(text);
11197 }
11198 }
11199
11200 //----------------------------------------------------------------
11208 void MessageToOwnerAction(string text)
11209 {
11210 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11211
11212 if (player)
11213 {
11214 player.MessageAction(text);
11215 }
11216 }
11217
11218 //----------------------------------------------------------------
11226 void MessageToOwnerFriendly(string text)
11227 {
11228 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11229
11230 if (player)
11231 {
11232 player.MessageFriendly(text);
11233 }
11234 }
11235
11236 //----------------------------------------------------------------
11244 void MessageToOwnerImportant(string text)
11245 {
11246 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11247
11248 if (player)
11249 {
11250 player.MessageImportant(text);
11251 }
11252 }
11253
11254 override bool IsItemBase()
11255 {
11256 return true;
11257 }
11258
11259 // Checks if item is of questioned kind
11260 override bool KindOf(string tag)
11261 {
11262 bool found = false;
11263 string item_name = this.GetType();
11264 ref TStringArray item_tag_array = new TStringArray;
11265 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11266
11267 int array_size = item_tag_array.Count();
11268 for (int i = 0; i < array_size; i++)
11269 {
11270 if (item_tag_array.Get(i) == tag)
11271 {
11272 found = true;
11273 break;
11274 }
11275 }
11276 return found;
11277 }
11278
11279
11280 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11281 {
11282 //Debug.Log("OnRPC called");
11283 super.OnRPC(sender, rpc_type,ctx);
11284
11285 //Play soundset for attachment locking (ActionLockAttachment.c)
11286 switch (rpc_type)
11287 {
11288 #ifndef SERVER
11289 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11290 Param2<bool, string> p = new Param2<bool, string>(false, "");
11291
11292 if (!ctx.Read(p))
11293 return;
11294
11295 bool play = p.param1;
11296 string soundSet = p.param2;
11297
11298 if (play)
11299 {
11300 if (m_LockingSound)
11301 {
11303 {
11304 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11305 }
11306 }
11307 else
11308 {
11309 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11310 }
11311 }
11312 else
11313 {
11314 SEffectManager.DestroyEffect(m_LockingSound);
11315 }
11316
11317 break;
11318 #endif
11319
11320 }
11321
11322 if (GetWrittenNoteData())
11323 {
11324 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11325 }
11326 }
11327
11328 //-----------------------------
11329 // VARIABLE MANIPULATION SYSTEM
11330 //-----------------------------
11331 int NameToID(string name)
11332 {
11333 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11334 return plugin.GetID(name);
11335 }
11336
11337 string IDToName(int id)
11338 {
11339 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11340 return plugin.GetName(id);
11341 }
11342
11344 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11345 {
11346 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11347 //read the flags
11348 int varFlags;
11349 if (!ctx.Read(varFlags))
11350 return;
11351
11352 if (varFlags & ItemVariableFlags.FLOAT)
11353 {
11354 ReadVarsFromCTX(ctx);
11355 }
11356 }
11357
11358 override void SerializeNumericalVars(array<float> floats_out)
11359 {
11360 //some variables handled on EntityAI level already!
11361 super.SerializeNumericalVars(floats_out);
11362
11363 // the order of serialization must be the same as the order of de-serialization
11364 //--------------------------------------------
11365 if (IsVariableSet(VARIABLE_QUANTITY))
11366 {
11367 floats_out.Insert(m_VarQuantity);
11368 }
11369 //--------------------------------------------
11370 if (IsVariableSet(VARIABLE_WET))
11371 {
11372 floats_out.Insert(m_VarWet);
11373 }
11374 //--------------------------------------------
11375 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11376 {
11377 floats_out.Insert(m_VarLiquidType);
11378 }
11379 //--------------------------------------------
11380 if (IsVariableSet(VARIABLE_COLOR))
11381 {
11382 floats_out.Insert(m_ColorComponentR);
11383 floats_out.Insert(m_ColorComponentG);
11384 floats_out.Insert(m_ColorComponentB);
11385 floats_out.Insert(m_ColorComponentA);
11386 }
11387 //--------------------------------------------
11388 if (IsVariableSet(VARIABLE_CLEANNESS))
11389 {
11390 floats_out.Insert(m_Cleanness);
11391 }
11392 }
11393
11394 override void DeSerializeNumericalVars(array<float> floats)
11395 {
11396 //some variables handled on EntityAI level already!
11397 super.DeSerializeNumericalVars(floats);
11398
11399 // the order of serialization must be the same as the order of de-serialization
11400 int index = 0;
11401 int mask = Math.Round(floats.Get(index));
11402
11403 index++;
11404 //--------------------------------------------
11405 if (mask & VARIABLE_QUANTITY)
11406 {
11407 if (m_IsStoreLoad)
11408 {
11409 SetStoreLoadedQuantity(floats.Get(index));
11410 }
11411 else
11412 {
11413 float quantity = floats.Get(index);
11414 SetQuantity(quantity, true, false, false, false);
11415 }
11416 index++;
11417 }
11418 //--------------------------------------------
11419 if (mask & VARIABLE_WET)
11420 {
11421 float wet = floats.Get(index);
11422 SetWet(wet);
11423 index++;
11424 }
11425 //--------------------------------------------
11426 if (mask & VARIABLE_LIQUIDTYPE)
11427 {
11428 int liquidtype = Math.Round(floats.Get(index));
11429 SetLiquidType(liquidtype);
11430 index++;
11431 }
11432 //--------------------------------------------
11433 if (mask & VARIABLE_COLOR)
11434 {
11435 m_ColorComponentR = Math.Round(floats.Get(index));
11436 index++;
11437 m_ColorComponentG = Math.Round(floats.Get(index));
11438 index++;
11439 m_ColorComponentB = Math.Round(floats.Get(index));
11440 index++;
11441 m_ColorComponentA = Math.Round(floats.Get(index));
11442 index++;
11443 }
11444 //--------------------------------------------
11445 if (mask & VARIABLE_CLEANNESS)
11446 {
11447 int cleanness = Math.Round(floats.Get(index));
11448 SetCleanness(cleanness);
11449 index++;
11450 }
11451 }
11452
11453 override void WriteVarsToCTX(ParamsWriteContext ctx)
11454 {
11455 super.WriteVarsToCTX(ctx);
11456
11457 //--------------------------------------------
11458 if (IsVariableSet(VARIABLE_QUANTITY))
11459 {
11460 ctx.Write(GetQuantity());
11461 }
11462 //--------------------------------------------
11463 if (IsVariableSet(VARIABLE_WET))
11464 {
11465 ctx.Write(GetWet());
11466 }
11467 //--------------------------------------------
11468 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11469 {
11470 ctx.Write(GetLiquidType());
11471 }
11472 //--------------------------------------------
11473 if (IsVariableSet(VARIABLE_COLOR))
11474 {
11475 int r,g,b,a;
11476 GetColor(r,g,b,a);
11477 ctx.Write(r);
11478 ctx.Write(g);
11479 ctx.Write(b);
11480 ctx.Write(a);
11481 }
11482 //--------------------------------------------
11483 if (IsVariableSet(VARIABLE_CLEANNESS))
11484 {
11485 ctx.Write(GetCleanness());
11486 }
11487 }
11488
11489 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11490 {
11491 if (!super.ReadVarsFromCTX(ctx,version))
11492 return false;
11493
11494 int intValue;
11495 float value;
11496
11497 if (version < 140)
11498 {
11499 if (!ctx.Read(intValue))
11500 return false;
11501
11502 m_VariablesMask = intValue;
11503 }
11504
11505 if (m_VariablesMask & VARIABLE_QUANTITY)
11506 {
11507 if (!ctx.Read(value))
11508 return false;
11509
11510 if (IsStoreLoad())
11511 {
11513 }
11514 else
11515 {
11516 SetQuantity(value, true, false, false, false);
11517 }
11518 }
11519 //--------------------------------------------
11520 if (version < 140)
11521 {
11522 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11523 {
11524 if (!ctx.Read(value))
11525 return false;
11526 SetTemperatureDirect(value);
11527 }
11528 }
11529 //--------------------------------------------
11530 if (m_VariablesMask & VARIABLE_WET)
11531 {
11532 if (!ctx.Read(value))
11533 return false;
11534 SetWet(value);
11535 }
11536 //--------------------------------------------
11537 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11538 {
11539 if (!ctx.Read(intValue))
11540 return false;
11541 SetLiquidType(intValue);
11542 }
11543 //--------------------------------------------
11544 if (m_VariablesMask & VARIABLE_COLOR)
11545 {
11546 int r,g,b,a;
11547 if (!ctx.Read(r))
11548 return false;
11549 if (!ctx.Read(g))
11550 return false;
11551 if (!ctx.Read(b))
11552 return false;
11553 if (!ctx.Read(a))
11554 return false;
11555
11556 SetColor(r,g,b,a);
11557 }
11558 //--------------------------------------------
11559 if (m_VariablesMask & VARIABLE_CLEANNESS)
11560 {
11561 if (!ctx.Read(intValue))
11562 return false;
11563 SetCleanness(intValue);
11564 }
11565 //--------------------------------------------
11566 if (version >= 138 && version < 140)
11567 {
11568 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11569 {
11570 if (!ctx.Read(intValue))
11571 return false;
11572 SetFrozen(intValue);
11573 }
11574 }
11575
11576 return true;
11577 }
11578
11579 //----------------------------------------------------------------
11580 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11581 {
11582 m_IsStoreLoad = true;
11584 {
11585 m_FixDamageSystemInit = true;
11586 }
11587
11588 if (!super.OnStoreLoad(ctx, version))
11589 {
11590 m_IsStoreLoad = false;
11591 return false;
11592 }
11593
11594 if (version >= 114)
11595 {
11596 bool hasQuickBarIndexSaved;
11597
11598 if (!ctx.Read(hasQuickBarIndexSaved))
11599 {
11600 m_IsStoreLoad = false;
11601 return false;
11602 }
11603
11604 if (hasQuickBarIndexSaved)
11605 {
11606 int itmQBIndex;
11607
11608 //Load quickbar item bind
11609 if (!ctx.Read(itmQBIndex))
11610 {
11611 m_IsStoreLoad = false;
11612 return false;
11613 }
11614
11615 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11616 if (itmQBIndex != -1 && parentPlayer)
11617 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11618 }
11619 }
11620 else
11621 {
11622 // Backup of how it used to be
11623 PlayerBase player;
11624 int itemQBIndex;
11625 if (version == int.MAX)
11626 {
11627 if (!ctx.Read(itemQBIndex))
11628 {
11629 m_IsStoreLoad = false;
11630 return false;
11631 }
11632 }
11633 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11634 {
11635 //Load quickbar item bind
11636 if (!ctx.Read(itemQBIndex))
11637 {
11638 m_IsStoreLoad = false;
11639 return false;
11640 }
11641 if (itemQBIndex != -1 && player)
11642 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11643 }
11644 }
11645
11646 if (version < 140)
11647 {
11648 // variable management system
11649 if (!LoadVariables(ctx, version))
11650 {
11651 m_IsStoreLoad = false;
11652 return false;
11653 }
11654 }
11655
11656 //agent trasmission system
11657 if (!LoadAgents(ctx, version))
11658 {
11659 m_IsStoreLoad = false;
11660 return false;
11661 }
11662 if (version >= 132)
11663 {
11664 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11665 if (raib)
11666 {
11667 if (!raib.OnStoreLoad(ctx,version))
11668 {
11669 m_IsStoreLoad = false;
11670 return false;
11671 }
11672 }
11673 }
11674
11675 m_IsStoreLoad = false;
11676 return true;
11677 }
11678
11679 //----------------------------------------------------------------
11680
11681 override void OnStoreSave(ParamsWriteContext ctx)
11682 {
11683 super.OnStoreSave(ctx);
11684
11685 PlayerBase player;
11686 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11687 {
11688 ctx.Write(true); // Keep track of if we should actually read this in or not
11689 //Save quickbar item bind
11690 int itemQBIndex = -1;
11691 itemQBIndex = player.FindQuickBarEntityIndex(this);
11692 ctx.Write(itemQBIndex);
11693 }
11694 else
11695 {
11696 ctx.Write(false); // Keep track of if we should actually read this in or not
11697 }
11698
11699 SaveAgents(ctx);//agent trasmission system
11700
11701 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11702 if (raib)
11703 {
11704 raib.OnStoreSave(ctx);
11705 }
11706 }
11707 //----------------------------------------------------------------
11708
11709 override void AfterStoreLoad()
11710 {
11711 super.AfterStoreLoad();
11712
11714 {
11716 }
11717
11718 if (GetStoreLoadedQuantity() != float.LOWEST)
11719 {
11721 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
11722 }
11723 }
11724
11725 override void EEOnAfterLoad()
11726 {
11727 super.EEOnAfterLoad();
11728
11730 {
11731 m_FixDamageSystemInit = false;
11732 }
11733
11736 }
11737
11738 bool CanBeDisinfected()
11739 {
11740 return false;
11741 }
11742
11743
11744 //----------------------------------------------------------------
11745 override void OnVariablesSynchronized()
11746 {
11747 if (m_Initialized)
11748 {
11749 #ifdef PLATFORM_CONSOLE
11750 //bruteforce it is
11751 if (IsSplitable())
11752 {
11753 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
11754 if (menu)
11755 {
11756 menu.Refresh();
11757 }
11758 }
11759 #endif
11760 }
11761
11763 {
11764 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
11765 m_WantPlayImpactSound = false;
11766 }
11767
11769 {
11770 SetWeightDirty();
11772 }
11773 if (m_VarWet != m_VarWetPrev)
11774 {
11777 }
11778
11779 if (m_SoundSyncPlay != 0)
11780 {
11781 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11782 m_SoundSyncPlay = 0;
11783 }
11784 if (m_SoundSyncStop != 0)
11785 {
11786 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11787 m_SoundSyncStop = 0;
11788 }
11789
11790 super.OnVariablesSynchronized();
11791 }
11792
11793 //------------------------- Quantity
11794 //----------------------------------------------------------------
11796 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11797 {
11798 if (!IsServerCheck(allow_client))
11799 return false;
11800
11801 if (!HasQuantity())
11802 return false;
11803
11804 float min = GetQuantityMin();
11805 float max = GetQuantityMax();
11806
11807 if (value <= (min + 0.001))
11808 value = min;
11809
11810 if (value == min)
11811 {
11812 if (destroy_config)
11813 {
11814 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11815 if (dstr)
11816 {
11817 m_VarQuantity = Math.Clamp(value, min, max);
11818 this.Delete();
11819 return true;
11820 }
11821 }
11822 else if (destroy_forced)
11823 {
11824 m_VarQuantity = Math.Clamp(value, min, max);
11825 this.Delete();
11826 return true;
11827 }
11828 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11829 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11830 }
11831
11832 float delta = m_VarQuantity;
11833 m_VarQuantity = Math.Clamp(value, min, max);
11834
11835 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11836 {
11837 delta = m_VarQuantity - delta;
11838
11839 if (delta)
11840 OnQuantityChanged(delta);
11841 }
11842
11843 SetVariableMask(VARIABLE_QUANTITY);
11844
11845 return false;
11846 }
11847
11848 //----------------------------------------------------------------
11850 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
11851 {
11852 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
11853 }
11854 //----------------------------------------------------------------
11855 void SetQuantityMax()
11856 {
11857 float max = GetQuantityMax();
11858 SetQuantity(max);
11859 }
11860
11861 override void SetQuantityToMinimum()
11862 {
11863 float min = GetQuantityMin();
11864 SetQuantity(min);
11865 }
11866 //----------------------------------------------------------------
11868 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
11869 {
11870 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
11871 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
11872 SetQuantity(result, destroy_config, destroy_forced);
11873 }
11874
11875 //----------------------------------------------------------------
11877 override float GetQuantityNormalized()
11878 {
11879 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
11880 }
11881
11883 {
11884 return GetQuantityNormalized();
11885 }
11886
11887 /*void SetAmmoNormalized(float value)
11888 {
11889 float value_clamped = Math.Clamp(value, 0, 1);
11890 Magazine this_mag = Magazine.Cast(this);
11891 int max_rounds = this_mag.GetAmmoMax();
11892 int result = value * max_rounds;//can the rounded if higher precision is required
11893 this_mag.SetAmmoCount(result);
11894 }*/
11895 //----------------------------------------------------------------
11896 override int GetQuantityMax()
11897 {
11898 int slot = -1;
11899 if (GetInventory())
11900 {
11901 InventoryLocation il = new InventoryLocation;
11902 GetInventory().GetCurrentInventoryLocation(il);
11903 slot = il.GetSlot();
11904 }
11905
11906 return GetTargetQuantityMax(slot);
11907 }
11908
11909 override int GetTargetQuantityMax(int attSlotID = -1)
11910 {
11911 float quantity_max = 0;
11912
11913 if (IsSplitable()) //only stackable/splitable items can check for stack size
11914 {
11915 if (attSlotID != -1)
11916 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11917
11918 if (quantity_max <= 0)
11919 quantity_max = m_VarStackMax;
11920 }
11921
11922 if (quantity_max <= 0)
11923 quantity_max = m_VarQuantityMax;
11924
11925 return quantity_max;
11926 }
11927 //----------------------------------------------------------------
11928 override int GetQuantityMin()
11929 {
11930 return m_VarQuantityMin;
11931 }
11932 //----------------------------------------------------------------
11933 int GetQuantityInit()
11934 {
11935 return m_VarQuantityInit;
11936 }
11937
11938 //----------------------------------------------------------------
11939 override bool HasQuantity()
11940 {
11941 return !(GetQuantityMax() - GetQuantityMin() == 0);
11942 }
11943
11944 override float GetQuantity()
11945 {
11946 return m_VarQuantity;
11947 }
11948
11949 bool IsFullQuantity()
11950 {
11951 return GetQuantity() >= GetQuantityMax();
11952 }
11953
11954 //Calculates weight of single item without attachments and cargo
11955 override float GetSingleInventoryItemWeightEx()
11956 {
11957 //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
11958 float weightEx = GetWeightEx();//overall weight of the item
11959 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
11960 return weightEx - special;
11961 }
11962
11963 // Obsolete, use GetSingleInventoryItemWeightEx() instead
11965 {
11967 }
11968
11969 override protected float GetWeightSpecialized(bool forceRecalc = false)
11970 {
11971 if (IsSplitable()) //quantity determines size of the stack
11972 {
11973 #ifdef DEVELOPER
11974 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11975 {
11976 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11977 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
11978 }
11979 #endif
11980
11981 return GetQuantity() * GetConfigWeightModified();
11982 }
11983 else if (HasEnergyManager())// items with energy manager
11984 {
11985 #ifdef DEVELOPER
11986 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11987 {
11988 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11989 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
11990 }
11991 #endif
11992 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11993 }
11994 else//everything else
11995 {
11996 #ifdef DEVELOPER
11997 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11998 {
11999 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12000 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
12001 }
12002 #endif
12003 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12004 }
12005 }
12006
12008 int GetNumberOfItems()
12009 {
12010 int item_count = 0;
12011 ItemBase item;
12012
12013 if (GetInventory().GetCargo() != NULL)
12014 {
12015 item_count = GetInventory().GetCargo().GetItemCount();
12016 }
12017
12018 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12019 {
12020 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12021 if (item)
12022 item_count += item.GetNumberOfItems();
12023 }
12024 return item_count;
12025 }
12026
12028 float GetUnitWeight(bool include_wetness = true)
12029 {
12030 float weight = 0;
12031 float wetness = 1;
12032 if (include_wetness)
12033 wetness += GetWet();
12034 if (IsSplitable()) //quantity determines size of the stack
12035 {
12036 weight = wetness * m_ConfigWeight;
12037 }
12038 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
12039 {
12040 weight = 1;
12041 }
12042 return weight;
12043 }
12044
12045 //-----------------------------------------------------------------
12046
12047 override void ClearInventory()
12048 {
12049 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
12050 {
12051 GameInventory inv = GetInventory();
12052 array<EntityAI> items = new array<EntityAI>;
12053 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
12054 for (int i = 0; i < items.Count(); i++)
12055 {
12056 ItemBase item = ItemBase.Cast(items.Get(i));
12057 if (item)
12058 {
12059 GetGame().ObjectDelete(item);
12060 }
12061 }
12062 }
12063 }
12064
12065 //------------------------- Energy
12066
12067 //----------------------------------------------------------------
12068 float GetEnergy()
12069 {
12070 float energy = 0;
12071 if (HasEnergyManager())
12072 {
12073 energy = GetCompEM().GetEnergy();
12074 }
12075 return energy;
12076 }
12077
12078
12079 override void OnEnergyConsumed()
12080 {
12081 super.OnEnergyConsumed();
12082
12084 }
12085
12086 override void OnEnergyAdded()
12087 {
12088 super.OnEnergyAdded();
12089
12091 }
12092
12093 // Converts energy (from Energy Manager) to quantity, if enabled.
12095 {
12096 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12097 {
12098 if (HasQuantity())
12099 {
12100 float energy_0to1 = GetCompEM().GetEnergy0To1();
12101 SetQuantityNormalized(energy_0to1);
12102 }
12103 }
12104 }
12105
12106 //----------------------------------------------------------------
12107 float GetHeatIsolationInit()
12108 {
12109 return ConfigGetFloat("heatIsolation");
12110 }
12111
12112 float GetHeatIsolation()
12113 {
12114 return m_HeatIsolation;
12115 }
12116
12117 float GetDryingIncrement(string pIncrementName)
12118 {
12119 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
12120 if (GetGame().ConfigIsExisting(paramPath))
12121 return GetGame().ConfigGetFloat(paramPath);
12122
12123 return 0.0;
12124 }
12125
12126 float GetSoakingIncrement(string pIncrementName)
12127 {
12128 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
12129 if (GetGame().ConfigIsExisting(paramPath))
12130 return GetGame().ConfigGetFloat(paramPath);
12131
12132 return 0.0;
12133 }
12134 //----------------------------------------------------------------
12135 override void SetWet(float value, bool allow_client = false)
12136 {
12137 if (!IsServerCheck(allow_client))
12138 return;
12139
12140 float min = GetWetMin();
12141 float max = GetWetMax();
12142
12143 float previousValue = m_VarWet;
12144
12145 m_VarWet = Math.Clamp(value, min, max);
12146
12147 if (previousValue != m_VarWet)
12148 {
12149 SetVariableMask(VARIABLE_WET);
12150 OnWetChanged(m_VarWet, previousValue);
12151 }
12152 }
12153 //----------------------------------------------------------------
12154 override void AddWet(float value)
12155 {
12156 SetWet(GetWet() + value);
12157 }
12158 //----------------------------------------------------------------
12159 override void SetWetMax()
12160 {
12162 }
12163 //----------------------------------------------------------------
12164 override float GetWet()
12165 {
12166 return m_VarWet;
12167 }
12168 //----------------------------------------------------------------
12169 override float GetWetMax()
12170 {
12171 return m_VarWetMax;
12172 }
12173 //----------------------------------------------------------------
12174 override float GetWetMin()
12175 {
12176 return m_VarWetMin;
12177 }
12178 //----------------------------------------------------------------
12179 override float GetWetInit()
12180 {
12181 return m_VarWetInit;
12182 }
12183 //----------------------------------------------------------------
12184 override void OnWetChanged(float newVal, float oldVal)
12185 {
12186 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
12187 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
12188 if (newLevel != oldLevel)
12189 {
12190 OnWetLevelChanged(newLevel,oldLevel);
12191 }
12192 }
12193
12194 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
12195 {
12196 SetWeightDirty();
12197 }
12198
12199 override EWetnessLevel GetWetLevel()
12200 {
12201 return GetWetLevelInternal(m_VarWet);
12202 }
12203
12204 //----------------------------------------------------------------
12205
12206 override void SetStoreLoad(bool value)
12207 {
12208 m_IsStoreLoad = value;
12209 }
12210
12211 override bool IsStoreLoad()
12212 {
12213 return m_IsStoreLoad;
12214 }
12215
12216 override void SetStoreLoadedQuantity(float value)
12217 {
12218 m_StoreLoadedQuantity = value;
12219 }
12220
12221 override float GetStoreLoadedQuantity()
12222 {
12223 return m_StoreLoadedQuantity;
12224 }
12225
12226 //----------------------------------------------------------------
12227
12228 float GetItemModelLength()
12229 {
12230 if (ConfigIsExisting("itemModelLength"))
12231 {
12232 return ConfigGetFloat("itemModelLength");
12233 }
12234 return 0;
12235 }
12236
12237 float GetItemAttachOffset()
12238 {
12239 if (ConfigIsExisting("itemAttachOffset"))
12240 {
12241 return ConfigGetFloat("itemAttachOffset");
12242 }
12243 return 0;
12244 }
12245
12246 override void SetCleanness(int value, bool allow_client = false)
12247 {
12248 if (!IsServerCheck(allow_client))
12249 return;
12250
12251 int previousValue = m_Cleanness;
12252
12253 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
12254
12255 if (previousValue != m_Cleanness)
12256 SetVariableMask(VARIABLE_CLEANNESS);
12257 }
12258
12259 override int GetCleanness()
12260 {
12261 return m_Cleanness;
12262 }
12263
12265 {
12266 return true;
12267 }
12268
12269 //----------------------------------------------------------------
12270 // ATTACHMENT LOCKING
12271 // Getters relevant to generic ActionLockAttachment
12272 int GetLockType()
12273 {
12274 return m_LockType;
12275 }
12276
12277 string GetLockSoundSet()
12278 {
12279 return m_LockSoundSet;
12280 }
12281
12282 //----------------------------------------------------------------
12283 //------------------------- Color
12284 // sets items color variable given color components
12285 override void SetColor(int r, int g, int b, int a)
12286 {
12291 SetVariableMask(VARIABLE_COLOR);
12292 }
12294 override void GetColor(out int r,out int g,out int b,out int a)
12295 {
12300 }
12301
12302 bool IsColorSet()
12303 {
12304 return IsVariableSet(VARIABLE_COLOR);
12305 }
12306
12308 string GetColorString()
12309 {
12310 int r,g,b,a;
12311 GetColor(r,g,b,a);
12312 r = r/255;
12313 g = g/255;
12314 b = b/255;
12315 a = a/255;
12316 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12317 }
12318 //----------------------------------------------------------------
12319 //------------------------- LiquidType
12320
12321 override void SetLiquidType(int value, bool allow_client = false)
12322 {
12323 if (!IsServerCheck(allow_client))
12324 return;
12325
12326 int old = m_VarLiquidType;
12327 m_VarLiquidType = value;
12328 OnLiquidTypeChanged(old,value);
12329 SetVariableMask(VARIABLE_LIQUIDTYPE);
12330 }
12331
12332 int GetLiquidTypeInit()
12333 {
12334 return ConfigGetInt("varLiquidTypeInit");
12335 }
12336
12337 override int GetLiquidType()
12338 {
12339 return m_VarLiquidType;
12340 }
12341
12342 protected void OnLiquidTypeChanged(int oldType, int newType)
12343 {
12344 if (newType == LIQUID_NONE && GetIsFrozen())
12345 SetFrozen(false);
12346 }
12347
12349 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12350 {
12351 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12352 }
12353
12354 // -------------------------------------------------------------------------
12356 void OnInventoryEnter(Man player)
12357 {
12358 PlayerBase nplayer;
12359 if (PlayerBase.CastTo(nplayer, player))
12360 {
12361 m_CanPlayImpactSound = true;
12362 //nplayer.OnItemInventoryEnter(this);
12363 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12364 }
12365 }
12366
12367 // -------------------------------------------------------------------------
12369 void OnInventoryExit(Man player)
12370 {
12371 PlayerBase nplayer;
12372 if (PlayerBase.CastTo(nplayer,player))
12373 {
12374 //nplayer.OnItemInventoryExit(this);
12375 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12376
12377 }
12378
12379 //if (!GetGame().IsDedicatedServer())
12380 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12381
12382
12383 if (HasEnergyManager())
12384 {
12385 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12386 }
12387 }
12388
12389 // ADVANCED PLACEMENT EVENTS
12390 override void OnPlacementStarted(Man player)
12391 {
12392 super.OnPlacementStarted(player);
12393
12394 SetTakeable(false);
12395 }
12396
12397 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12398 {
12399 if (m_AdminLog)
12400 {
12401 m_AdminLog.OnPlacementComplete(player, this);
12402 }
12403
12404 super.OnPlacementComplete(player, position, orientation);
12405 }
12406
12407 //-----------------------------
12408 // AGENT SYSTEM
12409 //-----------------------------
12410 //--------------------------------------------------------------------------
12411 bool ContainsAgent(int agent_id)
12412 {
12413 if (agent_id & m_AttachedAgents)
12414 {
12415 return true;
12416 }
12417 else
12418 {
12419 return false;
12420 }
12421 }
12422
12423 //--------------------------------------------------------------------------
12424 override void RemoveAgent(int agent_id)
12425 {
12426 if (ContainsAgent(agent_id))
12427 {
12428 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12429 }
12430 }
12431
12432 //--------------------------------------------------------------------------
12433 override void RemoveAllAgents()
12434 {
12435 m_AttachedAgents = 0;
12436 }
12437 //--------------------------------------------------------------------------
12438 override void RemoveAllAgentsExcept(int agent_to_keep)
12439 {
12440 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12441 }
12442 // -------------------------------------------------------------------------
12443 override void InsertAgent(int agent, float count = 1)
12444 {
12445 if (count < 1)
12446 return;
12447 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12449 }
12450
12452 void TransferAgents(int agents)
12453 {
12455 }
12456
12457 // -------------------------------------------------------------------------
12458 override int GetAgents()
12459 {
12460 return m_AttachedAgents;
12461 }
12462 //----------------------------------------------------------------------
12463
12464 /*int GetContaminationType()
12465 {
12466 int contamination_type;
12467
12468 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12469 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12470 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12471 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12472
12473 Edible_Base edible = Edible_Base.Cast(this);
12474 int agents = GetAgents();
12475 if (edible)
12476 {
12477 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12478 if (profile)
12479 {
12480 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12481 }
12482 }
12483 if (agents & CONTAMINATED_MASK)
12484 {
12485 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12486 }
12487 if (agents & POISONED_MASK)
12488 {
12489 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12490 }
12491 if (agents & NERVE_GAS_MASK)
12492 {
12493 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12494 }
12495 if (agents & DIRTY_MASK)
12496 {
12497 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12498 }
12499
12500 return agents;
12501 }*/
12502
12503 // -------------------------------------------------------------------------
12504 bool LoadAgents(ParamsReadContext ctx, int version)
12505 {
12506 if (!ctx.Read(m_AttachedAgents))
12507 return false;
12508 return true;
12509 }
12510 // -------------------------------------------------------------------------
12512 {
12513
12515 }
12516 // -------------------------------------------------------------------------
12517
12519 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12520 {
12521 super.CheckForRoofLimited(timeTresholdMS);
12522
12523 float time = GetGame().GetTime();
12524 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12525 {
12526 m_PreviousRoofTestTime = time;
12527 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12528 }
12529 }
12530
12531 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12532 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12533 {
12534 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12535 {
12536 return 0;
12537 }
12538
12539 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12540 {
12541 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12542 if (filter)
12543 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12544 else
12545 return 0;//otherwise return 0 when no filter attached
12546 }
12547
12548 string subclassPath, entryName;
12549
12550 switch (type)
12551 {
12552 case DEF_BIOLOGICAL:
12553 entryName = "biological";
12554 break;
12555 case DEF_CHEMICAL:
12556 entryName = "chemical";
12557 break;
12558 default:
12559 entryName = "biological";
12560 break;
12561 }
12562
12563 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12564
12565 return GetGame().ConfigGetFloat(subclassPath + entryName);
12566 }
12567
12568
12569
12571 override void EEOnCECreate()
12572 {
12573 if (!IsMagazine())
12575
12577 }
12578
12579
12580 //-------------------------
12581 // OPEN/CLOSE USER ACTIONS
12582 //-------------------------
12584 void Open();
12585 void Close();
12586 bool IsOpen()
12587 {
12588 return true;
12589 }
12590
12591 override bool CanDisplayCargo()
12592 {
12593 return IsOpen();
12594 }
12595
12596
12597 // ------------------------------------------------------------
12598 // CONDITIONS
12599 // ------------------------------------------------------------
12600 override bool CanPutInCargo(EntityAI parent)
12601 {
12602 if (parent)
12603 {
12604 if (parent.IsInherited(DayZInfected))
12605 return true;
12606
12607 if (!parent.IsRuined())
12608 return true;
12609 }
12610
12611 return true;
12612 }
12613
12614 override bool CanPutAsAttachment(EntityAI parent)
12615 {
12616 if (!super.CanPutAsAttachment(parent))
12617 {
12618 return false;
12619 }
12620
12621 if (!IsRuined() && !parent.IsRuined())
12622 {
12623 return true;
12624 }
12625
12626 return false;
12627 }
12628
12629 override bool CanReceiveItemIntoCargo(EntityAI item)
12630 {
12631 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12632 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12633 // return false;
12634
12635 return super.CanReceiveItemIntoCargo(item);
12636 }
12637
12638 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12639 {
12640 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12641 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12642 // return false;
12643
12644 GameInventory attachmentInv = attachment.GetInventory();
12645 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12646 {
12647 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12648 return false;
12649 }
12650
12651 InventoryLocation loc = new InventoryLocation();
12652 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12653 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12654 return false;
12655
12656 return super.CanReceiveAttachment(attachment, slotId);
12657 }
12658
12659 override bool CanReleaseAttachment(EntityAI attachment)
12660 {
12661 if (!super.CanReleaseAttachment(attachment))
12662 return false;
12663
12664 return GetInventory().AreChildrenAccessible();
12665 }
12666
12667 /*override bool CanLoadAttachment(EntityAI attachment)
12668 {
12669 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12670 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12671 // return false;
12672
12673 GameInventory attachmentInv = attachment.GetInventory();
12674 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12675 {
12676 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12677 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12678
12679 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12680 return false;
12681 }
12682
12683 return super.CanLoadAttachment(attachment);
12684 }*/
12685
12686 // Plays muzzle flash particle effects
12687 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12688 {
12689 int id = muzzle_owner.GetMuzzleID();
12690 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12691
12692 if (WPOF_array)
12693 {
12694 for (int i = 0; i < WPOF_array.Count(); i++)
12695 {
12696 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12697
12698 if (WPOF)
12699 {
12700 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12701 }
12702 }
12703 }
12704 }
12705
12706 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12707 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12708 {
12709 int id = muzzle_owner.GetMuzzleID();
12710 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12711
12712 if (WPOBE_array)
12713 {
12714 for (int i = 0; i < WPOBE_array.Count(); i++)
12715 {
12716 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12717
12718 if (WPOBE)
12719 {
12720 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12721 }
12722 }
12723 }
12724 }
12725
12726 // Plays all weapon overheating particles
12727 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12728 {
12729 int id = muzzle_owner.GetMuzzleID();
12730 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12731
12732 if (WPOOH_array)
12733 {
12734 for (int i = 0; i < WPOOH_array.Count(); i++)
12735 {
12736 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12737
12738 if (WPOOH)
12739 {
12740 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12741 }
12742 }
12743 }
12744 }
12745
12746 // Updates all weapon overheating particles
12747 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12748 {
12749 int id = muzzle_owner.GetMuzzleID();
12750 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12751
12752 if (WPOOH_array)
12753 {
12754 for (int i = 0; i < WPOOH_array.Count(); i++)
12755 {
12756 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12757
12758 if (WPOOH)
12759 {
12760 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12761 }
12762 }
12763 }
12764 }
12765
12766 // Stops overheating particles
12767 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12768 {
12769 int id = muzzle_owner.GetMuzzleID();
12770 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12771
12772 if (WPOOH_array)
12773 {
12774 for (int i = 0; i < WPOOH_array.Count(); i++)
12775 {
12776 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12777
12778 if (WPOOH)
12779 {
12780 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12781 }
12782 }
12783 }
12784 }
12785
12786 //----------------------------------------------------------------
12787 //Item Behaviour - unified approach
12788 override bool IsHeavyBehaviour()
12789 {
12790 if (m_ItemBehaviour == 0)
12791 {
12792 return true;
12793 }
12794
12795 return false;
12796 }
12797
12798 override bool IsOneHandedBehaviour()
12799 {
12800 if (m_ItemBehaviour == 1)
12801 {
12802 return true;
12803 }
12804
12805 return false;
12806 }
12807
12808 override bool IsTwoHandedBehaviour()
12809 {
12810 if (m_ItemBehaviour == 2)
12811 {
12812 return true;
12813 }
12814
12815 return false;
12816 }
12817
12818 bool IsDeployable()
12819 {
12820 return false;
12821 }
12822
12824 float GetDeployTime()
12825 {
12826 return UATimeSpent.DEFAULT_DEPLOY;
12827 }
12828
12829
12830 //----------------------------------------------------------------
12831 // Item Targeting (User Actions)
12832 override void SetTakeable(bool pState)
12833 {
12834 m_IsTakeable = pState;
12835 SetSynchDirty();
12836 }
12837
12838 override bool IsTakeable()
12839 {
12840 return m_IsTakeable;
12841 }
12842
12843 // For cases where we want to show object widget which cant be taken to hands
12845 {
12846 return false;
12847 }
12848
12850 protected void PreLoadSoundAttachmentType()
12851 {
12852 string att_type = "None";
12853
12854 if (ConfigIsExisting("soundAttType"))
12855 {
12856 att_type = ConfigGetString("soundAttType");
12857 }
12858
12859 m_SoundAttType = att_type;
12860 }
12861
12862 override string GetAttachmentSoundType()
12863 {
12864 return m_SoundAttType;
12865 }
12866
12867 //----------------------------------------------------------------
12868 //SOUNDS - ItemSoundHandler
12869 //----------------------------------------------------------------
12870
12871 string GetPlaceSoundset(); // played when deploy starts
12872 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
12873 string GetDeploySoundset(); // played when deploy sucessfully finishes
12874
12876 {
12877 if (!m_ItemSoundHandler)
12879
12880 return m_ItemSoundHandler;
12881 }
12882
12883 // override to initialize sounds
12884 protected void InitItemSounds()
12885 {
12886 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
12887 return;
12888
12890
12891 if (GetPlaceSoundset() != string.Empty)
12892 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
12893
12894 if (GetDeploySoundset() != string.Empty)
12895 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
12896
12897 SoundParameters params = new SoundParameters();
12898 params.m_Loop = true;
12899 if (GetLoopDeploySoundset() != string.Empty)
12900 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
12901 }
12902
12903 // Start sound using ItemSoundHandler
12904 void StartItemSoundServer(int id)
12905 {
12906 if (!GetGame().IsServer())
12907 return;
12908
12909 m_SoundSyncPlay = id;
12910 SetSynchDirty();
12911
12912 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
12914 }
12915
12916 // Stop sound using ItemSoundHandler
12917 void StopItemSoundServer(int id)
12918 {
12919 if (!GetGame().IsServer())
12920 return;
12921
12922 m_SoundSyncStop = id;
12923 SetSynchDirty();
12924
12925 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
12927 }
12928
12929 protected void ClearStartItemSoundServer()
12930 {
12931 m_SoundSyncPlay = 0;
12932 }
12933
12934 protected void ClearStopItemSoundServer()
12935 {
12936 m_SoundSyncStop = 0;
12937 }
12938
12940 void PlayAttachSound(string slot_type)
12941 {
12942 if (!GetGame().IsDedicatedServer())
12943 {
12944 if (ConfigIsExisting("attachSoundSet"))
12945 {
12946 string cfg_path = "";
12947 string soundset = "";
12948 string type_name = GetType();
12949
12950 TStringArray cfg_soundset_array = new TStringArray;
12951 TStringArray cfg_slot_array = new TStringArray;
12952 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12953 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12954
12955 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12956 {
12957 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12958 {
12959 if (cfg_slot_array[i] == slot_type)
12960 {
12961 soundset = cfg_soundset_array[i];
12962 break;
12963 }
12964 }
12965 }
12966
12967 if (soundset != "")
12968 {
12969 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
12970 sound.SetAutodestroy(true);
12971 }
12972 }
12973 }
12974 }
12975
12976 void PlayDetachSound(string slot_type)
12977 {
12978 //TODO - evaluate if needed and devise universal config structure if so
12979 }
12980
12981 void OnApply(PlayerBase player);
12982
12984 {
12985 return 1.0;
12986 };
12987 //returns applicable selection
12988 array<string> GetHeadHidingSelection()
12989 {
12991 }
12992
12994 {
12996 }
12997
12998 WrittenNoteData GetWrittenNoteData() {};
12999
13001 {
13002 SetDynamicPhysicsLifeTime(0.01);
13003 m_ItemBeingDroppedPhys = false;
13004 }
13005
13007 {
13008 array<string> zone_names = new array<string>;
13009 GetDamageZones(zone_names);
13010 for (int i = 0; i < zone_names.Count(); i++)
13011 {
13012 SetHealthMax(zone_names.Get(i),"Health");
13013 }
13014 SetHealthMax("","Health");
13015 }
13016
13018 void SetZoneDamageCEInit()
13019 {
13020 float global_health = GetHealth01("","Health");
13021 array<string> zones = new array<string>;
13022 GetDamageZones(zones);
13023 //set damage of all zones to match global health level
13024 for (int i = 0; i < zones.Count(); i++)
13025 {
13026 SetHealth01(zones.Get(i),"Health",global_health);
13027 }
13028 }
13029
13031 bool IsCoverFaceForShave(string slot_name)
13032 {
13033 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13034 }
13035
13036 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13037 {
13038 if (!hasRootAsPlayer)
13039 {
13040 if (refParentIB)
13041 {
13042 // parent is wet
13043 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
13044 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13045 // parent has liquid inside
13046 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
13047 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13048 // drying
13049 else if (m_VarWet > m_VarWetMin)
13050 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
13051 }
13052 else
13053 {
13054 // drying on ground or inside non-itembase (car, ...)
13055 if (m_VarWet > m_VarWetMin)
13056 AddWet(-1 * delta * GetDryingIncrement("ground"));
13057 }
13058 }
13059 }
13060
13061 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13062 {
13064 {
13065 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
13066 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
13067 {
13068 float heatPermCoef = 1.0;
13069 EntityAI ent = this;
13070 while (ent)
13071 {
13072 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13073 ent = ent.GetHierarchyParent();
13074 }
13075
13076 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13077 }
13078 }
13079 }
13080
13081 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
13082 {
13083 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
13084 EntityAI parent = GetHierarchyParent();
13085 if (!parent)
13086 {
13087 hasParent = false;
13088 hasRootAsPlayer = false;
13089 }
13090 else
13091 {
13092 hasParent = true;
13093 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13094 refParentIB = ItemBase.Cast(parent);
13095 }
13096 }
13097
13098 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
13099 {
13100 // this is stub, implemented on Edible_Base
13101 }
13102
13103 bool CanDecay()
13104 {
13105 // return true used on selected food clases so they can decay
13106 return false;
13107 }
13108
13109 protected bool CanProcessDecay()
13110 {
13111 // this is stub, implemented on Edible_Base class
13112 // used to determine whether it is still necessary for the food to decay
13113 return false;
13114 }
13115
13116 protected bool CanHaveWetness()
13117 {
13118 // return true used on selected items that have a wetness effect
13119 return false;
13120 }
13121
13123 bool CanBeConsumed(ConsumeConditionData data = null)
13124 {
13125 return !GetIsFrozen() && IsOpen();
13126 }
13127
13128 override void ProcessVariables()
13129 {
13130 bool hasParent = false, hasRootAsPlayer = false;
13131 ItemBase refParentIB;
13132
13133 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
13134 bool foodDecay = g_Game.IsFoodDecayEnabled();
13135
13136 if (wwtu || foodDecay)
13137 {
13138 bool processWetness = wwtu && CanHaveWetness();
13139 bool processTemperature = wwtu && CanHaveTemperature();
13140 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
13141
13142 if (processWetness || processTemperature || processDecay)
13143 {
13144 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
13145
13146 if (processWetness)
13147 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13148
13149 if (processTemperature)
13150 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13151
13152 if (processDecay)
13153 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13154 }
13155 }
13156 }
13157
13160 {
13161 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
13162 }
13163
13164 override float GetTemperatureFreezeThreshold()
13165 {
13167 return Liquid.GetFreezeThreshold(GetLiquidType());
13168
13169 return super.GetTemperatureFreezeThreshold();
13170 }
13171
13172 override float GetTemperatureThawThreshold()
13173 {
13175 return Liquid.GetThawThreshold(GetLiquidType());
13176
13177 return super.GetTemperatureThawThreshold();
13178 }
13179
13180 override float GetItemOverheatThreshold()
13181 {
13183 return Liquid.GetBoilThreshold(GetLiquidType());
13184
13185 return super.GetItemOverheatThreshold();
13186 }
13187
13188 override float GetTemperatureFreezeTime()
13189 {
13190 if (HasQuantity())
13191 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
13192
13193 return super.GetTemperatureFreezeTime();
13194 }
13195
13196 override float GetTemperatureThawTime()
13197 {
13198 if (HasQuantity())
13199 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
13200
13201 return super.GetTemperatureThawTime();
13202 }
13203
13205 void AffectLiquidContainerOnFill(int liquid_type, float amount);
13207 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
13208
13209 bool IsCargoException4x3(EntityAI item)
13210 {
13211 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13212 }
13213
13215 {
13216 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13217 }
13218
13220 void AddLightSourceItem(ItemBase lightsource)
13221 {
13222 m_LightSourceItem = lightsource;
13223 }
13224
13226 {
13227 m_LightSourceItem = null;
13228 }
13229
13231 {
13232 return m_LightSourceItem;
13233 }
13234
13236 array<int> GetValidFinishers()
13237 {
13238 return null;
13239 }
13240
13242 bool GetActionWidgetOverride(out typename name)
13243 {
13244 return false;
13245 }
13246
13247 bool PairWithDevice(notnull ItemBase otherDevice)
13248 {
13249 if (GetGame().IsServer())
13250 {
13251 ItemBase explosive = otherDevice;
13253 if (!trg)
13254 {
13255 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13256 explosive = this;
13257 }
13258
13259 explosive.PairRemote(trg);
13260 trg.SetControlledDevice(explosive);
13261
13262 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13263 trg.SetPersistentPairID(persistentID);
13264 explosive.SetPersistentPairID(persistentID);
13265
13266 return true;
13267 }
13268 return false;
13269 }
13270
13272 float GetBaitEffectivity()
13273 {
13274 float ret = 1.0;
13275 if (HasQuantity())
13276 ret *= GetQuantityNormalized();
13277 ret *= GetHealth01();
13278
13279 return ret;
13280 }
13281
13282 #ifdef DEVELOPER
13283 override void SetDebugItem()
13284 {
13285 super.SetDebugItem();
13286 _itemBase = this;
13287 }
13288
13289 override string GetDebugText()
13290 {
13291 string text = super.GetDebugText();
13292
13293 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13294 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13295
13296 return text;
13297 }
13298 #endif
13299
13300 bool CanBeUsedForSuicide()
13301 {
13302 return true;
13303 }
13304
13306 //DEPRECATED BELOW
13308 // Backwards compatibility
13309 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13310 {
13311 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13312 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13313 }
13314
13315 // replaced by ItemSoundHandler
13316 protected EffectSound m_SoundDeployFinish;
13317 protected EffectSound m_SoundPlace;
13318 protected EffectSound m_DeployLoopSoundEx;
13319 protected EffectSound m_SoundDeploy;
13320 bool m_IsPlaceSound;
13321 bool m_IsDeploySound;
13323
13324 string GetDeployFinishSoundset();
13325 void PlayDeploySound();
13326 void PlayDeployFinishSound();
13327 void PlayPlaceSound();
13328 void PlayDeployLoopSoundEx();
13329 void StopDeployLoopSoundEx();
13330 void SoundSynchRemoteReset();
13331 void SoundSynchRemote();
13332 bool UsesGlobalDeploy(){return false;}
13333 bool CanPlayDeployLoopSound(){return false;}
13335 bool IsPlaceSound(){return m_IsPlaceSound;}
13336 bool IsDeploySound(){return m_IsDeploySound;}
13337 void SetIsPlaceSound(bool is_place_sound);
13338 void SetIsDeploySound(bool is_deploy_sound);
13339}
13340
13341EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13342{
13343 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13344 if (entity)
13345 {
13346 bool is_item = entity.IsInherited(ItemBase);
13347 if (is_item && full_quantity)
13348 {
13349 ItemBase item = ItemBase.Cast(entity);
13350 item.SetQuantity(item.GetQuantityInit());
13351 }
13352 }
13353 else
13354 {
13355 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13356 return NULL;
13357 }
13358 return entity;
13359}
13360
13361void SetupSpawnedItem(ItemBase item, float health, float quantity)
13362{
13363 if (item)
13364 {
13365 if (health > 0)
13366 item.SetHealth("", "", health);
13367
13368 if (item.CanHaveTemperature())
13369 {
13370 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13371 if (item.CanFreeze())
13372 item.SetFrozen(false);
13373 }
13374
13375 if (item.HasEnergyManager())
13376 {
13377 if (quantity >= 0)
13378 {
13379 item.GetCompEM().SetEnergy0To1(quantity);
13380 }
13381 else
13382 {
13383 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13384 }
13385 }
13386 else if (item.IsMagazine())
13387 {
13388 Magazine mag = Magazine.Cast(item);
13389 if (quantity >= 0)
13390 {
13391 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13392 }
13393 else
13394 {
13395 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13396 }
13397
13398 }
13399 else
13400 {
13401 if (quantity >= 0)
13402 {
13403 item.SetQuantityNormalized(quantity, false);
13404 }
13405 else
13406 {
13407 item.SetQuantity(Math.AbsFloat(quantity));
13408 }
13409
13410 }
13411 }
13412}
13413
13414#ifdef DEVELOPER
13415ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13416#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
class LogManager EntityAI
eBleedingSourceType GetType()
Определения BleedingSource.c:63
ItemSuppressor SuppressorBase
Определения InventoryItem.c:7
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6308
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5548
bool HidesSelectionBySlot()
Определения ItemBase.c:9203
float m_VarWetMin
Определения ItemBase.c:4809
void SplitItem(PlayerBase player)
Определения ItemBase.c:6739
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9424
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8653
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8087
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5553
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8796
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6706
override bool IsHeavyBehaviour()
Определения ItemBase.c:8998
override void SetWetMax()
Определения ItemBase.c:8369
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9241
void ClearStartItemSoundServer()
Определения ItemBase.c:9139
float m_VarWet
Определения ItemBase.c:4806
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9271
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8648
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4869
bool CanBeMovedOverride()
Определения ItemBase.c:7380
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8345
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4855
override void ProcessVariables()
Определения ItemBase.c:9338
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4883
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8179
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8714
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8559
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5139
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4881
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9374
bool m_IsSoundSynchRemote
Определения ItemBase.c:9532
float m_OverheatingShots
Определения ItemBase.c:4876
void StopItemSoundServer(int id)
Определения ItemBase.c:9127
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5568
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5292
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9398
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4893
bool CanBeCooked()
Определения ItemBase.c:7336
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5635
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4905
bool m_RecipesInitialized
Определения ItemBase.c:4791
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6382
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9382
override void OnEnergyConsumed()
Определения ItemBase.c:8289
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8078
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8218
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8409
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8174
ref TIntArray m_InteractActions
Определения ItemBase.c:4857
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7400
float m_VarQuantity
Определения ItemBase.c:4797
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9543
override float GetWetMax()
Определения ItemBase.c:8379
bool CanBeUsedForSuicide()
Определения ItemBase.c:9510
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7011
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5773
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7554
void StartItemSoundServer(int id)
Определения ItemBase.c:9114
void DoAmmoExplosion()
Определения ItemBase.c:6243
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4868
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6557
int GetItemSize()
Определения ItemBase.c:7365
bool m_CanBeMovedOverride
Определения ItemBase.c:4834
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6167
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5360
bool CanDecay()
Определения ItemBase.c:9313
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8060
void SetQuantityMax()
Определения ItemBase.c:8065
override float GetQuantity()
Определения ItemBase.c:8154
int m_ColorComponentR
Определения ItemBase.c:4846
int m_ShotsToStartOverheating
Определения ItemBase.c:4878
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8394
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5367
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8897
void OnOverheatingDecay()
Определения ItemBase.c:5330
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8327
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4812
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5468
bool UsesGlobalDeploy()
Определения ItemBase.c:9542
int m_ItemBehaviour
Определения ItemBase.c:4827
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:8869
float m_HeatIsolation
Определения ItemBase.c:4822
float m_VarWetInit
Определения ItemBase.c:4808
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5813
void SetCEBasedQuantity()
Определения ItemBase.c:5581
bool m_CanPlayImpactSound
Определения ItemBase.c:4818
override string GetAttachmentSoundType()
Определения ItemBase.c:9072
float GetOverheatingCoef()
Определения ItemBase.c:5387
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9198
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9150
override bool IsStoreLoad()
Определения ItemBase.c:8421
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6987
bool IsLightSource()
Определения ItemBase.c:5709
bool m_HasQuantityBar
Определения ItemBase.c:4840
void SetResultOfSplit(bool value)
Определения ItemBase.c:6982
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6624
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6797
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5395
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8336
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8977
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8431
int m_LockType
Определения ItemBase.c:4894
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4899
bool m_CanBeDigged
Определения ItemBase.c:4841
float m_ItemAttachOffset
Определения ItemBase.c:4824
float GetItemModelLength()
Определения ItemBase.c:8438
bool m_ThrowItemOnDrop
Определения ItemBase.c:4832
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8729
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8322
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7016
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9369
bool CanHaveWetness()
Определения ItemBase.c:9326
int m_CleannessMin
Определения ItemBase.c:4814
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8662
string IDToName(int id)
Определения ItemBase.c:7547
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9333
float GetHeatIsolationInit()
Определения ItemBase.c:8317
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7387
override bool HasQuantity()
Определения ItemBase.c:8149
float m_VarWetPrev
Определения ItemBase.c:4807
int m_SoundSyncStop
Определения ItemBase.c:4901
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9419
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4856
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5477
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5162
int m_VarLiquidType
Определения ItemBase.c:4826
int m_QuickBarBonus
Определения ItemBase.c:4828
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9060
override float GetWetInit()
Определения ItemBase.c:8389
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4820
int m_SoundSyncPlay
Определения ItemBase.c:4900
int m_MaxOverheatingValue
Определения ItemBase.c:4879
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
bool m_IsTakeable
Определения ItemBase.c:4831
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4871
string GetLockSoundSet()
Определения ItemBase.c:8487
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8518
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9446
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6803
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4783
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
override int GetQuantityMin()
Определения ItemBase.c:8138
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6533
override int GetQuickBarBonus()
Определения ItemBase.c:5047
override void SetTakeable(bool pState)
Определения ItemBase.c:9042
float m_OverheatingDecayInterval
Определения ItemBase.c:4880
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6356
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9291
bool CanProcessDecay()
Определения ItemBase.c:9319
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5558
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9435
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7351
bool can_this_be_combined
Определения ItemBase.c:4836
EffectSound m_SoundDeploy
Определения ItemBase.c:9529
int m_Count
Определения ItemBase.c:4802
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9482
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9034
override bool IsSplitable()
Определения ItemBase.c:6343
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6327
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7663
void ConvertEnergyToQuantity()
Определения ItemBase.c:8304
override void RemoveAllAgents()
Определения ItemBase.c:8643
override void SetQuantityToMinimum()
Определения ItemBase.c:8071
bool m_WantPlayImpactSound
Определения ItemBase.c:4817
override float GetTemperatureThawTime()
Определения ItemBase.c:9406
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4870
int m_ColorComponentG
Определения ItemBase.c:4847
float m_StoreLoadedQuantity
Определения ItemBase.c:4804
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7418
int m_ColorComponentA
Определения ItemBase.c:4849
int m_VarQuantityInit
Определения ItemBase.c:4799
float GetFilterDamageRatio()
Определения ItemBase.c:5462
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8531
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6773
void OnApply(PlayerBase player)
bool m_HideSelectionsBySlot
Определения ItemBase.c:4884
bool IsOverheatingEffectActive()
Определения ItemBase.c:5325
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5742
int GetLiquidContainerMask()
Определения ItemBase.c:5679
ref Timer m_CheckOverheating
Определения ItemBase.c:4877
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5373
float GetEnergy()
Определения ItemBase.c:8278
bool CanBeDigged()
Определения ItemBase.c:5758
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9452
bool IsNVG()
Определения ItemBase.c:5690
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8238
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9228
bool m_IsDeploySound
Определения ItemBase.c:9531
bool CanEat()
Определения ItemBase.c:7311
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8937
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9008
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9430
bool IsLiquidContainer()
Определения ItemBase.c:5674
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7331
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8721
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8119
int m_CleannessInit
Определения ItemBase.c:4813
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5457
override int GetAgents()
Определения ItemBase.c:8668
int m_VarQuantityMax
Определения ItemBase.c:4801
override bool IsHologram()
Определения ItemBase.c:5753
float GetItemAttachOffset()
Определения ItemBase.c:8447
bool IsPlaceSound()
Определения ItemBase.c:9545
static int GetDebugActionsMask()
Определения ItemBase.c:5543
override int GetLiquidType()
Определения ItemBase.c:8547
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9308
override bool IsItemBase()
Определения ItemBase.c:7464
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9018
void ExplodeAmmo()
Определения ItemBase.c:6230
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:6972
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8742
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8917
override void OnEnergyAdded()
Определения ItemBase.c:8296
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5702
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9528
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7604
void StopItemDynamicPhysics()
Определения ItemBase.c:9210
bool HasFoodStage()
Определения ItemBase.c:7324
override void SetStoreLoad(bool value)
Определения ItemBase.c:8416
float GetOverheatingValue()
Определения ItemBase.c:5287
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8621
override void AddWet(float value)
Определения ItemBase.c:8364
bool IsLiquidPresent()
Определения ItemBase.c:5669
bool IsFullQuantity()
Определения ItemBase.c:8159
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:5943
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6678
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6651
int m_CleannessMax
Определения ItemBase.c:4815
float m_VarStackMax
Определения ItemBase.c:4803
ref Timer m_PhysDropTimer
Определения ItemBase.c:4890
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7436
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8426
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4844
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5308
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5623
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7358
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8552
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5354
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8474
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4875
int m_LiquidContainerMask
Определения ItemBase.c:4825
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9246
override int GetCleanness()
Определения ItemBase.c:8469
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9457
bool IsDeploySound()
Определения ItemBase.c:9546
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5563
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8957
int m_VarQuantityMin
Определения ItemBase.c:4800
void PerformDamageSystemReinit()
Определения ItemBase.c:9216
override void ClearInventory()
Определения ItemBase.c:8257
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4872
ItemBase GetLightSourceItem()
Определения ItemBase.c:9440
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7454
override float GetItemOverheatThreshold()
Определения ItemBase.c:9390
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4837
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7568
void Open()
Implementations only.
Определения CannedFood.c:100
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6590
float m_ItemModelLength
Определения ItemBase.c:4823
bool m_IsHologram
Определения ItemBase.c:4830
static int m_DebugActionsMask
Определения ItemBase.c:4790
void KillAllOverheatingParticles()
Определения ItemBase.c:5423
bool CanBeCookedOnStick()
Определения ItemBase.c:7341
override int GetQuantityMax()
Определения ItemBase.c:8106
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7050
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8512
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8634
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4833
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8824
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9186
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4784
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9519
override bool IsBeingPlaced()
Определения ItemBase.c:5737
int GetQuantityInit()
Определения ItemBase.c:8143
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6992
bool IsResultOfSplit()
Определения ItemBase.c:6977
bool m_FixDamageSystemInit
Определения ItemBase.c:4835
float m_ImpactSpeed
Определения ItemBase.c:4819
bool m_IsStoreLoad
Определения ItemBase.c:4838
int GetLiquidTypeInit()
Определения ItemBase.c:8542
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4853
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5610
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6462
int m_AttachedAgents
Определения ItemBase.c:4861
string m_LockSoundSet
Определения ItemBase.c:4896
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5231
float m_VarQuantityPrev
Определения ItemBase.c:4798
bool IsSoundSynchRemote()
Определения ItemBase.c:9544
bool m_CanShowQuantity
Определения ItemBase.c:4839
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения ItemBase.c:8781
override void OnRightClick()
Определения ItemBase.c:6846
int m_ColorComponentB
Определения ItemBase.c:4848
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4786
bool IsActionTargetVisible()
Определения ItemBase.c:9054
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:5978
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6267
bool m_IsBeingPlaced
Определения ItemBase.c:4829
int NameToID(string name)
Определения ItemBase.c:7541
void ~ItemBase()
Определения ItemBase.c:5508
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8404
void ClearStopItemSoundServer()
Определения ItemBase.c:9144
override string ChangeIntoOnDetach()
Определения ItemBase.c:6191
float m_VarWetMax
Определения ItemBase.c:4810
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6585
int GetLockType()
Определения ItemBase.c:8482
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9526
override float GetWet()
Определения ItemBase.c:8374
EffectSound m_SoundPlace
Определения ItemBase.c:9527
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8092
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8456
bool m_IsPlaceSound
Определения ItemBase.c:9530
override float GetWetMin()
Определения ItemBase.c:8384
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4902
override bool KindOf(string tag)
Определения ItemBase.c:7470
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения Man.c:44
Определения Building.c:6
Определения constants.c:659
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:149
override void OnWasDetached(EntityAI parent, int slot_id)
Определения InventoryItem.c:920
override void EEOnAfterLoad()
Определения GardenBase.c:187
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
Определения InventoryItem.c:732
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1218
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:465
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:472
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:206
override void AfterStoreLoad()
Определения GardenBase.c:182
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1017
override void OnVariablesSynchronized()
Определения GardenBase.c:68
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
Определения InventoryItem.c:912
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:962
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:269
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:988
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1150
override void InitItemSounds()
Определения TentBase.c:810
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1012
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
Определения InventoryItem.c:840
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:341
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения InventoryItem.c:731
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения constants.c:510
const int DEF_CHEMICAL
Определения constants.c:511
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:685
array< int > TIntArray
Определения EnScript.c:687
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
const int VARIABLE_LIQUIDTYPE
Определения constants.c:630
const int VARIABLE_CLEANNESS
Определения constants.c:633
const int VARIABLE_COLOR
Определения constants.c:632
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const int VARIABLE_QUANTITY
Определения constants.c:626
const int VARIABLE_WET
Определения constants.c:629
const int LIQUID_NONE
Определения constants.c:527
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения constants.c:451
const int SAT_DEBUG_ACTION
Определения constants.c:452
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native int GetColor()