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

◆ IsNVG()

bool SpawnItemOnLocation::IsNVG ( )
private

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

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