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

◆ IsBloodContainer()

bool SpawnItemOnLocation::IsBloodContainer ( )
private

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

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