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

◆ HasDebugActionsMask()

static bool SpawnItemOnLocation::HasDebugActionsMask ( int mask)
staticprivate

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

5552{
5553 override bool CanPutAsAttachment(EntityAI parent)
5554 {
5555 return true;
5556 }
5557};
5558
5559//const bool QUANTITY_DEBUG_REMOVE_ME = false;
5560
5561class ItemBase extends InventoryItem
5562{
5566
5568
5569 static int m_DebugActionsMask;
5571 // ============================================
5572 // Variable Manipulation System
5573 // ============================================
5574 // Quantity
5575
5576 float m_VarQuantity;
5577 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
5579 int m_VarQuantityMin;
5580 int m_VarQuantityMax;
5581 int m_Count;
5582 float m_VarStackMax;
5583 float m_StoreLoadedQuantity = float.LOWEST;
5584 // Wet
5585 float m_VarWet;
5586 float m_VarWetPrev;//for client to know wetness changed during synchronization
5587 float m_VarWetInit;
5588 float m_VarWetMin;
5589 float m_VarWetMax;
5590 // Cleanness
5591 int m_Cleanness;
5592 int m_CleannessInit;
5593 int m_CleannessMin;
5594 int m_CleannessMax;
5595 // impact sounds
5597 bool m_CanPlayImpactSound = true;
5598 float m_ImpactSpeed;
5600 //
5601 float m_HeatIsolation;
5602 float m_ItemModelLength;
5603 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
5605 int m_VarLiquidType;
5606 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
5607 int m_QuickBarBonus;
5608 bool m_IsBeingPlaced;
5609 bool m_IsHologram;
5610 bool m_IsTakeable;
5611 bool m_ThrowItemOnDrop;
5614 bool m_FixDamageSystemInit = false; //can be changed on storage version check
5615 bool can_this_be_combined; //Check if item can be combined
5616 bool m_CanThisBeSplit; //Check if item can be split
5617 bool m_IsStoreLoad = false;
5618 bool m_CanShowQuantity;
5619 bool m_HasQuantityBar;
5620 protected bool m_CanBeDigged;
5621 protected bool m_IsResultOfSplit
5622
5623 string m_SoundAttType;
5624 // items color variables
5629 //-------------------------------------------------------
5630
5631 // light source managing
5633
5637
5638 //==============================================
5639 // agent system
5640 private int m_AttachedAgents;
5641
5643 void TransferModifiers(PlayerBase reciever);
5644
5645
5646 // Weapons & suppressors particle effects
5651 static int m_LastRegisteredWeaponID = 0;
5652
5653 // Overheating effects
5655 float m_OverheatingShots;
5656 ref Timer m_CheckOverheating;
5657 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
5658 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
5659 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
5660 ref array <ref OverheatingParticle> m_OverheatingParticles;
5661
5663 protected bool m_HideSelectionsBySlot;
5664
5665 // Admin Log
5666 PluginAdminLog m_AdminLog;
5667
5668 // misc
5669 ref Timer m_PhysDropTimer;
5670
5671 // Attachment Locking variables
5672 ref array<int> m_CompatibleLocks;
5673 protected int m_LockType;
5674 protected ref EffectSound m_LockingSound;
5675 protected string m_LockSoundSet;
5676
5677 // ItemSoundHandler
5678 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
5679 protected int m_SoundSyncPlay; // id for sound to play
5680 protected int m_SoundSyncStop; // id for sound to stop
5682
5683 //temperature
5684 private float m_TemperaturePerQuantityWeight;
5685
5686 // -------------------------------------------------------------------------
5687 void ItemBase()
5688 {
5689 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
5693
5694 if (!GetGame().IsDedicatedServer())
5695 {
5696 if (HasMuzzle())
5697 {
5699
5701 {
5703 }
5704 }
5705
5707 m_ActionsInitialize = false;
5708 }
5709
5710 m_OldLocation = null;
5711
5712 if (GetGame().IsServer())
5713 {
5714 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
5715 }
5716
5717 if (ConfigIsExisting("headSelectionsToHide"))
5718 {
5720 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
5721 }
5722
5723 m_HideSelectionsBySlot = false;
5724 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5725 {
5726 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
5727 }
5728
5729 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
5730
5731 m_IsResultOfSplit = false;
5732
5734 }
5735
5736 override void InitItemVariables()
5737 {
5738 super.InitItemVariables();
5739
5740 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
5741 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
5742 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
5743 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
5744 m_VarStackMax = ConfigGetFloat("varStackMax");
5745 m_Count = ConfigGetInt("count");
5746
5747 m_CanShowQuantity = ConfigGetBool("quantityShow");
5748 m_HasQuantityBar = ConfigGetBool("quantityBar");
5749
5750 m_CleannessInit = ConfigGetInt("varCleannessInit");
5752 m_CleannessMin = ConfigGetInt("varCleannessMin");
5753 m_CleannessMax = ConfigGetInt("varCleannessMax");
5754
5755 m_WantPlayImpactSound = false;
5756 m_ImpactSpeed = 0.0;
5757
5758 m_VarWetInit = ConfigGetFloat("varWetInit");
5760 m_VarWetMin = ConfigGetFloat("varWetMin");
5761 m_VarWetMax = ConfigGetFloat("varWetMax");
5762
5763 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
5764 if (IsLiquidContainer() && GetQuantity() != 0)
5766 m_IsBeingPlaced = false;
5767 m_IsHologram = false;
5768 m_IsTakeable = true;
5769 m_CanBeMovedOverride = false;
5773 m_CanBeDigged = ConfigGetBool("canBeDigged");
5774
5775 m_CompatibleLocks = new array<int>();
5776 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
5777 m_LockType = ConfigGetInt("lockType");
5778
5779 //Define if item can be split and set ability to be combined accordingly
5780 m_CanThisBeSplit = false;
5781 can_this_be_combined = false;
5782 if (ConfigIsExisting("canBeSplit"))
5783 {
5784 can_this_be_combined = ConfigGetBool("canBeSplit");
5786 }
5787
5788 m_ItemBehaviour = -1;
5789 if (ConfigIsExisting("itemBehaviour"))
5790 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
5791
5792 //RegisterNetSyncVariableInt("m_VariablesMask");
5793 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
5794 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
5795 RegisterNetSyncVariableInt("m_VarLiquidType");
5796 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5797
5798 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5799 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5800 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5801
5802 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5803 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5804 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5805 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5806
5807 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5808 RegisterNetSyncVariableBool("m_IsTakeable");
5809 RegisterNetSyncVariableBool("m_IsHologram");
5810
5811 InitItemSounds();
5813 {
5814 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
5815 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
5816 }
5817
5818 m_LockSoundSet = ConfigGetString("lockSoundSet");
5819
5821 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5822 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
5823
5824 }
5825
5826 override int GetQuickBarBonus()
5827 {
5828 return m_QuickBarBonus;
5829 }
5830
5831 void InitializeActions()
5832 {
5834 if (!m_InputActionMap)
5835 {
5837 m_InputActionMap = iam;
5838 SetActions();
5840 }
5841 }
5842
5843 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
5844 {
5846 {
5847 m_ActionsInitialize = true;
5849 }
5850
5851 actions = m_InputActionMap.Get(action_input_type);
5852 }
5853
5854 void SetActions()
5855 {
5856 AddAction(ActionTakeItem);
5857 AddAction(ActionTakeItemToHands);
5858 AddAction(ActionWorldCraft);
5860 AddAction(ActionAttachWithSwitch);
5861 }
5862
5863 void SetActionAnimOverrides(); // Override action animation for specific item
5864
5865 void AddAction(typename actionName)
5866 {
5867 ActionBase action = ActionManagerBase.GetAction(actionName);
5868
5869 if (!action)
5870 {
5871 Debug.LogError("Action " + actionName + " dosn't exist!");
5872 return;
5873 }
5874
5875 typename ai = action.GetInputType();
5876 if (!ai)
5877 {
5878 m_ActionsInitialize = false;
5879 return;
5880 }
5881
5882 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5883 if (!action_array)
5884 {
5885 action_array = new array<ActionBase_Basic>;
5886 m_InputActionMap.Insert(ai, action_array);
5887 }
5888 if (LogManager.IsActionLogEnable())
5889 {
5890 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
5891 }
5892
5893 if (action_array.Find(action) != -1)
5894 {
5895 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
5896 }
5897 else
5898 {
5899 action_array.Insert(action);
5900 }
5901 }
5902
5903 void RemoveAction(typename actionName)
5904 {
5905 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
5906 ActionBase action = player.GetActionManager().GetAction(actionName);
5907 typename ai = action.GetInputType();
5908 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5909
5910 if (action_array)
5911 {
5912 action_array.RemoveItem(action);
5913 }
5914 }
5915
5916 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
5917 // Set -1 for params which should stay in default state
5918 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
5919 {
5920 ActionOverrideData overrideData = new ActionOverrideData();
5921 overrideData.m_CommandUID = commandUID;
5922 overrideData.m_CommandUIDProne = commandUIDProne;
5923 overrideData.m_StanceMask = stanceMask;
5924
5925 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
5926 if (!actionMap) // create new map of action > overidables map
5927 {
5928 actionMap = new TActionAnimOverrideMap();
5929 m_ItemActionOverrides.Insert(action, actionMap);
5930 }
5931
5932 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
5933
5934 }
5935
5936 void OnItemInHandsPlayerSwimStart(PlayerBase player);
5937
5938 ScriptedLightBase GetLight();
5939
5940 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
5941 void LoadParticleConfigOnFire(int id)
5942 {
5943 if (!m_OnFireEffect)
5945
5948
5949 string config_to_search = "CfgVehicles";
5950 string muzzle_owner_config;
5951
5952 if (!m_OnFireEffect.Contains(id))
5953 {
5954 if (IsInherited(Weapon))
5955 config_to_search = "CfgWeapons";
5956
5957 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5958
5959 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5960
5961 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
5962
5963 if (config_OnFire_subclass_count > 0)
5964 {
5965 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5966
5967 for (int i = 0; i < config_OnFire_subclass_count; i++)
5968 {
5969 string particle_class = "";
5970 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
5971 string config_OnFire_entry = config_OnFire_class + particle_class;
5972 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5973 WPOF_array.Insert(WPOF);
5974 }
5975
5976
5977 m_OnFireEffect.Insert(id, WPOF_array);
5978 }
5979 }
5980
5981 if (!m_OnBulletCasingEjectEffect.Contains(id))
5982 {
5983 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
5984 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5985
5986 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5987
5988 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5989
5990 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5991 {
5992 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5993
5994 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5995 {
5996 string particle_class2 = "";
5997 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5998 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5999 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6000 WPOBE_array.Insert(WPOBE);
6001 }
6002
6003
6004 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
6005 }
6006 }
6007 }
6008
6009 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6011 {
6014
6015 if (!m_OnOverheatingEffect.Contains(id))
6016 {
6017 string config_to_search = "CfgVehicles";
6018
6019 if (IsInherited(Weapon))
6020 config_to_search = "CfgWeapons";
6021
6022 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
6023 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6024
6025 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
6026 {
6027
6028 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
6029
6031 {
6032 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
6033 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6034 Error(error);
6035 return;
6036 }
6037
6038 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
6039 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
6040
6041
6042
6043 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
6044 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6045
6046 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6047 {
6048 string particle_class = "";
6049 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6050 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6051 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
6052
6053 if (entry_type == CT_CLASS)
6054 {
6055 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6056 WPOOH_array.Insert(WPOF);
6057 }
6058 }
6059
6060
6061 m_OnOverheatingEffect.Insert(id, WPOOH_array);
6062 }
6063 }
6064 }
6065
6066 float GetOverheatingValue()
6067 {
6068 return m_OverheatingShots;
6069 }
6070
6071 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
6072 {
6073 if (m_MaxOverheatingValue > 0)
6074 {
6076
6077 if (!m_CheckOverheating)
6079
6081 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6082
6083 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6084 }
6085 }
6086
6087 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6088 {
6090 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6091
6093 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6094
6096 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6097
6099 {
6101 }
6102 }
6103
6105 {
6107 }
6108
6109 void OnOverheatingDecay()
6110 {
6111 if (m_MaxOverheatingValue > 0)
6112 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
6113 else
6115
6116 if (m_OverheatingShots <= 0)
6117 {
6120 }
6121 else
6122 {
6123 if (!m_CheckOverheating)
6125
6127 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6128 }
6129
6130 CheckOverheating(this, "", this);
6131 }
6132
6133 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6134 {
6136 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6137 }
6138
6139 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6140 {
6142 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6144 }
6145
6146 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6147 {
6149 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6150 }
6151
6152 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
6153 {
6155 m_OverheatingParticles = new array<ref OverheatingParticle>;
6156
6157 OverheatingParticle OP = new OverheatingParticle();
6158 OP.RegisterParticle(p);
6159 OP.SetOverheatingLimitMin(min_heat_coef);
6160 OP.SetOverheatingLimitMax(max_heat_coef);
6161 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
6162
6163 m_OverheatingParticles.Insert(OP);
6164 }
6165
6166 float GetOverheatingCoef()
6167 {
6168 if (m_MaxOverheatingValue > 0)
6170
6171 return -1;
6172 }
6173
6175 {
6177 {
6178 float overheat_coef = GetOverheatingCoef();
6179 int count = m_OverheatingParticles.Count();
6180
6181 for (int i = count; i > 0; --i)
6182 {
6183 int id = i - 1;
6184 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6185 Particle p = OP.GetParticle();
6186
6187 float overheat_min = OP.GetOverheatingLimitMin();
6188 float overheat_max = OP.GetOverheatingLimitMax();
6189
6190 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6191 {
6192 if (p)
6193 {
6194 p.Stop();
6195 OP.RegisterParticle(null);
6196 }
6197 }
6198 }
6199 }
6200 }
6201
6203 {
6205 {
6206 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
6207 {
6208 int id = i - 1;
6209 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6210
6211 if (OP)
6212 {
6213 Particle p = OP.GetParticle();
6214
6215 if (p)
6216 {
6217 p.Stop();
6218 }
6219
6220 delete OP;
6221 }
6222 }
6223
6224 m_OverheatingParticles.Clear();
6226 }
6227 }
6228
6230 float GetInfectionChance(int system = 0, Param param = null)
6231 {
6232 return 0.0;
6233 }
6234
6235
6236 float GetDisinfectQuantity(int system = 0, Param param1 = null)
6237 {
6238 return 250;//default value
6239 }
6240
6241 float GetFilterDamageRatio()
6242 {
6243 return 0;
6244 }
6245
6247 bool HasMuzzle()
6248 {
6249 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
6250 return true;
6251
6252 return false;
6253 }
6254
6256 int GetMuzzleID()
6257 {
6258 if (!m_WeaponTypeToID)
6260
6261 if (m_WeaponTypeToID.Contains(GetType()))
6262 {
6263 return m_WeaponTypeToID.Get(GetType());
6264 }
6265 else
6266 {
6267 // Register new weapon ID
6269 }
6270
6272 }
6273
6280 {
6281 return -1;
6282 }
6283
6284
6285
6286 // -------------------------------------------------------------------------
6287 void ~ItemBase()
6288 {
6289 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
6290 {
6291 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6292 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6293
6294 if (r_index >= 0)
6295 {
6296 InventoryLocation r_il = new InventoryLocation;
6297 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6298
6299 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6300 int r_type = r_il.GetType();
6301 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6302 {
6303 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6304 }
6305 else if (r_type == InventoryLocationType.ATTACHMENT)
6306 {
6307 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6308 }
6309
6310 }
6311
6312 player.GetHumanInventory().ClearUserReservedLocation(this);
6313 }
6314
6315 if (m_LockingSound)
6316 SEffectManager.DestroyEffect(m_LockingSound);
6317 }
6318
6319
6320
6321 // -------------------------------------------------------------------------
6322 static int GetDebugActionsMask()
6323 {
6324 return ItemBase.m_DebugActionsMask;
6325 }
6326
6327 static bool HasDebugActionsMask(int mask)
6328 {
6329 return ItemBase.m_DebugActionsMask & mask;
6330 }
6331
6332 static void SetDebugActionsMask(int mask)
6333 {
6334 ItemBase.m_DebugActionsMask = mask;
6335 }
6336
6337 static void AddDebugActionsMask(int mask)
6338 {
6339 ItemBase.m_DebugActionsMask |= mask;
6340 }
6341
6342 static void RemoveDebugActionsMask(int mask)
6343 {
6344 ItemBase.m_DebugActionsMask &= ~mask;
6345 }
6346
6347 static void ToggleDebugActionsMask(int mask)
6348 {
6349 if (HasDebugActionsMask(mask))
6350 {
6352 }
6353 else
6354 {
6355 AddDebugActionsMask(mask);
6356 }
6357 }
6358
6359 // -------------------------------------------------------------------------
6360 void SetCEBasedQuantity()
6361 {
6362 if (GetEconomyProfile())
6363 {
6364 float q_max = GetEconomyProfile().GetQuantityMax();
6365 if (q_max > 0)
6366 {
6367 float q_min = GetEconomyProfile().GetQuantityMin();
6368 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6369
6370 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
6371 {
6372 ComponentEnergyManager comp = GetCompEM();
6373 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
6374 {
6375 comp.SetEnergy0To1(quantity_randomized);
6376 }
6377 }
6378 else if (HasQuantity())
6379 {
6380 SetQuantityNormalized(quantity_randomized, false);
6381 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
6382 }
6383
6384 }
6385 }
6386 }
6387
6389 void LockToParent()
6390 {
6391 EntityAI parent = GetHierarchyParent();
6392
6393 if (parent)
6394 {
6395 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6396 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6397 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
6398 }
6399 }
6400
6402 void UnlockFromParent()
6403 {
6404 EntityAI parent = GetHierarchyParent();
6405
6406 if (parent)
6407 {
6408 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6409 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6410 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
6411 }
6412 }
6413
6414 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
6415 {
6416 /*
6417 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
6418 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
6419 */
6420 ItemBase item2 = ItemBase.Cast(entity2);
6421
6422 if (GetGame().IsClient())
6423 {
6424 if (ScriptInputUserData.CanStoreInputUserData())
6425 {
6426 ScriptInputUserData ctx = new ScriptInputUserData;
6428 ctx.Write(-1);
6429 ItemBase i1 = this; // @NOTE: workaround for correct serialization
6430 ctx.Write(i1);
6431 ctx.Write(item2);
6432 ctx.Write(use_stack_max);
6433 ctx.Write(-1);
6434 ctx.Send();
6435
6436 if (IsCombineAll(item2, use_stack_max))
6437 {
6438 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6439 }
6440 }
6441 }
6442 else if (!GetGame().IsMultiplayer())
6443 {
6444 CombineItems(item2, use_stack_max);
6445 }
6446 }
6447
6448 bool IsLiquidPresent()
6449 {
6450 return (GetLiquidType() != 0 && HasQuantity());
6451 }
6452
6453 bool IsLiquidContainer()
6454 {
6455 return m_LiquidContainerMask != 0;
6456 }
6457
6459 {
6460 return m_LiquidContainerMask;
6461 }
6462
6463 bool IsBloodContainer()
6464 {
6465 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
6466 return false;
6467 }
6468
6469 bool IsNVG()
6470 {
6471 return false;
6472 }
6473
6476 bool IsExplosive()
6477 {
6478 return false;
6479 }
6480
6482 {
6483 return "";
6484 }
6485
6487
6488 bool IsLightSource()
6489 {
6490 return false;
6491 }
6492
6494 {
6495 return true;
6496 }
6497
6498 //--- ACTION CONDITIONS
6499 //direction
6500 bool IsFacingPlayer(PlayerBase player, string selection)
6501 {
6502 return true;
6503 }
6504
6505 bool IsPlayerInside(PlayerBase player, string selection)
6506 {
6507 return true;
6508 }
6509
6510 override bool CanObstruct()
6511 {
6512 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
6513 return !player || !IsPlayerInside(player, "");
6514 }
6515
6516 override bool IsBeingPlaced()
6517 {
6518 return m_IsBeingPlaced;
6519 }
6520
6521 void SetIsBeingPlaced(bool is_being_placed)
6522 {
6523 m_IsBeingPlaced = is_being_placed;
6524 if (!is_being_placed)
6526 SetSynchDirty();
6527 }
6528
6529 //server-side
6530 void OnEndPlacement() {}
6531
6532 override bool IsHologram()
6533 {
6534 return m_IsHologram;
6535 }
6536
6537 bool CanBeDigged()
6538 {
6539 return m_CanBeDigged;
6540 }
6541
6543 {
6544 return 1;
6545 }
6546
6547 bool CanMakeGardenplot()
6548 {
6549 return false;
6550 }
6551
6552 void SetIsHologram(bool is_hologram)
6553 {
6554 m_IsHologram = is_hologram;
6555 SetSynchDirty();
6556 }
6557 /*
6558 protected float GetNutritionalEnergy()
6559 {
6560 Edible_Base edible = Edible_Base.Cast(this);
6561 return edible.GetFoodEnergy();
6562 }
6563
6564 protected float GetNutritionalWaterContent()
6565 {
6566 Edible_Base edible = Edible_Base.Cast(this);
6567 return edible.GetFoodWater();
6568 }
6569
6570 protected float GetNutritionalIndex()
6571 {
6572 Edible_Base edible = Edible_Base.Cast(this);
6573 return edible.GetFoodNutritionalIndex();
6574 }
6575
6576 protected float GetNutritionalFullnessIndex()
6577 {
6578 Edible_Base edible = Edible_Base.Cast(this);
6579 return edible.GetFoodTotalVolume();
6580 }
6581
6582 protected float GetNutritionalToxicity()
6583 {
6584 Edible_Base edible = Edible_Base.Cast(this);
6585 return edible.GetFoodToxicity();
6586
6587 }
6588 */
6589
6590
6591 // -------------------------------------------------------------------------
6592 override void OnMovedInsideCargo(EntityAI container)
6593 {
6594 super.OnMovedInsideCargo(container);
6595
6596 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6597 }
6598
6599 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6600 {
6601 super.EEItemLocationChanged(oldLoc,newLoc);
6602
6603 PlayerBase new_player = null;
6604 PlayerBase old_player = null;
6605
6606 if (newLoc.GetParent())
6607 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6608
6609 if (oldLoc.GetParent())
6610 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6611
6612 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
6613 {
6614 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6615
6616 if (r_index >= 0)
6617 {
6618 InventoryLocation r_il = new InventoryLocation;
6619 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6620
6621 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6622 int r_type = r_il.GetType();
6623 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6624 {
6625 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6626 }
6627 else if (r_type == InventoryLocationType.ATTACHMENT)
6628 {
6629 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6630 }
6631
6632 }
6633 }
6634
6635 if (newLoc.GetType() == InventoryLocationType.HANDS)
6636 {
6637 if (new_player)
6638 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6639
6640 if (new_player == old_player)
6641 {
6642
6643 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6644 {
6645 if (oldLoc.GetType() == InventoryLocationType.CARGO)
6646 {
6647 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6648 {
6649 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6650 }
6651 }
6652 else
6653 {
6654 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6655 }
6656 }
6657
6658 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6659 {
6660 int type = oldLoc.GetType();
6661 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
6662 {
6663 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6664 }
6665 else if (type == InventoryLocationType.ATTACHMENT)
6666 {
6667 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6668 }
6669 }
6670 if (!m_OldLocation)
6671 {
6672 m_OldLocation = new InventoryLocation;
6673 }
6674 m_OldLocation.Copy(oldLoc);
6675 }
6676 else
6677 {
6678 if (m_OldLocation)
6679 {
6680 m_OldLocation.Reset();
6681 }
6682 }
6683
6685 }
6686 else
6687 {
6688 if (new_player)
6689 {
6690 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6691 if (res_index >= 0)
6692 {
6693 InventoryLocation il = new InventoryLocation;
6694 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6695 ItemBase it = ItemBase.Cast(il.GetItem());
6696 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6697 int rel_type = il.GetType();
6698 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
6699 {
6700 il.GetParent().GetOnReleaseLock().Invoke(it);
6701 }
6702 else if (rel_type == InventoryLocationType.ATTACHMENT)
6703 {
6704 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
6705 }
6706 //it.GetOnReleaseLock().Invoke(it);
6707 }
6708 }
6709 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
6710 {
6711 //ThrowPhysically(old_player, vector.Zero);
6712 m_ThrowItemOnDrop = false;
6713 }
6714
6715 if (m_OldLocation)
6716 {
6717 m_OldLocation.Reset();
6718 }
6719 }
6720 }
6721
6722 override void EOnContact(IEntity other, Contact extra)
6723 {
6725 {
6726 int liquidType = -1;
6727 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
6728 if (impactSpeed > 0.0)
6729 {
6730 m_ImpactSpeed = impactSpeed;
6731 #ifndef SERVER
6732 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
6733 #else
6734 m_WantPlayImpactSound = true;
6735 SetSynchDirty();
6736 #endif
6737 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
6738 }
6739 }
6740
6741 #ifdef SERVER
6742 if (GetCompEM() && GetCompEM().IsPlugged())
6743 {
6744 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
6745 GetCompEM().UnplugThis();
6746 }
6747 #endif
6748 }
6749
6750 void RefreshPhysics();
6751
6752 override void OnCreatePhysics()
6753 {
6755 }
6756
6757 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6758 {
6759
6760 }
6761 // -------------------------------------------------------------------------
6762 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
6763 {
6764 super.OnItemLocationChanged(old_owner, new_owner);
6765
6766 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6767 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6768
6769 if (!relatedPlayer && playerNew)
6770 relatedPlayer = playerNew;
6771
6772 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6773 {
6774 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
6775 if (actionMgr)
6776 {
6777 ActionBase currentAction = actionMgr.GetRunningAction();
6778 if (currentAction)
6779 currentAction.OnItemLocationChanged(this);
6780 }
6781 }
6782
6783 Man ownerPlayerOld = null;
6784 Man ownerPlayerNew = null;
6785
6786 if (old_owner)
6787 {
6788 if (old_owner.IsMan())
6789 {
6790 ownerPlayerOld = Man.Cast(old_owner);
6791 }
6792 else
6793 {
6794 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6795 }
6796 }
6797 else
6798 {
6799 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
6800 {
6801 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
6802
6803 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
6804 {
6805 GetCompEM().UnplugThis();
6806 }
6807 }
6808 }
6809
6810 if (new_owner)
6811 {
6812 if (new_owner.IsMan())
6813 {
6814 ownerPlayerNew = Man.Cast(new_owner);
6815 }
6816 else
6817 {
6818 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6819 }
6820 }
6821
6822 if (ownerPlayerOld != ownerPlayerNew)
6823 {
6824 if (ownerPlayerOld)
6825 {
6826 array<EntityAI> subItemsExit = new array<EntityAI>;
6827 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
6828 for (int i = 0; i < subItemsExit.Count(); i++)
6829 {
6830 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
6831 itemExit.OnInventoryExit(ownerPlayerOld);
6832 }
6833 }
6834
6835 if (ownerPlayerNew)
6836 {
6837 array<EntityAI> subItemsEnter = new array<EntityAI>;
6838 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
6839 for (int j = 0; j < subItemsEnter.Count(); j++)
6840 {
6841 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
6842 itemEnter.OnInventoryEnter(ownerPlayerNew);
6843 }
6844 }
6845 }
6846 else if (ownerPlayerNew != null)
6847 {
6848 PlayerBase nplayer;
6849 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6850 {
6851 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6852 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
6853 for (int k = 0; k < subItemsUpdate.Count(); k++)
6854 {
6855 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
6856 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6857 }
6858 }
6859 }
6860
6861 if (old_owner)
6862 old_owner.OnChildItemRemoved(this);
6863 if (new_owner)
6864 new_owner.OnChildItemReceived(this);
6865 }
6866
6867 // -------------------------------------------------------------------------------
6868 override void EEDelete(EntityAI parent)
6869 {
6870 super.EEDelete(parent);
6871 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6872 if (player)
6873 {
6874 OnInventoryExit(player);
6875
6876 if (player.IsAlive())
6877 {
6878 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6879 if (r_index >= 0)
6880 {
6881 InventoryLocation r_il = new InventoryLocation;
6882 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6883
6884 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6885 int r_type = r_il.GetType();
6886 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6887 {
6888 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6889 }
6890 else if (r_type == InventoryLocationType.ATTACHMENT)
6891 {
6892 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6893 }
6894
6895 }
6896
6897 player.RemoveQuickBarEntityShortcut(this);
6898 }
6899 }
6900 }
6901 // -------------------------------------------------------------------------------
6902 override void EEKilled(Object killer)
6903 {
6904 super.EEKilled(killer);
6905
6907 if (killer && killer.IsFireplace() && CanExplodeInFire())
6908 {
6909 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6910 {
6911 if (IsMagazine())
6912 {
6913 if (Magazine.Cast(this).GetAmmoCount() > 0)
6914 {
6915 ExplodeAmmo();
6916 }
6917 }
6918 else
6919 {
6920 Explode(DamageType.EXPLOSION);
6921 }
6922 }
6923 }
6924 }
6925
6926 override void OnWasAttached(EntityAI parent, int slot_id)
6927 {
6928 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6929
6930 super.OnWasAttached(parent, slot_id);
6931
6932 if (HasQuantity())
6933 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6934
6935 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
6936 }
6937
6938 override void OnWasDetached(EntityAI parent, int slot_id)
6939 {
6940 super.OnWasDetached(parent, slot_id);
6941
6942 if (HasQuantity())
6943 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6944 }
6945
6946 override string ChangeIntoOnAttach(string slot)
6947 {
6948 int idx;
6949 TStringArray inventory_slots = new TStringArray;
6950 TStringArray attach_types = new TStringArray;
6951
6952 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6953 if (inventory_slots.Count() < 1) //is string
6954 {
6955 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6956 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6957 }
6958 else //is array
6959 {
6960 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6961 }
6962
6963 idx = inventory_slots.Find(slot);
6964 if (idx < 0)
6965 return "";
6966
6967 return attach_types.Get(idx);
6968 }
6969
6970 override string ChangeIntoOnDetach()
6971 {
6972 int idx = -1;
6973 string slot;
6974
6975 TStringArray inventory_slots = new TStringArray;
6976 TStringArray detach_types = new TStringArray;
6977
6978 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6979 if (inventory_slots.Count() < 1) //is string
6980 {
6981 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6982 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6983 }
6984 else //is array
6985 {
6986 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6987 if (detach_types.Count() < 1)
6988 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6989 }
6990
6991 for (int i = 0; i < inventory_slots.Count(); i++)
6992 {
6993 slot = inventory_slots.Get(i);
6994 }
6995
6996 if (slot != "")
6997 {
6998 if (detach_types.Count() == 1)
6999 idx = 0;
7000 else
7001 idx = inventory_slots.Find(slot);
7002 }
7003 if (idx < 0)
7004 return "";
7005
7006 return detach_types.Get(idx);
7007 }
7008
7009 void ExplodeAmmo()
7010 {
7011 //timer
7012 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
7013
7014 //min/max time
7015 float min_time = 1;
7016 float max_time = 3;
7017 float delay = Math.RandomFloat(min_time, max_time);
7018
7019 explode_timer.Run(delay, this, "DoAmmoExplosion");
7020 }
7021
7022 void DoAmmoExplosion()
7023 {
7024 Magazine magazine = Magazine.Cast(this);
7025 int pop_sounds_count = 6;
7026 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7027
7028 //play sound
7029 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7030 string sound_name = pop_sounds[ sound_idx ];
7031 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
7032
7033 //remove ammo count
7034 magazine.ServerAddAmmoCount(-1);
7035
7036 //if condition then repeat -> ExplodeAmmo
7037 float min_temp_to_explode = 100; //min temperature for item to explode
7038
7039 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
7040 {
7041 ExplodeAmmo();
7042 }
7043 }
7044
7045 // -------------------------------------------------------------------------------
7046 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
7047 {
7048 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
7049
7050 const int CHANCE_DAMAGE_CARGO = 4;
7051 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7052 const int CHANCE_DAMAGE_NOTHING = 2;
7053
7054 if (IsClothing() || IsContainer() || IsItemTent())
7055 {
7056 float dmg = damageResult.GetDamage("","Health") * -0.5;
7057 int chances;
7058 int rnd;
7059
7060 if (GetInventory().GetCargo())
7061 {
7062 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7063 rnd = Math.RandomInt(0,chances);
7064
7065 if (rnd < CHANCE_DAMAGE_CARGO)
7066 {
7067 DamageItemInCargo(dmg);
7068 }
7069 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7070 {
7072 }
7073 }
7074 else
7075 {
7076 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7077 rnd = Math.RandomInt(0,chances);
7078
7079 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7080 {
7082 }
7083 }
7084 }
7085 }
7086
7087 bool DamageItemInCargo(float damage)
7088 {
7089 if (GetInventory().GetCargo())
7090 {
7091 int item_count = GetInventory().GetCargo().GetItemCount();
7092 if (item_count > 0)
7093 {
7094 int random_pick = Math.RandomInt(0, item_count);
7095 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
7096 if (!item.IsExplosive())
7097 {
7098 item.AddHealth("","",damage);
7099 return true;
7100 }
7101 }
7102 }
7103 return false;
7104 }
7105
7106 bool DamageItemAttachments(float damage)
7107 {
7108 int attachment_count = GetInventory().AttachmentCount();
7109 if (attachment_count > 0)
7110 {
7111 int random_pick = Math.RandomInt(0, attachment_count);
7112 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7113 if (!attachment.IsExplosive())
7114 {
7115 attachment.AddHealth("","",damage);
7116 return true;
7117 }
7118 }
7119 return false;
7120 }
7121
7122 override bool IsSplitable()
7123 {
7124 return m_CanThisBeSplit;
7125 }
7126 //----------------
7127 override bool CanBeSplit()
7128 {
7129 if (IsSplitable() && (GetQuantity() > 1))
7130 return GetInventory().CanRemoveEntity();
7131
7132 return false;
7133 }
7134
7135 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
7136 {
7137 if (!CanBeSplit())
7138 return;
7139
7140 if (GetGame().IsClient())
7141 {
7142 if (ScriptInputUserData.CanStoreInputUserData())
7143 {
7144 ScriptInputUserData ctx = new ScriptInputUserData;
7146 ctx.Write(1);
7147 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7148 ctx.Write(i1);
7149 ctx.Write(destination_entity);
7150 ctx.Write(true);
7151 ctx.Write(slot_id);
7152 ctx.Send();
7153 }
7154 }
7155 else if (!GetGame().IsMultiplayer())
7156 {
7157 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
7158 }
7159 }
7160
7161 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
7162 {
7163 if (!CanBeSplit())
7164 return;
7165
7166 float split_quantity_new;
7167 ref ItemBase new_item;
7168 float quantity = GetQuantity();
7169 float stack_max = GetTargetQuantityMax(slot_id);
7170 InventoryLocation loc = new InventoryLocation;
7171
7172 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7173 {
7174 if (stack_max <= GetQuantity())
7175 split_quantity_new = stack_max;
7176 else
7177 split_quantity_new = GetQuantity();
7178
7179 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7180 if (new_item)
7181 {
7182 new_item.SetResultOfSplit(true);
7183 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7184 AddQuantity(-split_quantity_new);
7185 new_item.SetQuantity(split_quantity_new);
7186 }
7187 }
7188 else if (destination_entity && slot_id == -1)
7189 {
7190 if (quantity > stack_max)
7191 split_quantity_new = stack_max;
7192 else
7193 split_quantity_new = quantity;
7194
7195 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7196 {
7197 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7198 new_item = ItemBase.Cast(o);
7199 }
7200
7201 if (new_item)
7202 {
7203 new_item.SetResultOfSplit(true);
7204 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7205 AddQuantity(-split_quantity_new);
7206 new_item.SetQuantity(split_quantity_new);
7207 }
7208 }
7209 else
7210 {
7211 if (stack_max != 0)
7212 {
7213 if (stack_max < GetQuantity())
7214 {
7215 split_quantity_new = GetQuantity() - stack_max;
7216 }
7217
7218 if (split_quantity_new == 0)
7219 {
7220 if (!GetGame().IsMultiplayer())
7221 player.PhysicalPredictiveDropItem(this);
7222 else
7223 player.ServerDropEntity(this);
7224 return;
7225 }
7226
7227 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7228
7229 if (new_item)
7230 {
7231 new_item.SetResultOfSplit(true);
7232 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7233 SetQuantity(split_quantity_new);
7234 new_item.SetQuantity(stack_max);
7235 new_item.PlaceOnSurface();
7236 }
7237 }
7238 }
7239 }
7240
7241 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
7242 {
7243 if (!CanBeSplit())
7244 return;
7245
7246 float split_quantity_new;
7247 ref ItemBase new_item;
7248 float quantity = GetQuantity();
7249 float stack_max = GetTargetQuantityMax(slot_id);
7250 InventoryLocation loc = new InventoryLocation;
7251
7252 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7253 {
7254 if (stack_max <= GetQuantity())
7255 split_quantity_new = stack_max;
7256 else
7257 split_quantity_new = GetQuantity();
7258
7259 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7260 if (new_item)
7261 {
7262 new_item.SetResultOfSplit(true);
7263 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7264 AddQuantity(-split_quantity_new);
7265 new_item.SetQuantity(split_quantity_new);
7266 }
7267 }
7268 else if (destination_entity && slot_id == -1)
7269 {
7270 if (quantity > stack_max)
7271 split_quantity_new = stack_max;
7272 else
7273 split_quantity_new = quantity;
7274
7275 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7276 {
7277 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7278 new_item = ItemBase.Cast(o);
7279 }
7280
7281 if (new_item)
7282 {
7283 new_item.SetResultOfSplit(true);
7284 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7285 AddQuantity(-split_quantity_new);
7286 new_item.SetQuantity(split_quantity_new);
7287 }
7288 }
7289 else
7290 {
7291 if (stack_max != 0)
7292 {
7293 if (stack_max < GetQuantity())
7294 {
7295 split_quantity_new = GetQuantity() - stack_max;
7296 }
7297
7298 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7299
7300 if (new_item)
7301 {
7302 new_item.SetResultOfSplit(true);
7303 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7304 SetQuantity(split_quantity_new);
7305 new_item.SetQuantity(stack_max);
7306 new_item.PlaceOnSurface();
7307 }
7308 }
7309 }
7310 }
7311
7312 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
7313 {
7314 if (!CanBeSplit())
7315 return;
7316
7317 if (GetGame().IsClient())
7318 {
7319 if (ScriptInputUserData.CanStoreInputUserData())
7320 {
7321 ScriptInputUserData ctx = new ScriptInputUserData;
7323 ctx.Write(4);
7324 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7325 ctx.Write(thiz);
7326 dst.WriteToContext(ctx);
7327 ctx.Send();
7328 }
7329 }
7330 else if (!GetGame().IsMultiplayer())
7331 {
7333 }
7334 }
7335
7336 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
7337 {
7338 if (!CanBeSplit())
7339 return;
7340
7341 if (GetGame().IsClient())
7342 {
7343 if (ScriptInputUserData.CanStoreInputUserData())
7344 {
7345 ScriptInputUserData ctx = new ScriptInputUserData;
7347 ctx.Write(2);
7348 ItemBase dummy = this; // @NOTE: workaround for correct serialization
7349 ctx.Write(dummy);
7350 ctx.Write(destination_entity);
7351 ctx.Write(true);
7352 ctx.Write(idx);
7353 ctx.Write(row);
7354 ctx.Write(col);
7355 ctx.Send();
7356 }
7357 }
7358 else if (!GetGame().IsMultiplayer())
7359 {
7360 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
7361 }
7362 }
7363
7364 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
7365 {
7367 }
7368
7369 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
7370 {
7371 if (!CanBeSplit())
7372 return this;
7373
7374 float quantity = GetQuantity();
7375 float split_quantity_new;
7376 ItemBase new_item;
7377 if (dst.IsValid())
7378 {
7379 int slot_id = dst.GetSlot();
7380 float stack_max = GetTargetQuantityMax(slot_id);
7381
7382 if (quantity > stack_max)
7383 split_quantity_new = stack_max;
7384 else
7385 split_quantity_new = quantity;
7386
7387 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7388
7389 if (new_item)
7390 {
7391 new_item.SetResultOfSplit(true);
7392 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7393 AddQuantity(-split_quantity_new);
7394 new_item.SetQuantity(split_quantity_new);
7395 }
7396
7397 return new_item;
7398 }
7399
7400 return null;
7401 }
7402
7403 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
7404 {
7405 if (!CanBeSplit())
7406 return;
7407
7408 float quantity = GetQuantity();
7409 float split_quantity_new;
7410 ref ItemBase new_item;
7411 if (destination_entity)
7412 {
7413 float stackable = GetTargetQuantityMax();
7414 if (quantity > stackable)
7415 split_quantity_new = stackable;
7416 else
7417 split_quantity_new = quantity;
7418
7419 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
7420 if (new_item)
7421 {
7422 new_item.SetResultOfSplit(true);
7423 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7424 AddQuantity(-split_quantity_new);
7425 new_item.SetQuantity(split_quantity_new);
7426 }
7427 }
7428 }
7429
7430 void SplitIntoStackMaxHandsClient(PlayerBase player)
7431 {
7432 if (!CanBeSplit())
7433 return;
7434
7435 if (GetGame().IsClient())
7436 {
7437 if (ScriptInputUserData.CanStoreInputUserData())
7438 {
7439 ScriptInputUserData ctx = new ScriptInputUserData;
7441 ctx.Write(3);
7442 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7443 ctx.Write(i1);
7444 ItemBase destination_entity = this;
7445 ctx.Write(destination_entity);
7446 ctx.Write(true);
7447 ctx.Write(0);
7448 ctx.Send();
7449 }
7450 }
7451 else if (!GetGame().IsMultiplayer())
7452 {
7453 SplitIntoStackMaxHands(player);
7454 }
7455 }
7456
7457 void SplitIntoStackMaxHands(PlayerBase player)
7458 {
7459 if (!CanBeSplit())
7460 return;
7461
7462 float quantity = GetQuantity();
7463 float split_quantity_new;
7464 ref ItemBase new_item;
7465 if (player)
7466 {
7467 float stackable = GetTargetQuantityMax();
7468 if (quantity > stackable)
7469 split_quantity_new = stackable;
7470 else
7471 split_quantity_new = quantity;
7472
7473 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
7474 new_item = ItemBase.Cast(in_hands);
7475 if (new_item)
7476 {
7477 new_item.SetResultOfSplit(true);
7478 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7479 AddQuantity(-split_quantity_new);
7480 new_item.SetQuantity(split_quantity_new);
7481 }
7482 }
7483 }
7484
7485 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
7486 {
7487 if (!CanBeSplit())
7488 return;
7489
7490 float quantity = GetQuantity();
7491 float split_quantity_new = Math.Floor(quantity * 0.5);
7492
7493 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7494
7495 if (new_item)
7496 {
7497 if (new_item.GetQuantityMax() < split_quantity_new)
7498 {
7499 split_quantity_new = new_item.GetQuantityMax();
7500 }
7501
7502 new_item.SetResultOfSplit(true);
7503 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7504
7505 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7506 {
7507 AddQuantity(-1);
7508 new_item.SetQuantity(1);
7509 }
7510 else
7511 {
7512 AddQuantity(-split_quantity_new);
7513 new_item.SetQuantity(split_quantity_new);
7514 }
7515 }
7516 }
7517
7518 void SplitItem(PlayerBase player)
7519 {
7520 if (!CanBeSplit())
7521 return;
7522
7523 float quantity = GetQuantity();
7524 float split_quantity_new = Math.Floor(quantity / 2);
7525
7526 InventoryLocation invloc = new InventoryLocation;
7527 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
7528
7529 ItemBase new_item;
7530 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7531
7532 if (new_item)
7533 {
7534 if (new_item.GetQuantityMax() < split_quantity_new)
7535 {
7536 split_quantity_new = new_item.GetQuantityMax();
7537 }
7538 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7539 {
7540 AddQuantity(-1);
7541 new_item.SetQuantity(1);
7542 }
7543 else
7544 {
7545 AddQuantity(-split_quantity_new);
7546 new_item.SetQuantity(split_quantity_new);
7547 }
7548 }
7549 }
7550
7552 void OnQuantityChanged(float delta)
7553 {
7554 SetWeightDirty();
7555 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
7556
7557 if (parent)
7558 parent.OnAttachmentQuantityChangedEx(this, delta);
7559
7560 if (IsLiquidContainer())
7561 {
7562 if (GetQuantityNormalized() <= 0.0)
7563 {
7565 }
7566 else if (GetLiquidType() == LIQUID_NONE)
7567 {
7568 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
7570 }
7571 }
7572
7573 }
7574
7577 {
7578 // insert code here
7579 }
7580
7582 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
7583 {
7585 }
7586
7587 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
7588 {
7589 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7590
7591 if (GetGame().IsServer())
7592 {
7593 if (newLevel == GameConstants.STATE_RUINED)
7594 {
7596 EntityAI parent = GetHierarchyParent();
7597 if (parent && parent.IsFireplace())
7598 {
7599 CargoBase cargo = GetInventory().GetCargo();
7600 if (cargo)
7601 {
7602 for (int i = 0; i < cargo.GetItemCount(); ++i)
7603 {
7604 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
7605 }
7606 }
7607 }
7608 }
7609
7610 if (IsResultOfSplit())
7611 {
7612 // reset the splitting result flag, return to normal item behavior
7613 SetResultOfSplit(false);
7614 return;
7615 }
7616
7617 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7618 {
7619 SetCleanness(0);//unclean the item upon damage dealt
7620 }
7621 }
7622 }
7623
7624 // just the split? TODO: verify
7625 override void OnRightClick()
7626 {
7627 super.OnRightClick();
7628
7629 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
7630 {
7631 if (GetGame().IsClient())
7632 {
7633 if (ScriptInputUserData.CanStoreInputUserData())
7634 {
7635 vector m4[4];
7636 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7637
7638 EntityAI root = GetHierarchyRoot();
7639
7640 InventoryLocation dst = new InventoryLocation;
7641 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
7642 {
7643 if (root)
7644 {
7645 root.GetTransform(m4);
7646 dst.SetGround(this, m4);
7647 }
7648 else
7649 GetInventory().GetCurrentInventoryLocation(dst);
7650 }
7651 else
7652 {
7653 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
7654 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
7655 this shouldnt cause issues within this scope*/
7656 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
7657 {
7658 if (root)
7659 {
7660 root.GetTransform(m4);
7661 dst.SetGround(this, m4);
7662 }
7663 else
7664 GetInventory().GetCurrentInventoryLocation(dst);
7665 }
7666 else
7667 {
7668 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7669 }
7670 }
7671
7672 ScriptInputUserData ctx = new ScriptInputUserData;
7674 ctx.Write(4);
7675 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7676 ctx.Write(thiz);
7677 dst.WriteToContext(ctx);
7678 ctx.Write(true); // dummy
7679 ctx.Send();
7680 }
7681 }
7682 else if (!GetGame().IsMultiplayer())
7683 {
7684 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
7685 }
7686 }
7687 }
7688
7689 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
7690 {
7691 //TODO: delete check zero quantity check after fix double posts hands fsm events
7692 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
7693 return false;
7694
7695 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7696 return false;
7697
7698 //can_this_be_combined = ConfigGetBool("canBeSplit");
7700 return false;
7701
7702
7703 Magazine mag = Magazine.Cast(this);
7704 if (mag)
7705 {
7706 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7707 return false;
7708
7709 if (stack_max_limit)
7710 {
7711 Magazine other_mag = Magazine.Cast(other_item);
7712 if (other_item)
7713 {
7714 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7715 return false;
7716 }
7717
7718 }
7719 }
7720 else
7721 {
7722 //TODO: delete check zero quantity check after fix double posts hands fsm events
7723 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
7724 return false;
7725
7726 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
7727 return false;
7728 }
7729
7730 PlayerBase player = null;
7731 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
7732 {
7733 if (player.GetInventory().HasAttachment(this))
7734 return false;
7735
7736 if (player.IsItemsToDelete())
7737 return false;
7738 }
7739
7740 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7741 return false;
7742
7743 int slotID;
7744 string slotName;
7745 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7746 return false;
7747
7748 return true;
7749 }
7750
7751 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
7752 {
7753 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
7754 }
7755
7756 bool IsResultOfSplit()
7757 {
7758 return m_IsResultOfSplit;
7759 }
7760
7761 void SetResultOfSplit(bool value)
7762 {
7763 m_IsResultOfSplit = value;
7764 }
7765
7766 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
7767 {
7768 return ComputeQuantityUsedEx(other_item, use_stack_max);
7769 }
7770
7771 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
7772 {
7773 float other_item_quantity = other_item.GetQuantity();
7774 float this_free_space;
7775
7776 float stack_max = GetQuantityMax();
7777
7778 this_free_space = stack_max - GetQuantity();
7779
7780 if (other_item_quantity > this_free_space)
7781 {
7782 return this_free_space;
7783 }
7784 else
7785 {
7786 return other_item_quantity;
7787 }
7788 }
7789
7790 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
7791 {
7792 CombineItems(ItemBase.Cast(entity2),use_stack_max);
7793 }
7794
7795 void CombineItems(ItemBase other_item, bool use_stack_max = true)
7796 {
7797 if (!CanBeCombined(other_item, false))
7798 return;
7799
7800 if (!IsMagazine() && other_item)
7801 {
7802 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
7803 if (quantity_used != 0)
7804 {
7805 float hp1 = GetHealth01("","");
7806 float hp2 = other_item.GetHealth01("","");
7807 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
7808 hpResult = hpResult / (GetQuantity() + quantity_used);
7809
7810 hpResult *= GetMaxHealth();
7811 Math.Round(hpResult);
7812 SetHealth("", "Health", hpResult);
7813
7814 AddQuantity(quantity_used);
7815 other_item.AddQuantity(-quantity_used);
7816 }
7817 }
7818 OnCombine(other_item);
7819 }
7820
7821 void OnCombine(ItemBase other_item)
7822 {
7823 #ifdef SERVER
7824 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7825 GetHierarchyParent().IncreaseLifetimeUp();
7826 #endif
7827 };
7828
7829 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
7830 {
7831 PlayerBase p = PlayerBase.Cast(player);
7832
7833 array<int> recipesIds = p.m_Recipes;
7834 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7835 if (moduleRecipesManager)
7836 {
7837 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7838 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
7839 }
7840
7841 for (int i = 0;i < recipesIds.Count(); i++)
7842 {
7843 int key = recipesIds.Get(i);
7844 string recipeName = moduleRecipesManager.GetRecipeName(key);
7845 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
7846 }
7847 }
7848
7849 // -------------------------------------------------------------------------
7850 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7851 {
7852 super.GetDebugActions(outputList);
7853
7854 //quantity
7855 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
7856 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
7857 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
7858 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
7859
7860 //health
7861 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
7862 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
7863 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
7864 //temperature
7865 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
7866 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
7867 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
7868
7869 //wet
7870 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
7871 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
7872
7873 //liquidtype
7874 if (IsLiquidContainer())
7875 {
7876 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
7877 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
7878 }
7879
7880 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
7881 // watch
7882 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
7883 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
7884
7885 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
7886 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
7887 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
7888 }
7889
7890 // -------------------------------------------------------------------------
7891 // -------------------------------------------------------------------------
7892 // -------------------------------------------------------------------------
7893 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
7894 {
7895 super.OnAction(action_id, player, ctx);
7896 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
7897 {
7898 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7899 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
7900 PlayerBase p = PlayerBase.Cast(player);
7901 if (EActions.RECIPES_RANGE_START < 1000)
7902 {
7903 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7904 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7905 }
7906 }
7907 #ifndef SERVER
7908 else if (action_id == EActions.WATCH_PLAYER)
7909 {
7910 PluginDeveloper.SetDeveloperItemClientEx(player);
7911 }
7912 #endif
7913 if (GetGame().IsServer())
7914 {
7915 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7916 {
7917 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7918 OnDebugButtonPressServer(id + 1);
7919 }
7920
7921 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7922 {
7923 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7924 InsertAgent(agent_id,100);
7925 }
7926
7927 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7928 {
7929 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7930 RemoveAgent(agent_id2);
7931 }
7932
7933 else if (action_id == EActions.ADD_QUANTITY)
7934 {
7935 if (IsMagazine())
7936 {
7937 Magazine mag = Magazine.Cast(this);
7938 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7939 }
7940 else
7941 {
7942 AddQuantity(GetQuantityMax() * 0.2);
7943 }
7944
7945 if (m_EM)
7946 {
7947 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7948 }
7949 //PrintVariables();
7950 }
7951
7952 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
7953 {
7954 if (IsMagazine())
7955 {
7956 Magazine mag2 = Magazine.Cast(this);
7957 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7958 }
7959 else
7960 {
7961 AddQuantity(- GetQuantityMax() * 0.2);
7962 }
7963 if (m_EM)
7964 {
7965 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7966 }
7967 //PrintVariables();
7968 }
7969
7970 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
7971 {
7972 SetQuantity(0);
7973
7974 if (m_EM)
7975 {
7976 m_EM.SetEnergy(0);
7977 }
7978 }
7979
7980 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
7981 {
7983
7984 if (m_EM)
7985 {
7986 m_EM.SetEnergy(m_EM.GetEnergyMax());
7987 }
7988 }
7989
7990 else if (action_id == EActions.ADD_HEALTH)
7991 {
7992 AddHealth("","",GetMaxHealth("","Health")/5);
7993 }
7994 else if (action_id == EActions.REMOVE_HEALTH)
7995 {
7996 AddHealth("","",-GetMaxHealth("","Health")/5);
7997 }
7998 else if (action_id == EActions.DESTROY_HEALTH)
7999 {
8000 SetHealth01("","",0);
8001 }
8002 else if (action_id == EActions.WATCH_ITEM)
8003 {
8005 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
8006 #ifdef DEVELOPER
8007 SetDebugDeveloper_item(this);
8008 #endif
8009 }
8010
8011 else if (action_id == EActions.ADD_TEMPERATURE)
8012 {
8013 AddTemperature(20);
8014 //PrintVariables();
8015 }
8016
8017 else if (action_id == EActions.REMOVE_TEMPERATURE)
8018 {
8019 AddTemperature(-20);
8020 //PrintVariables();
8021 }
8022
8023 else if (action_id == EActions.FLIP_FROZEN)
8024 {
8025 SetFrozen(!GetIsFrozen());
8026 //PrintVariables();
8027 }
8028
8029 else if (action_id == EActions.ADD_WETNESS)
8030 {
8031 AddWet(GetWetMax()/5);
8032 //PrintVariables();
8033 }
8034
8035 else if (action_id == EActions.REMOVE_WETNESS)
8036 {
8037 AddWet(-GetWetMax()/5);
8038 //PrintVariables();
8039 }
8040
8041 else if (action_id == EActions.LIQUIDTYPE_UP)
8042 {
8043 int curr_type = GetLiquidType();
8044 SetLiquidType(curr_type * 2);
8045 //AddWet(1);
8046 //PrintVariables();
8047 }
8048
8049 else if (action_id == EActions.LIQUIDTYPE_DOWN)
8050 {
8051 int curr_type2 = GetLiquidType();
8052 SetLiquidType(curr_type2 / 2);
8053 }
8054
8055 else if (action_id == EActions.MAKE_SPECIAL)
8056 {
8057 auto debugParams = DebugSpawnParams.WithPlayer(player);
8058 OnDebugSpawnEx(debugParams);
8059 }
8060
8061 else if (action_id == EActions.DELETE)
8062 {
8063 Delete();
8064 }
8065
8066 }
8067
8068
8069 return false;
8070 }
8071
8072 // -------------------------------------------------------------------------
8073
8074
8077 void OnActivatedByTripWire();
8078
8080 void OnActivatedByItem(notnull ItemBase item);
8081
8082 //----------------------------------------------------------------
8083 //returns true if item is able to explode when put in fire
8084 bool CanExplodeInFire()
8085 {
8086 return false;
8087 }
8088
8089 //----------------------------------------------------------------
8090 bool CanEat()
8091 {
8092 return true;
8093 }
8094
8095 //----------------------------------------------------------------
8096 override bool IsIgnoredByConstruction()
8097 {
8098 return true;
8099 }
8100
8101 //----------------------------------------------------------------
8102 //has FoodStages in config?
8103 bool HasFoodStage()
8104 {
8105 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
8106 return GetGame().ConfigIsExisting(config_path);
8107 }
8108
8110 FoodStage GetFoodStage()
8111 {
8112 return null;
8113 }
8114
8115 bool CanBeCooked()
8116 {
8117 return false;
8118 }
8119
8120 bool CanBeCookedOnStick()
8121 {
8122 return false;
8123 }
8124
8126 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
8128
8129 //----------------------------------------------------------------
8130 bool CanRepair(ItemBase item_repair_kit)
8131 {
8132 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8133 return module_repairing.CanRepair(this, item_repair_kit);
8134 }
8135
8136 //----------------------------------------------------------------
8137 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
8138 {
8139 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8140 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8141 }
8142
8143 //----------------------------------------------------------------
8144 int GetItemSize()
8145 {
8146 /*
8147 vector v_size = this.ConfigGetVector("itemSize");
8148 int v_size_x = v_size[0];
8149 int v_size_y = v_size[1];
8150 int size = v_size_x * v_size_y;
8151 return size;
8152 */
8153
8154 return 1;
8155 }
8156
8157 //----------------------------------------------------------------
8158 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8159 bool CanBeMovedOverride()
8160 {
8161 return m_CanBeMovedOverride;
8162 }
8163
8164 //----------------------------------------------------------------
8165 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8166 void SetCanBeMovedOverride(bool setting)
8167 {
8168 m_CanBeMovedOverride = setting;
8169 }
8170
8171 //----------------------------------------------------------------
8179 void MessageToOwnerStatus(string text)
8180 {
8181 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8182
8183 if (player)
8184 {
8185 player.MessageStatus(text);
8186 }
8187 }
8188
8189 //----------------------------------------------------------------
8197 void MessageToOwnerAction(string text)
8198 {
8199 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8200
8201 if (player)
8202 {
8203 player.MessageAction(text);
8204 }
8205 }
8206
8207 //----------------------------------------------------------------
8215 void MessageToOwnerFriendly(string text)
8216 {
8217 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8218
8219 if (player)
8220 {
8221 player.MessageFriendly(text);
8222 }
8223 }
8224
8225 //----------------------------------------------------------------
8233 void MessageToOwnerImportant(string text)
8234 {
8235 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8236
8237 if (player)
8238 {
8239 player.MessageImportant(text);
8240 }
8241 }
8242
8243 override bool IsItemBase()
8244 {
8245 return true;
8246 }
8247
8248 // Checks if item is of questioned kind
8249 override bool KindOf(string tag)
8250 {
8251 bool found = false;
8252 string item_name = this.GetType();
8253 ref TStringArray item_tag_array = new TStringArray;
8254 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
8255
8256 int array_size = item_tag_array.Count();
8257 for (int i = 0; i < array_size; i++)
8258 {
8259 if (item_tag_array.Get(i) == tag)
8260 {
8261 found = true;
8262 break;
8263 }
8264 }
8265 return found;
8266 }
8267
8268
8269 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
8270 {
8271 //Debug.Log("OnRPC called");
8272 super.OnRPC(sender, rpc_type,ctx);
8273
8274 //Play soundset for attachment locking (ActionLockAttachment.c)
8275 switch (rpc_type)
8276 {
8277 #ifndef SERVER
8278 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8279 Param2<bool, string> p = new Param2<bool, string>(false, "");
8280
8281 if (!ctx.Read(p))
8282 return;
8283
8284 bool play = p.param1;
8285 string soundSet = p.param2;
8286
8287 if (play)
8288 {
8289 if (m_LockingSound)
8290 {
8292 {
8293 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8294 }
8295 }
8296 else
8297 {
8298 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8299 }
8300 }
8301 else
8302 {
8303 SEffectManager.DestroyEffect(m_LockingSound);
8304 }
8305
8306 break;
8307 #endif
8308
8309 }
8310
8311 if (GetWrittenNoteData())
8312 {
8313 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
8314 }
8315 }
8316
8317 //-----------------------------
8318 // VARIABLE MANIPULATION SYSTEM
8319 //-----------------------------
8320 int NameToID(string name)
8321 {
8322 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8323 return plugin.GetID(name);
8324 }
8325
8326 string IDToName(int id)
8327 {
8328 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8329 return plugin.GetName(id);
8330 }
8331
8333 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
8334 {
8335 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
8336 //read the flags
8337 int varFlags;
8338 if (!ctx.Read(varFlags))
8339 return;
8340
8341 if (varFlags & ItemVariableFlags.FLOAT)
8342 {
8343 ReadVarsFromCTX(ctx);
8344 }
8345 }
8346
8347 override void SerializeNumericalVars(array<float> floats_out)
8348 {
8349 //some variables handled on EntityAI level already!
8350 super.SerializeNumericalVars(floats_out);
8351
8352 // the order of serialization must be the same as the order of de-serialization
8353 //--------------------------------------------
8354 if (IsVariableSet(VARIABLE_QUANTITY))
8355 {
8356 floats_out.Insert(m_VarQuantity);
8357 }
8358 //--------------------------------------------
8359 if (IsVariableSet(VARIABLE_WET))
8360 {
8361 floats_out.Insert(m_VarWet);
8362 }
8363 //--------------------------------------------
8364 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8365 {
8366 floats_out.Insert(m_VarLiquidType);
8367 }
8368 //--------------------------------------------
8369 if (IsVariableSet(VARIABLE_COLOR))
8370 {
8371 floats_out.Insert(m_ColorComponentR);
8372 floats_out.Insert(m_ColorComponentG);
8373 floats_out.Insert(m_ColorComponentB);
8374 floats_out.Insert(m_ColorComponentA);
8375 }
8376 //--------------------------------------------
8377 if (IsVariableSet(VARIABLE_CLEANNESS))
8378 {
8379 floats_out.Insert(m_Cleanness);
8380 }
8381 }
8382
8383 override void DeSerializeNumericalVars(array<float> floats)
8384 {
8385 //some variables handled on EntityAI level already!
8386 super.DeSerializeNumericalVars(floats);
8387
8388 // the order of serialization must be the same as the order of de-serialization
8389 int index = 0;
8390 int mask = Math.Round(floats.Get(index));
8391
8392 index++;
8393 //--------------------------------------------
8394 if (mask & VARIABLE_QUANTITY)
8395 {
8396 if (m_IsStoreLoad)
8397 {
8398 SetStoreLoadedQuantity(floats.Get(index));
8399 }
8400 else
8401 {
8402 float quantity = floats.Get(index);
8403 SetQuantity(quantity, true, false, false, false);
8404 }
8405 index++;
8406 }
8407 //--------------------------------------------
8408 if (mask & VARIABLE_WET)
8409 {
8410 float wet = floats.Get(index);
8411 SetWet(wet);
8412 index++;
8413 }
8414 //--------------------------------------------
8415 if (mask & VARIABLE_LIQUIDTYPE)
8416 {
8417 int liquidtype = Math.Round(floats.Get(index));
8418 SetLiquidType(liquidtype);
8419 index++;
8420 }
8421 //--------------------------------------------
8422 if (mask & VARIABLE_COLOR)
8423 {
8424 m_ColorComponentR = Math.Round(floats.Get(index));
8425 index++;
8426 m_ColorComponentG = Math.Round(floats.Get(index));
8427 index++;
8428 m_ColorComponentB = Math.Round(floats.Get(index));
8429 index++;
8430 m_ColorComponentA = Math.Round(floats.Get(index));
8431 index++;
8432 }
8433 //--------------------------------------------
8434 if (mask & VARIABLE_CLEANNESS)
8435 {
8436 int cleanness = Math.Round(floats.Get(index));
8437 SetCleanness(cleanness);
8438 index++;
8439 }
8440 }
8441
8442 override void WriteVarsToCTX(ParamsWriteContext ctx)
8443 {
8444 super.WriteVarsToCTX(ctx);
8445
8446 //--------------------------------------------
8447 if (IsVariableSet(VARIABLE_QUANTITY))
8448 {
8449 ctx.Write(GetQuantity());
8450 }
8451 //--------------------------------------------
8452 if (IsVariableSet(VARIABLE_WET))
8453 {
8454 ctx.Write(GetWet());
8455 }
8456 //--------------------------------------------
8457 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8458 {
8459 ctx.Write(GetLiquidType());
8460 }
8461 //--------------------------------------------
8462 if (IsVariableSet(VARIABLE_COLOR))
8463 {
8464 int r,g,b,a;
8465 GetColor(r,g,b,a);
8466 ctx.Write(r);
8467 ctx.Write(g);
8468 ctx.Write(b);
8469 ctx.Write(a);
8470 }
8471 //--------------------------------------------
8472 if (IsVariableSet(VARIABLE_CLEANNESS))
8473 {
8474 ctx.Write(GetCleanness());
8475 }
8476 }
8477
8478 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
8479 {
8480 if (!super.ReadVarsFromCTX(ctx,version))
8481 return false;
8482
8483 int intValue;
8484 float value;
8485
8486 if (version < 140)
8487 {
8488 if (!ctx.Read(intValue))
8489 return false;
8490
8491 m_VariablesMask = intValue;
8492 }
8493
8494 if (m_VariablesMask & VARIABLE_QUANTITY)
8495 {
8496 if (!ctx.Read(value))
8497 return false;
8498
8499 if (IsStoreLoad())
8500 {
8502 }
8503 else
8504 {
8505 SetQuantity(value, true, false, false, false);
8506 }
8507 }
8508 //--------------------------------------------
8509 if (version < 140)
8510 {
8511 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8512 {
8513 if (!ctx.Read(value))
8514 return false;
8515 SetTemperatureDirect(value);
8516 }
8517 }
8518 //--------------------------------------------
8519 if (m_VariablesMask & VARIABLE_WET)
8520 {
8521 if (!ctx.Read(value))
8522 return false;
8523 SetWet(value);
8524 }
8525 //--------------------------------------------
8526 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
8527 {
8528 if (!ctx.Read(intValue))
8529 return false;
8530 SetLiquidType(intValue);
8531 }
8532 //--------------------------------------------
8533 if (m_VariablesMask & VARIABLE_COLOR)
8534 {
8535 int r,g,b,a;
8536 if (!ctx.Read(r))
8537 return false;
8538 if (!ctx.Read(g))
8539 return false;
8540 if (!ctx.Read(b))
8541 return false;
8542 if (!ctx.Read(a))
8543 return false;
8544
8545 SetColor(r,g,b,a);
8546 }
8547 //--------------------------------------------
8548 if (m_VariablesMask & VARIABLE_CLEANNESS)
8549 {
8550 if (!ctx.Read(intValue))
8551 return false;
8552 SetCleanness(intValue);
8553 }
8554 //--------------------------------------------
8555 if (version >= 138 && version < 140)
8556 {
8557 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8558 {
8559 if (!ctx.Read(intValue))
8560 return false;
8561 SetFrozen(intValue);
8562 }
8563 }
8564
8565 return true;
8566 }
8567
8568 //----------------------------------------------------------------
8569 override bool OnStoreLoad(ParamsReadContext ctx, int version)
8570 {
8571 m_IsStoreLoad = true;
8573 {
8574 m_FixDamageSystemInit = true;
8575 }
8576
8577 if (!super.OnStoreLoad(ctx, version))
8578 {
8579 m_IsStoreLoad = false;
8580 return false;
8581 }
8582
8583 if (version >= 114)
8584 {
8585 bool hasQuickBarIndexSaved;
8586
8587 if (!ctx.Read(hasQuickBarIndexSaved))
8588 {
8589 m_IsStoreLoad = false;
8590 return false;
8591 }
8592
8593 if (hasQuickBarIndexSaved)
8594 {
8595 int itmQBIndex;
8596
8597 //Load quickbar item bind
8598 if (!ctx.Read(itmQBIndex))
8599 {
8600 m_IsStoreLoad = false;
8601 return false;
8602 }
8603
8604 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8605 if (itmQBIndex != -1 && parentPlayer)
8606 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8607 }
8608 }
8609 else
8610 {
8611 // Backup of how it used to be
8612 PlayerBase player;
8613 int itemQBIndex;
8614 if (version == int.MAX)
8615 {
8616 if (!ctx.Read(itemQBIndex))
8617 {
8618 m_IsStoreLoad = false;
8619 return false;
8620 }
8621 }
8622 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8623 {
8624 //Load quickbar item bind
8625 if (!ctx.Read(itemQBIndex))
8626 {
8627 m_IsStoreLoad = false;
8628 return false;
8629 }
8630 if (itemQBIndex != -1 && player)
8631 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8632 }
8633 }
8634
8635 if (version < 140)
8636 {
8637 // variable management system
8638 if (!LoadVariables(ctx, version))
8639 {
8640 m_IsStoreLoad = false;
8641 return false;
8642 }
8643 }
8644
8645 //agent trasmission system
8646 if (!LoadAgents(ctx, version))
8647 {
8648 m_IsStoreLoad = false;
8649 return false;
8650 }
8651 if (version >= 132)
8652 {
8653 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8654 if (raib)
8655 {
8656 if (!raib.OnStoreLoad(ctx,version))
8657 {
8658 m_IsStoreLoad = false;
8659 return false;
8660 }
8661 }
8662 }
8663
8664 m_IsStoreLoad = false;
8665 return true;
8666 }
8667
8668 //----------------------------------------------------------------
8669
8670 override void OnStoreSave(ParamsWriteContext ctx)
8671 {
8672 super.OnStoreSave(ctx);
8673
8674 PlayerBase player;
8675 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8676 {
8677 ctx.Write(true); // Keep track of if we should actually read this in or not
8678 //Save quickbar item bind
8679 int itemQBIndex = -1;
8680 itemQBIndex = player.FindQuickBarEntityIndex(this);
8681 ctx.Write(itemQBIndex);
8682 }
8683 else
8684 {
8685 ctx.Write(false); // Keep track of if we should actually read this in or not
8686 }
8687
8688 SaveAgents(ctx);//agent trasmission system
8689
8690 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8691 if (raib)
8692 {
8693 raib.OnStoreSave(ctx);
8694 }
8695 }
8696 //----------------------------------------------------------------
8697
8698 override void AfterStoreLoad()
8699 {
8700 super.AfterStoreLoad();
8701
8703 {
8705 }
8706
8707 if (GetStoreLoadedQuantity() != float.LOWEST)
8708 {
8710 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
8711 }
8712 }
8713
8714 override void EEOnAfterLoad()
8715 {
8716 super.EEOnAfterLoad();
8717
8719 {
8720 m_FixDamageSystemInit = false;
8721 }
8722
8725 }
8726
8727 bool CanBeDisinfected()
8728 {
8729 return false;
8730 }
8731
8732
8733 //----------------------------------------------------------------
8734 override void OnVariablesSynchronized()
8735 {
8736 if (m_Initialized)
8737 {
8738 #ifdef PLATFORM_CONSOLE
8739 //bruteforce it is
8740 if (IsSplitable())
8741 {
8742 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
8743 if (menu)
8744 {
8745 menu.Refresh();
8746 }
8747 }
8748 #endif
8749 }
8750
8752 {
8753 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8754 m_WantPlayImpactSound = false;
8755 }
8756
8758 {
8759 SetWeightDirty();
8761 }
8762 if (m_VarWet != m_VarWetPrev)
8763 {
8766 }
8767
8768 if (m_SoundSyncPlay != 0)
8769 {
8770 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
8771 m_SoundSyncPlay = 0;
8772 }
8773 if (m_SoundSyncStop != 0)
8774 {
8775 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
8776 m_SoundSyncStop = 0;
8777 }
8778
8779 super.OnVariablesSynchronized();
8780 }
8781
8782 //------------------------- Quantity
8783 //----------------------------------------------------------------
8785 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
8786 {
8787 if (!IsServerCheck(allow_client))
8788 return false;
8789
8790 if (!HasQuantity())
8791 return false;
8792
8793 float min = GetQuantityMin();
8794 float max = GetQuantityMax();
8795
8796 if (value <= (min + 0.001))
8797 value = min;
8798
8799 if (value == min)
8800 {
8801 if (destroy_config)
8802 {
8803 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8804 if (dstr)
8805 {
8806 m_VarQuantity = Math.Clamp(value, min, max);
8807 this.Delete();
8808 return true;
8809 }
8810 }
8811 else if (destroy_forced)
8812 {
8813 m_VarQuantity = Math.Clamp(value, min, max);
8814 this.Delete();
8815 return true;
8816 }
8817 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
8818 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
8819 }
8820
8821 float delta = m_VarQuantity;
8822 m_VarQuantity = Math.Clamp(value, min, max);
8823
8824 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
8825 {
8826 delta = m_VarQuantity - delta;
8827
8828 if (delta)
8829 OnQuantityChanged(delta);
8830 }
8831
8832 SetVariableMask(VARIABLE_QUANTITY);
8833
8834 return false;
8835 }
8836
8837 //----------------------------------------------------------------
8839 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
8840 {
8841 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
8842 }
8843 //----------------------------------------------------------------
8844 void SetQuantityMax()
8845 {
8846 float max = GetQuantityMax();
8847 SetQuantity(max);
8848 }
8849
8850 override void SetQuantityToMinimum()
8851 {
8852 float min = GetQuantityMin();
8853 SetQuantity(min);
8854 }
8855 //----------------------------------------------------------------
8857 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
8858 {
8859 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
8860 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
8861 SetQuantity(result, destroy_config, destroy_forced);
8862 }
8863
8864 //----------------------------------------------------------------
8866 override float GetQuantityNormalized()
8867 {
8868 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
8869 }
8870
8872 {
8873 return GetQuantityNormalized();
8874 }
8875
8876 /*void SetAmmoNormalized(float value)
8877 {
8878 float value_clamped = Math.Clamp(value, 0, 1);
8879 Magazine this_mag = Magazine.Cast(this);
8880 int max_rounds = this_mag.GetAmmoMax();
8881 int result = value * max_rounds;//can the rounded if higher precision is required
8882 this_mag.SetAmmoCount(result);
8883 }*/
8884 //----------------------------------------------------------------
8885 override int GetQuantityMax()
8886 {
8887 int slot = -1;
8888 if (GetInventory())
8889 {
8890 InventoryLocation il = new InventoryLocation;
8891 GetInventory().GetCurrentInventoryLocation(il);
8892 slot = il.GetSlot();
8893 }
8894
8895 return GetTargetQuantityMax(slot);
8896 }
8897
8898 override int GetTargetQuantityMax(int attSlotID = -1)
8899 {
8900 float quantity_max = 0;
8901
8902 if (IsSplitable()) //only stackable/splitable items can check for stack size
8903 {
8904 if (attSlotID != -1)
8905 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8906
8907 if (quantity_max <= 0)
8908 quantity_max = m_VarStackMax;
8909 }
8910
8911 if (quantity_max <= 0)
8912 quantity_max = m_VarQuantityMax;
8913
8914 return quantity_max;
8915 }
8916 //----------------------------------------------------------------
8917 override int GetQuantityMin()
8918 {
8919 return m_VarQuantityMin;
8920 }
8921 //----------------------------------------------------------------
8922 int GetQuantityInit()
8923 {
8924 return m_VarQuantityInit;
8925 }
8926
8927 //----------------------------------------------------------------
8928 override bool HasQuantity()
8929 {
8930 return !(GetQuantityMax() - GetQuantityMin() == 0);
8931 }
8932
8933 override float GetQuantity()
8934 {
8935 return m_VarQuantity;
8936 }
8937
8938 bool IsFullQuantity()
8939 {
8940 return GetQuantity() >= GetQuantityMax();
8941 }
8942
8943 //Calculates weight of single item without attachments and cargo
8944 override float GetSingleInventoryItemWeightEx()
8945 {
8946 //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
8947 float weightEx = GetWeightEx();//overall weight of the item
8948 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
8949 return weightEx - special;
8950 }
8951
8952 // Obsolete, use GetSingleInventoryItemWeightEx() instead
8954 {
8956 }
8957
8958 override protected float GetWeightSpecialized(bool forceRecalc = false)
8959 {
8960 if (IsSplitable()) //quantity determines size of the stack
8961 {
8962 #ifdef DEVELOPER
8963 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8964 {
8965 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8966 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
8967 }
8968 #endif
8969
8970 return GetQuantity() * GetConfigWeightModified();
8971 }
8972 else if (HasEnergyManager())// items with energy manager
8973 {
8974 #ifdef DEVELOPER
8975 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8976 {
8977 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8978 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
8979 }
8980 #endif
8981 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
8982 }
8983 else//everything else
8984 {
8985 #ifdef DEVELOPER
8986 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8987 {
8988 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8989 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
8990 }
8991 #endif
8992 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
8993 }
8994 }
8995
8997 int GetNumberOfItems()
8998 {
8999 int item_count = 0;
9000 ItemBase item;
9001
9002 if (GetInventory().GetCargo() != NULL)
9003 {
9004 item_count = GetInventory().GetCargo().GetItemCount();
9005 }
9006
9007 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9008 {
9009 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9010 if (item)
9011 item_count += item.GetNumberOfItems();
9012 }
9013 return item_count;
9014 }
9015
9017 float GetUnitWeight(bool include_wetness = true)
9018 {
9019 float weight = 0;
9020 float wetness = 1;
9021 if (include_wetness)
9022 wetness += GetWet();
9023 if (IsSplitable()) //quantity determines size of the stack
9024 {
9025 weight = wetness * m_ConfigWeight;
9026 }
9027 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
9028 {
9029 weight = 1;
9030 }
9031 return weight;
9032 }
9033
9034 //-----------------------------------------------------------------
9035
9036 override void ClearInventory()
9037 {
9038 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
9039 {
9040 GameInventory inv = GetInventory();
9041 array<EntityAI> items = new array<EntityAI>;
9042 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
9043 for (int i = 0; i < items.Count(); i++)
9044 {
9045 ItemBase item = ItemBase.Cast(items.Get(i));
9046 if (item)
9047 {
9048 GetGame().ObjectDelete(item);
9049 }
9050 }
9051 }
9052 }
9053
9054 //------------------------- Energy
9055
9056 //----------------------------------------------------------------
9057 float GetEnergy()
9058 {
9059 float energy = 0;
9060 if (HasEnergyManager())
9061 {
9062 energy = GetCompEM().GetEnergy();
9063 }
9064 return energy;
9065 }
9066
9067
9068 override void OnEnergyConsumed()
9069 {
9070 super.OnEnergyConsumed();
9071
9073 }
9074
9075 override void OnEnergyAdded()
9076 {
9077 super.OnEnergyAdded();
9078
9080 }
9081
9082 // Converts energy (from Energy Manager) to quantity, if enabled.
9084 {
9085 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9086 {
9087 if (HasQuantity())
9088 {
9089 float energy_0to1 = GetCompEM().GetEnergy0To1();
9090 SetQuantityNormalized(energy_0to1);
9091 }
9092 }
9093 }
9094
9095 //----------------------------------------------------------------
9096 float GetHeatIsolationInit()
9097 {
9098 return ConfigGetFloat("heatIsolation");
9099 }
9100
9101 float GetHeatIsolation()
9102 {
9103 return m_HeatIsolation;
9104 }
9105
9106 float GetDryingIncrement(string pIncrementName)
9107 {
9108 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
9109 if (GetGame().ConfigIsExisting(paramPath))
9110 return GetGame().ConfigGetFloat(paramPath);
9111
9112 return 0.0;
9113 }
9114
9115 float GetSoakingIncrement(string pIncrementName)
9116 {
9117 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
9118 if (GetGame().ConfigIsExisting(paramPath))
9119 return GetGame().ConfigGetFloat(paramPath);
9120
9121 return 0.0;
9122 }
9123 //----------------------------------------------------------------
9124 override void SetWet(float value, bool allow_client = false)
9125 {
9126 if (!IsServerCheck(allow_client))
9127 return;
9128
9129 float min = GetWetMin();
9130 float max = GetWetMax();
9131
9132 float previousValue = m_VarWet;
9133
9134 m_VarWet = Math.Clamp(value, min, max);
9135
9136 if (previousValue != m_VarWet)
9137 {
9138 SetVariableMask(VARIABLE_WET);
9139 OnWetChanged(m_VarWet, previousValue);
9140 }
9141 }
9142 //----------------------------------------------------------------
9143 override void AddWet(float value)
9144 {
9145 SetWet(GetWet() + value);
9146 }
9147 //----------------------------------------------------------------
9148 override void SetWetMax()
9149 {
9151 }
9152 //----------------------------------------------------------------
9153 override float GetWet()
9154 {
9155 return m_VarWet;
9156 }
9157 //----------------------------------------------------------------
9158 override float GetWetMax()
9159 {
9160 return m_VarWetMax;
9161 }
9162 //----------------------------------------------------------------
9163 override float GetWetMin()
9164 {
9165 return m_VarWetMin;
9166 }
9167 //----------------------------------------------------------------
9168 override float GetWetInit()
9169 {
9170 return m_VarWetInit;
9171 }
9172 //----------------------------------------------------------------
9173 override void OnWetChanged(float newVal, float oldVal)
9174 {
9175 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
9176 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
9177 if (newLevel != oldLevel)
9178 {
9179 OnWetLevelChanged(newLevel,oldLevel);
9180 }
9181 }
9182
9183 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
9184 {
9185 SetWeightDirty();
9186 }
9187
9188 override EWetnessLevel GetWetLevel()
9189 {
9190 return GetWetLevelInternal(m_VarWet);
9191 }
9192
9193 //----------------------------------------------------------------
9194
9195 override void SetStoreLoad(bool value)
9196 {
9197 m_IsStoreLoad = value;
9198 }
9199
9200 override bool IsStoreLoad()
9201 {
9202 return m_IsStoreLoad;
9203 }
9204
9205 override void SetStoreLoadedQuantity(float value)
9206 {
9207 m_StoreLoadedQuantity = value;
9208 }
9209
9210 override float GetStoreLoadedQuantity()
9211 {
9212 return m_StoreLoadedQuantity;
9213 }
9214
9215 //----------------------------------------------------------------
9216
9217 float GetItemModelLength()
9218 {
9219 if (ConfigIsExisting("itemModelLength"))
9220 {
9221 return ConfigGetFloat("itemModelLength");
9222 }
9223 return 0;
9224 }
9225
9226 float GetItemAttachOffset()
9227 {
9228 if (ConfigIsExisting("itemAttachOffset"))
9229 {
9230 return ConfigGetFloat("itemAttachOffset");
9231 }
9232 return 0;
9233 }
9234
9235 override void SetCleanness(int value, bool allow_client = false)
9236 {
9237 if (!IsServerCheck(allow_client))
9238 return;
9239
9240 int previousValue = m_Cleanness;
9241
9242 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
9243
9244 if (previousValue != m_Cleanness)
9245 SetVariableMask(VARIABLE_CLEANNESS);
9246 }
9247
9248 override int GetCleanness()
9249 {
9250 return m_Cleanness;
9251 }
9252
9254 {
9255 return true;
9256 }
9257
9258 //----------------------------------------------------------------
9259 // ATTACHMENT LOCKING
9260 // Getters relevant to generic ActionLockAttachment
9261 int GetLockType()
9262 {
9263 return m_LockType;
9264 }
9265
9266 string GetLockSoundSet()
9267 {
9268 return m_LockSoundSet;
9269 }
9270
9271 //----------------------------------------------------------------
9272 //------------------------- Color
9273 // sets items color variable given color components
9274 override void SetColor(int r, int g, int b, int a)
9275 {
9280 SetVariableMask(VARIABLE_COLOR);
9281 }
9283 override void GetColor(out int r,out int g,out int b,out int a)
9284 {
9289 }
9290
9291 bool IsColorSet()
9292 {
9293 return IsVariableSet(VARIABLE_COLOR);
9294 }
9295
9297 string GetColorString()
9298 {
9299 int r,g,b,a;
9300 GetColor(r,g,b,a);
9301 r = r/255;
9302 g = g/255;
9303 b = b/255;
9304 a = a/255;
9305 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9306 }
9307 //----------------------------------------------------------------
9308 //------------------------- LiquidType
9309
9310 override void SetLiquidType(int value, bool allow_client = false)
9311 {
9312 if (!IsServerCheck(allow_client))
9313 return;
9314
9315 int old = m_VarLiquidType;
9316 m_VarLiquidType = value;
9317 OnLiquidTypeChanged(old,value);
9318 SetVariableMask(VARIABLE_LIQUIDTYPE);
9319 }
9320
9321 int GetLiquidTypeInit()
9322 {
9323 return ConfigGetInt("varLiquidTypeInit");
9324 }
9325
9326 override int GetLiquidType()
9327 {
9328 return m_VarLiquidType;
9329 }
9330
9331 protected void OnLiquidTypeChanged(int oldType, int newType)
9332 {
9333 if (newType == LIQUID_NONE && GetIsFrozen())
9334 SetFrozen(false);
9335 }
9336
9338 void UpdateQuickbarShortcutVisibility(PlayerBase player)
9339 {
9340 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9341 }
9342
9343 // -------------------------------------------------------------------------
9345 void OnInventoryEnter(Man player)
9346 {
9347 PlayerBase nplayer;
9348 if (PlayerBase.CastTo(nplayer, player))
9349 {
9350 m_CanPlayImpactSound = true;
9351 //nplayer.OnItemInventoryEnter(this);
9352 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9353 }
9354 }
9355
9356 // -------------------------------------------------------------------------
9358 void OnInventoryExit(Man player)
9359 {
9360 PlayerBase nplayer;
9361 if (PlayerBase.CastTo(nplayer,player))
9362 {
9363 //nplayer.OnItemInventoryExit(this);
9364 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9365
9366 }
9367
9368 //if (!GetGame().IsDedicatedServer())
9369 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9370
9371
9372 if (HasEnergyManager())
9373 {
9374 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
9375 }
9376 }
9377
9378 // ADVANCED PLACEMENT EVENTS
9379 override void OnPlacementStarted(Man player)
9380 {
9381 super.OnPlacementStarted(player);
9382
9383 SetTakeable(false);
9384 }
9385
9386 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
9387 {
9388 if (m_AdminLog)
9389 {
9390 m_AdminLog.OnPlacementComplete(player, this);
9391 }
9392
9393 super.OnPlacementComplete(player, position, orientation);
9394 }
9395
9396 //-----------------------------
9397 // AGENT SYSTEM
9398 //-----------------------------
9399 //--------------------------------------------------------------------------
9400 bool ContainsAgent(int agent_id)
9401 {
9402 if (agent_id & m_AttachedAgents)
9403 {
9404 return true;
9405 }
9406 else
9407 {
9408 return false;
9409 }
9410 }
9411
9412 //--------------------------------------------------------------------------
9413 override void RemoveAgent(int agent_id)
9414 {
9415 if (ContainsAgent(agent_id))
9416 {
9417 m_AttachedAgents = ~agent_id & m_AttachedAgents;
9418 }
9419 }
9420
9421 //--------------------------------------------------------------------------
9422 override void RemoveAllAgents()
9423 {
9424 m_AttachedAgents = 0;
9425 }
9426 //--------------------------------------------------------------------------
9427 override void RemoveAllAgentsExcept(int agent_to_keep)
9428 {
9429 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
9430 }
9431 // -------------------------------------------------------------------------
9432 override void InsertAgent(int agent, float count = 1)
9433 {
9434 if (count < 1)
9435 return;
9436 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
9438 }
9439
9441 void TransferAgents(int agents)
9442 {
9444 }
9445
9446 // -------------------------------------------------------------------------
9447 override int GetAgents()
9448 {
9449 return m_AttachedAgents;
9450 }
9451 //----------------------------------------------------------------------
9452
9453 /*int GetContaminationType()
9454 {
9455 int contamination_type;
9456
9457 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
9458 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
9459 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
9460 const int DIRTY_MASK = eAgents.WOUND_AGENT;
9461
9462 Edible_Base edible = Edible_Base.Cast(this);
9463 int agents = GetAgents();
9464 if (edible)
9465 {
9466 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
9467 if (profile)
9468 {
9469 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
9470 }
9471 }
9472 if (agents & CONTAMINATED_MASK)
9473 {
9474 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
9475 }
9476 if (agents & POISONED_MASK)
9477 {
9478 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
9479 }
9480 if (agents & NERVE_GAS_MASK)
9481 {
9482 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
9483 }
9484 if (agents & DIRTY_MASK)
9485 {
9486 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
9487 }
9488
9489 return agents;
9490 }*/
9491
9492 // -------------------------------------------------------------------------
9493 bool LoadAgents(ParamsReadContext ctx, int version)
9494 {
9495 if (!ctx.Read(m_AttachedAgents))
9496 return false;
9497 return true;
9498 }
9499 // -------------------------------------------------------------------------
9501 {
9502
9504 }
9505 // -------------------------------------------------------------------------
9506
9508 override void CheckForRoofLimited(float timeTresholdMS = 3000)
9509 {
9510 super.CheckForRoofLimited(timeTresholdMS);
9511
9512 float time = GetGame().GetTime();
9513 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9514 {
9515 m_PreviousRoofTestTime = time;
9516 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9517 }
9518 }
9519
9520 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
9521 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
9522 {
9523 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
9524 {
9525 return 0;
9526 }
9527
9528 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
9529 {
9530 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
9531 if (filter)
9532 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
9533 else
9534 return 0;//otherwise return 0 when no filter attached
9535 }
9536
9537 string subclassPath, entryName;
9538
9539 switch (type)
9540 {
9541 case DEF_BIOLOGICAL:
9542 entryName = "biological";
9543 break;
9544 case DEF_CHEMICAL:
9545 entryName = "chemical";
9546 break;
9547 default:
9548 entryName = "biological";
9549 break;
9550 }
9551
9552 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
9553
9554 return GetGame().ConfigGetFloat(subclassPath + entryName);
9555 }
9556
9557
9558
9560 override void EEOnCECreate()
9561 {
9562 if (!IsMagazine())
9564
9566 }
9567
9568
9569 //-------------------------
9570 // OPEN/CLOSE USER ACTIONS
9571 //-------------------------
9573 void Open();
9574 void Close();
9575 bool IsOpen()
9576 {
9577 return true;
9578 }
9579
9580 override bool CanDisplayCargo()
9581 {
9582 return IsOpen();
9583 }
9584
9585
9586 // ------------------------------------------------------------
9587 // CONDITIONS
9588 // ------------------------------------------------------------
9589 override bool CanPutInCargo(EntityAI parent)
9590 {
9591 if (parent)
9592 {
9593 if (parent.IsInherited(DayZInfected))
9594 return true;
9595
9596 if (!parent.IsRuined())
9597 return true;
9598 }
9599
9600 return true;
9601 }
9602
9603 override bool CanPutAsAttachment(EntityAI parent)
9604 {
9605 if (!super.CanPutAsAttachment(parent))
9606 {
9607 return false;
9608 }
9609
9610 if (!IsRuined() && !parent.IsRuined())
9611 {
9612 return true;
9613 }
9614
9615 return false;
9616 }
9617
9618 override bool CanReceiveItemIntoCargo(EntityAI item)
9619 {
9620 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9621 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9622 // return false;
9623
9624 return super.CanReceiveItemIntoCargo(item);
9625 }
9626
9627 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
9628 {
9629 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9630 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9631 // return false;
9632
9633 GameInventory attachmentInv = attachment.GetInventory();
9634 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9635 {
9636 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9637 return false;
9638 }
9639
9640 InventoryLocation loc = new InventoryLocation();
9641 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9642 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
9643 return false;
9644
9645 return super.CanReceiveAttachment(attachment, slotId);
9646 }
9647
9648 override bool CanReleaseAttachment(EntityAI attachment)
9649 {
9650 if (!super.CanReleaseAttachment(attachment))
9651 return false;
9652
9653 return GetInventory().AreChildrenAccessible();
9654 }
9655
9656 /*override bool CanLoadAttachment(EntityAI attachment)
9657 {
9658 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9659 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9660 // return false;
9661
9662 GameInventory attachmentInv = attachment.GetInventory();
9663 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9664 {
9665 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
9666 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
9667
9668 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9669 return false;
9670 }
9671
9672 return super.CanLoadAttachment(attachment);
9673 }*/
9674
9675 // Plays muzzle flash particle effects
9676 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9677 {
9678 int id = muzzle_owner.GetMuzzleID();
9679 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
9680
9681 if (WPOF_array)
9682 {
9683 for (int i = 0; i < WPOF_array.Count(); i++)
9684 {
9685 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9686
9687 if (WPOF)
9688 {
9689 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9690 }
9691 }
9692 }
9693 }
9694
9695 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
9696 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9697 {
9698 int id = muzzle_owner.GetMuzzleID();
9699 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
9700
9701 if (WPOBE_array)
9702 {
9703 for (int i = 0; i < WPOBE_array.Count(); i++)
9704 {
9705 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9706
9707 if (WPOBE)
9708 {
9709 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9710 }
9711 }
9712 }
9713 }
9714
9715 // Plays all weapon overheating particles
9716 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9717 {
9718 int id = muzzle_owner.GetMuzzleID();
9719 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9720
9721 if (WPOOH_array)
9722 {
9723 for (int i = 0; i < WPOOH_array.Count(); i++)
9724 {
9725 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9726
9727 if (WPOOH)
9728 {
9729 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9730 }
9731 }
9732 }
9733 }
9734
9735 // Updates all weapon overheating particles
9736 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9737 {
9738 int id = muzzle_owner.GetMuzzleID();
9739 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9740
9741 if (WPOOH_array)
9742 {
9743 for (int i = 0; i < WPOOH_array.Count(); i++)
9744 {
9745 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9746
9747 if (WPOOH)
9748 {
9749 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9750 }
9751 }
9752 }
9753 }
9754
9755 // Stops overheating particles
9756 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9757 {
9758 int id = muzzle_owner.GetMuzzleID();
9759 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9760
9761 if (WPOOH_array)
9762 {
9763 for (int i = 0; i < WPOOH_array.Count(); i++)
9764 {
9765 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9766
9767 if (WPOOH)
9768 {
9769 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9770 }
9771 }
9772 }
9773 }
9774
9775 //----------------------------------------------------------------
9776 //Item Behaviour - unified approach
9777 override bool IsHeavyBehaviour()
9778 {
9779 if (m_ItemBehaviour == 0)
9780 {
9781 return true;
9782 }
9783
9784 return false;
9785 }
9786
9787 override bool IsOneHandedBehaviour()
9788 {
9789 if (m_ItemBehaviour == 1)
9790 {
9791 return true;
9792 }
9793
9794 return false;
9795 }
9796
9797 override bool IsTwoHandedBehaviour()
9798 {
9799 if (m_ItemBehaviour == 2)
9800 {
9801 return true;
9802 }
9803
9804 return false;
9805 }
9806
9807 bool IsDeployable()
9808 {
9809 return false;
9810 }
9811
9813 float GetDeployTime()
9814 {
9815 return UATimeSpent.DEFAULT_DEPLOY;
9816 }
9817
9818
9819 //----------------------------------------------------------------
9820 // Item Targeting (User Actions)
9821 override void SetTakeable(bool pState)
9822 {
9823 m_IsTakeable = pState;
9824 SetSynchDirty();
9825 }
9826
9827 override bool IsTakeable()
9828 {
9829 return m_IsTakeable;
9830 }
9831
9832 // For cases where we want to show object widget which cant be taken to hands
9834 {
9835 return false;
9836 }
9837
9839 protected void PreLoadSoundAttachmentType()
9840 {
9841 string att_type = "None";
9842
9843 if (ConfigIsExisting("soundAttType"))
9844 {
9845 att_type = ConfigGetString("soundAttType");
9846 }
9847
9848 m_SoundAttType = att_type;
9849 }
9850
9851 override string GetAttachmentSoundType()
9852 {
9853 return m_SoundAttType;
9854 }
9855
9856 //----------------------------------------------------------------
9857 //SOUNDS - ItemSoundHandler
9858 //----------------------------------------------------------------
9859
9860 string GetPlaceSoundset(); // played when deploy starts
9861 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
9862 string GetDeploySoundset(); // played when deploy sucessfully finishes
9863
9865 {
9866 if (!m_ItemSoundHandler)
9868
9869 return m_ItemSoundHandler;
9870 }
9871
9872 // override to initialize sounds
9873 protected void InitItemSounds()
9874 {
9875 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
9876 return;
9877
9879
9880 if (GetPlaceSoundset() != string.Empty)
9881 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
9882
9883 if (GetDeploySoundset() != string.Empty)
9884 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
9885
9886 SoundParameters params = new SoundParameters();
9887 params.m_Loop = true;
9888 if (GetLoopDeploySoundset() != string.Empty)
9889 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
9890 }
9891
9892 // Start sound using ItemSoundHandler
9893 void StartItemSoundServer(int id)
9894 {
9895 if (!GetGame().IsServer())
9896 return;
9897
9898 m_SoundSyncPlay = id;
9899 SetSynchDirty();
9900
9901 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
9903 }
9904
9905 // Stop sound using ItemSoundHandler
9906 void StopItemSoundServer(int id)
9907 {
9908 if (!GetGame().IsServer())
9909 return;
9910
9911 m_SoundSyncStop = id;
9912 SetSynchDirty();
9913
9914 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
9916 }
9917
9918 protected void ClearStartItemSoundServer()
9919 {
9920 m_SoundSyncPlay = 0;
9921 }
9922
9923 protected void ClearStopItemSoundServer()
9924 {
9925 m_SoundSyncStop = 0;
9926 }
9927
9929 void PlayAttachSound(string slot_type)
9930 {
9931 if (!GetGame().IsDedicatedServer())
9932 {
9933 if (ConfigIsExisting("attachSoundSet"))
9934 {
9935 string cfg_path = "";
9936 string soundset = "";
9937 string type_name = GetType();
9938
9939 TStringArray cfg_soundset_array = new TStringArray;
9940 TStringArray cfg_slot_array = new TStringArray;
9941 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9942 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9943
9944 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9945 {
9946 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9947 {
9948 if (cfg_slot_array[i] == slot_type)
9949 {
9950 soundset = cfg_soundset_array[i];
9951 break;
9952 }
9953 }
9954 }
9955
9956 if (soundset != "")
9957 {
9958 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
9959 sound.SetAutodestroy(true);
9960 }
9961 }
9962 }
9963 }
9964
9965 void PlayDetachSound(string slot_type)
9966 {
9967 //TODO - evaluate if needed and devise universal config structure if so
9968 }
9969
9970 void OnApply(PlayerBase player);
9971
9973 {
9974 return 1.0;
9975 };
9976 //returns applicable selection
9977 array<string> GetHeadHidingSelection()
9978 {
9980 }
9981
9983 {
9985 }
9986
9987 WrittenNoteData GetWrittenNoteData() {};
9988
9990 {
9991 SetDynamicPhysicsLifeTime(0.01);
9992 m_ItemBeingDroppedPhys = false;
9993 }
9994
9996 {
9997 array<string> zone_names = new array<string>;
9998 GetDamageZones(zone_names);
9999 for (int i = 0; i < zone_names.Count(); i++)
10000 {
10001 SetHealthMax(zone_names.Get(i),"Health");
10002 }
10003 SetHealthMax("","Health");
10004 }
10005
10007 void SetZoneDamageCEInit()
10008 {
10009 float global_health = GetHealth01("","Health");
10010 array<string> zones = new array<string>;
10011 GetDamageZones(zones);
10012 //set damage of all zones to match global health level
10013 for (int i = 0; i < zones.Count(); i++)
10014 {
10015 SetHealth01(zones.Get(i),"Health",global_health);
10016 }
10017 }
10018
10020 bool IsCoverFaceForShave(string slot_name)
10021 {
10022 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10023 }
10024
10025 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10026 {
10027 if (!hasRootAsPlayer)
10028 {
10029 if (refParentIB)
10030 {
10031 // parent is wet
10032 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
10033 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10034 // parent has liquid inside
10035 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
10036 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10037 // drying
10038 else if (m_VarWet > m_VarWetMin)
10039 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
10040 }
10041 else
10042 {
10043 // drying on ground or inside non-itembase (car, ...)
10044 if (m_VarWet > m_VarWetMin)
10045 AddWet(-1 * delta * GetDryingIncrement("ground"));
10046 }
10047 }
10048 }
10049
10050 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10051 {
10053 {
10054 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
10055 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10056 {
10057 float heatPermCoef = 1.0;
10058 EntityAI ent = this;
10059 while (ent)
10060 {
10061 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10062 ent = ent.GetHierarchyParent();
10063 }
10064
10065 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10066 }
10067 }
10068 }
10069
10070 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
10071 {
10072 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
10073 EntityAI parent = GetHierarchyParent();
10074 if (!parent)
10075 {
10076 hasParent = false;
10077 hasRootAsPlayer = false;
10078 }
10079 else
10080 {
10081 hasParent = true;
10082 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10083 refParentIB = ItemBase.Cast(parent);
10084 }
10085 }
10086
10087 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
10088 {
10089 // this is stub, implemented on Edible_Base
10090 }
10091
10092 bool CanDecay()
10093 {
10094 // return true used on selected food clases so they can decay
10095 return false;
10096 }
10097
10098 protected bool CanProcessDecay()
10099 {
10100 // this is stub, implemented on Edible_Base class
10101 // used to determine whether it is still necessary for the food to decay
10102 return false;
10103 }
10104
10105 protected bool CanHaveWetness()
10106 {
10107 // return true used on selected items that have a wetness effect
10108 return false;
10109 }
10110
10112 bool CanBeConsumed(ConsumeConditionData data = null)
10113 {
10114 return !GetIsFrozen() && IsOpen();
10115 }
10116
10117 override void ProcessVariables()
10118 {
10119 bool hasParent = false, hasRootAsPlayer = false;
10120 ItemBase refParentIB;
10121
10122 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
10123 bool foodDecay = g_Game.IsFoodDecayEnabled();
10124
10125 if (wwtu || foodDecay)
10126 {
10127 bool processWetness = wwtu && CanHaveWetness();
10128 bool processTemperature = wwtu && CanHaveTemperature();
10129 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
10130
10131 if (processWetness || processTemperature || processDecay)
10132 {
10133 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
10134
10135 if (processWetness)
10136 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10137
10138 if (processTemperature)
10139 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10140
10141 if (processDecay)
10142 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10143 }
10144 }
10145 }
10146
10149 {
10150 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
10151 }
10152
10153 override float GetTemperatureFreezeThreshold()
10154 {
10156 return Liquid.GetFreezeThreshold(GetLiquidType());
10157
10158 return super.GetTemperatureFreezeThreshold();
10159 }
10160
10161 override float GetTemperatureThawThreshold()
10162 {
10164 return Liquid.GetThawThreshold(GetLiquidType());
10165
10166 return super.GetTemperatureThawThreshold();
10167 }
10168
10169 override float GetItemOverheatThreshold()
10170 {
10172 return Liquid.GetBoilThreshold(GetLiquidType());
10173
10174 return super.GetItemOverheatThreshold();
10175 }
10176
10177 override float GetTemperatureFreezeTime()
10178 {
10179 if (HasQuantity())
10180 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
10181
10182 return super.GetTemperatureFreezeTime();
10183 }
10184
10185 override float GetTemperatureThawTime()
10186 {
10187 if (HasQuantity())
10188 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
10189
10190 return super.GetTemperatureThawTime();
10191 }
10192
10194 void AffectLiquidContainerOnFill(int liquid_type, float amount);
10196 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
10197
10198 bool IsCargoException4x3(EntityAI item)
10199 {
10200 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10201 }
10202
10204 {
10205 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10206 }
10207
10209 void AddLightSourceItem(ItemBase lightsource)
10210 {
10211 m_LightSourceItem = lightsource;
10212 }
10213
10215 {
10216 m_LightSourceItem = null;
10217 }
10218
10220 {
10221 return m_LightSourceItem;
10222 }
10223
10225 array<int> GetValidFinishers()
10226 {
10227 return null;
10228 }
10229
10231 bool GetActionWidgetOverride(out typename name)
10232 {
10233 return false;
10234 }
10235
10236 bool PairWithDevice(notnull ItemBase otherDevice)
10237 {
10238 if (GetGame().IsServer())
10239 {
10240 ItemBase explosive = otherDevice;
10242 if (!trg)
10243 {
10244 trg = RemoteDetonatorTrigger.Cast(otherDevice);
10245 explosive = this;
10246 }
10247
10248 explosive.PairRemote(trg);
10249 trg.SetControlledDevice(explosive);
10250
10251 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10252 trg.SetPersistentPairID(persistentID);
10253 explosive.SetPersistentPairID(persistentID);
10254
10255 return true;
10256 }
10257 return false;
10258 }
10259
10261 float GetBaitEffectivity()
10262 {
10263 float ret = 1.0;
10264 if (HasQuantity())
10265 ret *= GetQuantityNormalized();
10266 ret *= GetHealth01();
10267
10268 return ret;
10269 }
10270
10271 #ifdef DEVELOPER
10272 override void SetDebugItem()
10273 {
10274 super.SetDebugItem();
10275 _itemBase = this;
10276 }
10277
10278 override string GetDebugText()
10279 {
10280 string text = super.GetDebugText();
10281
10282 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
10283 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
10284
10285 return text;
10286 }
10287 #endif
10288
10289 bool CanBeUsedForSuicide()
10290 {
10291 return true;
10292 }
10293
10295 //DEPRECATED BELOW
10297 // Backwards compatibility
10298 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10299 {
10300 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
10301 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
10302 }
10303
10304 // replaced by ItemSoundHandler
10305 protected EffectSound m_SoundDeployFinish;
10306 protected EffectSound m_SoundPlace;
10307 protected EffectSound m_DeployLoopSoundEx;
10308 protected EffectSound m_SoundDeploy;
10309 bool m_IsPlaceSound;
10310 bool m_IsDeploySound;
10312
10313 string GetDeployFinishSoundset();
10314 void PlayDeploySound();
10315 void PlayDeployFinishSound();
10316 void PlayPlaceSound();
10317 void PlayDeployLoopSoundEx();
10318 void StopDeployLoopSoundEx();
10319 void SoundSynchRemoteReset();
10320 void SoundSynchRemote();
10321 bool UsesGlobalDeploy(){return false;}
10322 bool CanPlayDeployLoopSound(){return false;}
10324 bool IsPlaceSound(){return m_IsPlaceSound;}
10325 bool IsDeploySound(){return m_IsDeploySound;}
10326 void SetIsPlaceSound(bool is_place_sound);
10327 void SetIsDeploySound(bool is_deploy_sound);
10328}
10329
10330EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
10331{
10332 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
10333 if (entity)
10334 {
10335 bool is_item = entity.IsInherited(ItemBase);
10336 if (is_item && full_quantity)
10337 {
10338 ItemBase item = ItemBase.Cast(entity);
10339 item.SetQuantity(item.GetQuantityInit());
10340 }
10341 }
10342 else
10343 {
10344 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
10345 return NULL;
10346 }
10347 return entity;
10348}
10349
10350void SetupSpawnedItem(ItemBase item, float health, float quantity)
10351{
10352 if (item)
10353 {
10354 if (health > 0)
10355 item.SetHealth("", "", health);
10356
10357 if (item.CanHaveTemperature())
10358 {
10359 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
10360 if (item.CanFreeze())
10361 item.SetFrozen(false);
10362 }
10363
10364 if (item.HasEnergyManager())
10365 {
10366 if (quantity >= 0)
10367 {
10368 item.GetCompEM().SetEnergy0To1(quantity);
10369 }
10370 else
10371 {
10372 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
10373 }
10374 }
10375 else if (item.IsMagazine())
10376 {
10377 Magazine mag = Magazine.Cast(item);
10378 if (quantity >= 0)
10379 {
10380 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10381 }
10382 else
10383 {
10384 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
10385 }
10386
10387 }
10388 else
10389 {
10390 if (quantity >= 0)
10391 {
10392 item.SetQuantityNormalized(quantity, false);
10393 }
10394 else
10395 {
10396 item.SetQuantity(Math.AbsFloat(quantity));
10397 }
10398
10399 }
10400 }
10401}
10402
10403#ifdef DEVELOPER
10404ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
10405#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()

Используется в InventoryItem::ToggleDebugActionsMask().