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

◆ GetDebugActionsMask()

static int SpawnItemOnLocation::GetDebugActionsMask ( )
staticprivate

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

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