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

◆ SetIsHologram()

void SpawnItemOnLocation::SetIsHologram ( bool is_hologram)
private

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

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