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

◆ EEItemLocationChanged()

override void SpawnItemOnLocation::EEItemLocationChanged ( notnull InventoryLocation oldLoc,
notnull InventoryLocation newLoc )
private

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

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