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

◆ ChangeIntoOnAttach()

override string SpawnItemOnLocation::ChangeIntoOnAttach ( string slot)
private

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

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