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

◆ CanBeDigged()

bool SpawnItemOnLocation::CanBeDigged ( )
private

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

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