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

◆ ExplodeAmmo()

void SpawnItemOnLocation::ExplodeAmmo ( )
private

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

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

Используется в InventoryItem::DoAmmoExplosion() и InventoryItem::EEKilled().