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

◆ AddWet()

override void SpawnItemOnLocation::AddWet ( float value)
protected

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

8368{
8369 override bool CanPutAsAttachment(EntityAI parent)
8370 {
8371 return true;
8372 }
8373};
8374
8375//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8376
8377class ItemBase extends InventoryItem
8378{
8382
8384
8385 static int m_DebugActionsMask;
8387 // ============================================
8388 // Variable Manipulation System
8389 // ============================================
8390 // Quantity
8391
8392 float m_VarQuantity;
8393 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8395 int m_VarQuantityMin;
8396 int m_VarQuantityMax;
8397 int m_Count;
8398 float m_VarStackMax;
8399 float m_StoreLoadedQuantity = float.LOWEST;
8400 // Wet
8401 float m_VarWet;
8402 float m_VarWetPrev;//for client to know wetness changed during synchronization
8403 float m_VarWetInit;
8404 float m_VarWetMin;
8405 float m_VarWetMax;
8406 // Cleanness
8407 int m_Cleanness;
8408 int m_CleannessInit;
8409 int m_CleannessMin;
8410 int m_CleannessMax;
8411 // impact sounds
8413 bool m_CanPlayImpactSound = true;
8414 float m_ImpactSpeed;
8416 //
8417 float m_HeatIsolation;
8418 float m_ItemModelLength;
8419 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8421 int m_VarLiquidType;
8422 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8423 int m_QuickBarBonus;
8424 bool m_IsBeingPlaced;
8425 bool m_IsHologram;
8426 bool m_IsTakeable;
8427 bool m_ThrowItemOnDrop;
8430 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8431 bool can_this_be_combined; //Check if item can be combined
8432 bool m_CanThisBeSplit; //Check if item can be split
8433 bool m_IsStoreLoad = false;
8434 bool m_CanShowQuantity;
8435 bool m_HasQuantityBar;
8436 protected bool m_CanBeDigged;
8437 protected bool m_IsResultOfSplit
8438
8439 string m_SoundAttType;
8440 // items color variables
8445 //-------------------------------------------------------
8446
8447 // light source managing
8449
8453
8454 //==============================================
8455 // agent system
8456 private int m_AttachedAgents;
8457
8459 void TransferModifiers(PlayerBase reciever);
8460
8461
8462 // Weapons & suppressors particle effects
8467 static int m_LastRegisteredWeaponID = 0;
8468
8469 // Overheating effects
8471 float m_OverheatingShots;
8472 ref Timer m_CheckOverheating;
8473 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8474 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8475 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8476 ref array <ref OverheatingParticle> m_OverheatingParticles;
8477
8479 protected bool m_HideSelectionsBySlot;
8480
8481 // Admin Log
8482 PluginAdminLog m_AdminLog;
8483
8484 // misc
8485 ref Timer m_PhysDropTimer;
8486
8487 // Attachment Locking variables
8488 ref array<int> m_CompatibleLocks;
8489 protected int m_LockType;
8490 protected ref EffectSound m_LockingSound;
8491 protected string m_LockSoundSet;
8492
8493 // ItemSoundHandler
8494 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8495 protected int m_SoundSyncPlay; // id for sound to play
8496 protected int m_SoundSyncStop; // id for sound to stop
8498
8499 //temperature
8500 private float m_TemperaturePerQuantityWeight;
8501
8502 // -------------------------------------------------------------------------
8503 void ItemBase()
8504 {
8505 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8509
8510 if (!GetGame().IsDedicatedServer())
8511 {
8512 if (HasMuzzle())
8513 {
8515
8517 {
8519 }
8520 }
8521
8523 m_ActionsInitialize = false;
8524 }
8525
8526 m_OldLocation = null;
8527
8528 if (GetGame().IsServer())
8529 {
8530 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8531 }
8532
8533 if (ConfigIsExisting("headSelectionsToHide"))
8534 {
8536 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8537 }
8538
8539 m_HideSelectionsBySlot = false;
8540 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8541 {
8542 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8543 }
8544
8545 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8546
8547 m_IsResultOfSplit = false;
8548
8550 }
8551
8552 override void InitItemVariables()
8553 {
8554 super.InitItemVariables();
8555
8556 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8557 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8558 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8559 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8560 m_VarStackMax = ConfigGetFloat("varStackMax");
8561 m_Count = ConfigGetInt("count");
8562
8563 m_CanShowQuantity = ConfigGetBool("quantityShow");
8564 m_HasQuantityBar = ConfigGetBool("quantityBar");
8565
8566 m_CleannessInit = ConfigGetInt("varCleannessInit");
8568 m_CleannessMin = ConfigGetInt("varCleannessMin");
8569 m_CleannessMax = ConfigGetInt("varCleannessMax");
8570
8571 m_WantPlayImpactSound = false;
8572 m_ImpactSpeed = 0.0;
8573
8574 m_VarWetInit = ConfigGetFloat("varWetInit");
8576 m_VarWetMin = ConfigGetFloat("varWetMin");
8577 m_VarWetMax = ConfigGetFloat("varWetMax");
8578
8579 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8580 if (IsLiquidContainer() && GetQuantity() != 0)
8582 m_IsBeingPlaced = false;
8583 m_IsHologram = false;
8584 m_IsTakeable = true;
8585 m_CanBeMovedOverride = false;
8589 m_CanBeDigged = ConfigGetBool("canBeDigged");
8590
8591 m_CompatibleLocks = new array<int>();
8592 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8593 m_LockType = ConfigGetInt("lockType");
8594
8595 //Define if item can be split and set ability to be combined accordingly
8596 m_CanThisBeSplit = false;
8597 can_this_be_combined = false;
8598 if (ConfigIsExisting("canBeSplit"))
8599 {
8600 can_this_be_combined = ConfigGetBool("canBeSplit");
8602 }
8603
8604 m_ItemBehaviour = -1;
8605 if (ConfigIsExisting("itemBehaviour"))
8606 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8607
8608 //RegisterNetSyncVariableInt("m_VariablesMask");
8609 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8610 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8611 RegisterNetSyncVariableInt("m_VarLiquidType");
8612 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8613
8614 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8615 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8616 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8617
8618 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8619 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8620 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8621 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8622
8623 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8624 RegisterNetSyncVariableBool("m_IsTakeable");
8625 RegisterNetSyncVariableBool("m_IsHologram");
8626
8627 InitItemSounds();
8629 {
8630 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8631 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8632 }
8633
8634 m_LockSoundSet = ConfigGetString("lockSoundSet");
8635
8637 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8638 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8639
8640 }
8641
8642 override int GetQuickBarBonus()
8643 {
8644 return m_QuickBarBonus;
8645 }
8646
8647 void InitializeActions()
8648 {
8650 if (!m_InputActionMap)
8651 {
8653 m_InputActionMap = iam;
8654 SetActions();
8656 }
8657 }
8658
8659 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
8660 {
8662 {
8663 m_ActionsInitialize = true;
8665 }
8666
8667 actions = m_InputActionMap.Get(action_input_type);
8668 }
8669
8670 void SetActions()
8671 {
8672 AddAction(ActionTakeItem);
8673 AddAction(ActionTakeItemToHands);
8674 AddAction(ActionWorldCraft);
8676 AddAction(ActionAttachWithSwitch);
8677 }
8678
8679 void SetActionAnimOverrides(); // Override action animation for specific item
8680
8681 void AddAction(typename actionName)
8682 {
8683 ActionBase action = ActionManagerBase.GetAction(actionName);
8684
8685 if (!action)
8686 {
8687 Debug.LogError("Action " + actionName + " dosn't exist!");
8688 return;
8689 }
8690
8691 typename ai = action.GetInputType();
8692 if (!ai)
8693 {
8694 m_ActionsInitialize = false;
8695 return;
8696 }
8697
8698 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8699 if (!action_array)
8700 {
8701 action_array = new array<ActionBase_Basic>;
8702 m_InputActionMap.Insert(ai, action_array);
8703 }
8704 if (LogManager.IsActionLogEnable())
8705 {
8706 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
8707 }
8708
8709 if (action_array.Find(action) != -1)
8710 {
8711 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
8712 }
8713 else
8714 {
8715 action_array.Insert(action);
8716 }
8717 }
8718
8719 void RemoveAction(typename actionName)
8720 {
8721 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8722 ActionBase action = player.GetActionManager().GetAction(actionName);
8723 typename ai = action.GetInputType();
8724 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8725
8726 if (action_array)
8727 {
8728 action_array.RemoveItem(action);
8729 }
8730 }
8731
8732 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
8733 // Set -1 for params which should stay in default state
8734 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
8735 {
8736 ActionOverrideData overrideData = new ActionOverrideData();
8737 overrideData.m_CommandUID = commandUID;
8738 overrideData.m_CommandUIDProne = commandUIDProne;
8739 overrideData.m_StanceMask = stanceMask;
8740
8741 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
8742 if (!actionMap) // create new map of action > overidables map
8743 {
8744 actionMap = new TActionAnimOverrideMap();
8745 m_ItemActionOverrides.Insert(action, actionMap);
8746 }
8747
8748 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
8749
8750 }
8751
8752 void OnItemInHandsPlayerSwimStart(PlayerBase player);
8753
8754 ScriptedLightBase GetLight();
8755
8756 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8757 void LoadParticleConfigOnFire(int id)
8758 {
8759 if (!m_OnFireEffect)
8761
8764
8765 string config_to_search = "CfgVehicles";
8766 string muzzle_owner_config;
8767
8768 if (!m_OnFireEffect.Contains(id))
8769 {
8770 if (IsInherited(Weapon))
8771 config_to_search = "CfgWeapons";
8772
8773 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8774
8775 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8776
8777 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
8778
8779 if (config_OnFire_subclass_count > 0)
8780 {
8781 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8782
8783 for (int i = 0; i < config_OnFire_subclass_count; i++)
8784 {
8785 string particle_class = "";
8786 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
8787 string config_OnFire_entry = config_OnFire_class + particle_class;
8788 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8789 WPOF_array.Insert(WPOF);
8790 }
8791
8792
8793 m_OnFireEffect.Insert(id, WPOF_array);
8794 }
8795 }
8796
8797 if (!m_OnBulletCasingEjectEffect.Contains(id))
8798 {
8799 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
8800 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8801
8802 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8803
8804 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8805
8806 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8807 {
8808 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8809
8810 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8811 {
8812 string particle_class2 = "";
8813 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8814 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8815 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8816 WPOBE_array.Insert(WPOBE);
8817 }
8818
8819
8820 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
8821 }
8822 }
8823 }
8824
8825 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8827 {
8830
8831 if (!m_OnOverheatingEffect.Contains(id))
8832 {
8833 string config_to_search = "CfgVehicles";
8834
8835 if (IsInherited(Weapon))
8836 config_to_search = "CfgWeapons";
8837
8838 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
8839 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8840
8841 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
8842 {
8843
8844 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
8845
8847 {
8848 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
8849 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8850 Error(error);
8851 return;
8852 }
8853
8854 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
8855 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
8856
8857
8858
8859 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
8860 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8861
8862 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8863 {
8864 string particle_class = "";
8865 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8866 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8867 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
8868
8869 if (entry_type == CT_CLASS)
8870 {
8871 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8872 WPOOH_array.Insert(WPOF);
8873 }
8874 }
8875
8876
8877 m_OnOverheatingEffect.Insert(id, WPOOH_array);
8878 }
8879 }
8880 }
8881
8882 float GetOverheatingValue()
8883 {
8884 return m_OverheatingShots;
8885 }
8886
8887 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
8888 {
8889 if (m_MaxOverheatingValue > 0)
8890 {
8892
8893 if (!m_CheckOverheating)
8895
8897 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8898
8899 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8900 }
8901 }
8902
8903 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8904 {
8906 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8907
8909 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8910
8912 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8913
8915 {
8917 }
8918 }
8919
8921 {
8923 }
8924
8925 void OnOverheatingDecay()
8926 {
8927 if (m_MaxOverheatingValue > 0)
8928 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8929 else
8931
8932 if (m_OverheatingShots <= 0)
8933 {
8936 }
8937 else
8938 {
8939 if (!m_CheckOverheating)
8941
8943 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8944 }
8945
8946 CheckOverheating(this, "", this);
8947 }
8948
8949 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8950 {
8952 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8953 }
8954
8955 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8956 {
8958 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8960 }
8961
8962 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8963 {
8965 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8966 }
8967
8968 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8969 {
8971 m_OverheatingParticles = new array<ref OverheatingParticle>;
8972
8973 OverheatingParticle OP = new OverheatingParticle();
8974 OP.RegisterParticle(p);
8975 OP.SetOverheatingLimitMin(min_heat_coef);
8976 OP.SetOverheatingLimitMax(max_heat_coef);
8977 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8978
8979 m_OverheatingParticles.Insert(OP);
8980 }
8981
8982 float GetOverheatingCoef()
8983 {
8984 if (m_MaxOverheatingValue > 0)
8986
8987 return -1;
8988 }
8989
8991 {
8993 {
8994 float overheat_coef = GetOverheatingCoef();
8995 int count = m_OverheatingParticles.Count();
8996
8997 for (int i = count; i > 0; --i)
8998 {
8999 int id = i - 1;
9000 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9001 Particle p = OP.GetParticle();
9002
9003 float overheat_min = OP.GetOverheatingLimitMin();
9004 float overheat_max = OP.GetOverheatingLimitMax();
9005
9006 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9007 {
9008 if (p)
9009 {
9010 p.Stop();
9011 OP.RegisterParticle(null);
9012 }
9013 }
9014 }
9015 }
9016 }
9017
9019 {
9021 {
9022 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
9023 {
9024 int id = i - 1;
9025 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9026
9027 if (OP)
9028 {
9029 Particle p = OP.GetParticle();
9030
9031 if (p)
9032 {
9033 p.Stop();
9034 }
9035
9036 delete OP;
9037 }
9038 }
9039
9040 m_OverheatingParticles.Clear();
9042 }
9043 }
9044
9046 float GetInfectionChance(int system = 0, Param param = null)
9047 {
9048 return 0.0;
9049 }
9050
9051
9052 float GetDisinfectQuantity(int system = 0, Param param1 = null)
9053 {
9054 return 250;//default value
9055 }
9056
9057 float GetFilterDamageRatio()
9058 {
9059 return 0;
9060 }
9061
9063 bool HasMuzzle()
9064 {
9065 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
9066 return true;
9067
9068 return false;
9069 }
9070
9072 int GetMuzzleID()
9073 {
9074 if (!m_WeaponTypeToID)
9076
9077 if (m_WeaponTypeToID.Contains(GetType()))
9078 {
9079 return m_WeaponTypeToID.Get(GetType());
9080 }
9081 else
9082 {
9083 // Register new weapon ID
9085 }
9086
9088 }
9089
9096 {
9097 return -1;
9098 }
9099
9100
9101
9102 // -------------------------------------------------------------------------
9103 void ~ItemBase()
9104 {
9105 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
9106 {
9107 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9108 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9109
9110 if (r_index >= 0)
9111 {
9112 InventoryLocation r_il = new InventoryLocation;
9113 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9114
9115 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9116 int r_type = r_il.GetType();
9117 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9118 {
9119 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9120 }
9121 else if (r_type == InventoryLocationType.ATTACHMENT)
9122 {
9123 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9124 }
9125
9126 }
9127
9128 player.GetHumanInventory().ClearUserReservedLocation(this);
9129 }
9130
9131 if (m_LockingSound)
9132 SEffectManager.DestroyEffect(m_LockingSound);
9133 }
9134
9135
9136
9137 // -------------------------------------------------------------------------
9138 static int GetDebugActionsMask()
9139 {
9140 return ItemBase.m_DebugActionsMask;
9141 }
9142
9143 static bool HasDebugActionsMask(int mask)
9144 {
9145 return ItemBase.m_DebugActionsMask & mask;
9146 }
9147
9148 static void SetDebugActionsMask(int mask)
9149 {
9150 ItemBase.m_DebugActionsMask = mask;
9151 }
9152
9153 static void AddDebugActionsMask(int mask)
9154 {
9155 ItemBase.m_DebugActionsMask |= mask;
9156 }
9157
9158 static void RemoveDebugActionsMask(int mask)
9159 {
9160 ItemBase.m_DebugActionsMask &= ~mask;
9161 }
9162
9163 static void ToggleDebugActionsMask(int mask)
9164 {
9165 if (HasDebugActionsMask(mask))
9166 {
9168 }
9169 else
9170 {
9171 AddDebugActionsMask(mask);
9172 }
9173 }
9174
9175 // -------------------------------------------------------------------------
9176 void SetCEBasedQuantity()
9177 {
9178 if (GetEconomyProfile())
9179 {
9180 float q_max = GetEconomyProfile().GetQuantityMax();
9181 if (q_max > 0)
9182 {
9183 float q_min = GetEconomyProfile().GetQuantityMin();
9184 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9185
9186 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9187 {
9188 ComponentEnergyManager comp = GetCompEM();
9189 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
9190 {
9191 comp.SetEnergy0To1(quantity_randomized);
9192 }
9193 }
9194 else if (HasQuantity())
9195 {
9196 SetQuantityNormalized(quantity_randomized, false);
9197 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9198 }
9199
9200 }
9201 }
9202 }
9203
9205 void LockToParent()
9206 {
9207 EntityAI parent = GetHierarchyParent();
9208
9209 if (parent)
9210 {
9211 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9212 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9213 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9214 }
9215 }
9216
9218 void UnlockFromParent()
9219 {
9220 EntityAI parent = GetHierarchyParent();
9221
9222 if (parent)
9223 {
9224 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9225 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9226 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9227 }
9228 }
9229
9230 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9231 {
9232 /*
9233 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9234 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9235 */
9236 ItemBase item2 = ItemBase.Cast(entity2);
9237
9238 if (GetGame().IsClient())
9239 {
9240 if (ScriptInputUserData.CanStoreInputUserData())
9241 {
9242 ScriptInputUserData ctx = new ScriptInputUserData;
9244 ctx.Write(-1);
9245 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9246 ctx.Write(i1);
9247 ctx.Write(item2);
9248 ctx.Write(use_stack_max);
9249 ctx.Write(-1);
9250 ctx.Send();
9251
9252 if (IsCombineAll(item2, use_stack_max))
9253 {
9254 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9255 }
9256 }
9257 }
9258 else if (!GetGame().IsMultiplayer())
9259 {
9260 CombineItems(item2, use_stack_max);
9261 }
9262 }
9263
9264 bool IsLiquidPresent()
9265 {
9266 return (GetLiquidType() != 0 && HasQuantity());
9267 }
9268
9269 bool IsLiquidContainer()
9270 {
9271 return m_LiquidContainerMask != 0;
9272 }
9273
9275 {
9276 return m_LiquidContainerMask;
9277 }
9278
9279 bool IsBloodContainer()
9280 {
9281 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9282 return false;
9283 }
9284
9285 bool IsNVG()
9286 {
9287 return false;
9288 }
9289
9292 bool IsExplosive()
9293 {
9294 return false;
9295 }
9296
9298 {
9299 return "";
9300 }
9301
9303
9304 bool IsLightSource()
9305 {
9306 return false;
9307 }
9308
9310 {
9311 return true;
9312 }
9313
9314 //--- ACTION CONDITIONS
9315 //direction
9316 bool IsFacingPlayer(PlayerBase player, string selection)
9317 {
9318 return true;
9319 }
9320
9321 bool IsPlayerInside(PlayerBase player, string selection)
9322 {
9323 return true;
9324 }
9325
9326 override bool CanObstruct()
9327 {
9328 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9329 return !player || !IsPlayerInside(player, "");
9330 }
9331
9332 override bool IsBeingPlaced()
9333 {
9334 return m_IsBeingPlaced;
9335 }
9336
9337 void SetIsBeingPlaced(bool is_being_placed)
9338 {
9339 m_IsBeingPlaced = is_being_placed;
9340 if (!is_being_placed)
9342 SetSynchDirty();
9343 }
9344
9345 //server-side
9346 void OnEndPlacement() {}
9347
9348 override bool IsHologram()
9349 {
9350 return m_IsHologram;
9351 }
9352
9353 bool CanBeDigged()
9354 {
9355 return m_CanBeDigged;
9356 }
9357
9359 {
9360 return 1;
9361 }
9362
9363 bool CanMakeGardenplot()
9364 {
9365 return false;
9366 }
9367
9368 void SetIsHologram(bool is_hologram)
9369 {
9370 m_IsHologram = is_hologram;
9371 SetSynchDirty();
9372 }
9373 /*
9374 protected float GetNutritionalEnergy()
9375 {
9376 Edible_Base edible = Edible_Base.Cast(this);
9377 return edible.GetFoodEnergy();
9378 }
9379
9380 protected float GetNutritionalWaterContent()
9381 {
9382 Edible_Base edible = Edible_Base.Cast(this);
9383 return edible.GetFoodWater();
9384 }
9385
9386 protected float GetNutritionalIndex()
9387 {
9388 Edible_Base edible = Edible_Base.Cast(this);
9389 return edible.GetFoodNutritionalIndex();
9390 }
9391
9392 protected float GetNutritionalFullnessIndex()
9393 {
9394 Edible_Base edible = Edible_Base.Cast(this);
9395 return edible.GetFoodTotalVolume();
9396 }
9397
9398 protected float GetNutritionalToxicity()
9399 {
9400 Edible_Base edible = Edible_Base.Cast(this);
9401 return edible.GetFoodToxicity();
9402
9403 }
9404 */
9405
9406
9407 // -------------------------------------------------------------------------
9408 override void OnMovedInsideCargo(EntityAI container)
9409 {
9410 super.OnMovedInsideCargo(container);
9411
9412 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9413 }
9414
9415 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9416 {
9417 super.EEItemLocationChanged(oldLoc,newLoc);
9418
9419 PlayerBase new_player = null;
9420 PlayerBase old_player = null;
9421
9422 if (newLoc.GetParent())
9423 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9424
9425 if (oldLoc.GetParent())
9426 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9427
9428 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9429 {
9430 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9431
9432 if (r_index >= 0)
9433 {
9434 InventoryLocation r_il = new InventoryLocation;
9435 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9436
9437 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9438 int r_type = r_il.GetType();
9439 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9440 {
9441 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9442 }
9443 else if (r_type == InventoryLocationType.ATTACHMENT)
9444 {
9445 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9446 }
9447
9448 }
9449 }
9450
9451 if (newLoc.GetType() == InventoryLocationType.HANDS)
9452 {
9453 if (new_player)
9454 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9455
9456 if (new_player == old_player)
9457 {
9458
9459 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9460 {
9461 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9462 {
9463 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9464 {
9465 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9466 }
9467 }
9468 else
9469 {
9470 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9471 }
9472 }
9473
9474 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9475 {
9476 int type = oldLoc.GetType();
9477 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9478 {
9479 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9480 }
9481 else if (type == InventoryLocationType.ATTACHMENT)
9482 {
9483 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9484 }
9485 }
9486 if (!m_OldLocation)
9487 {
9488 m_OldLocation = new InventoryLocation;
9489 }
9490 m_OldLocation.Copy(oldLoc);
9491 }
9492 else
9493 {
9494 if (m_OldLocation)
9495 {
9496 m_OldLocation.Reset();
9497 }
9498 }
9499
9501 }
9502 else
9503 {
9504 if (new_player)
9505 {
9506 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9507 if (res_index >= 0)
9508 {
9509 InventoryLocation il = new InventoryLocation;
9510 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9511 ItemBase it = ItemBase.Cast(il.GetItem());
9512 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9513 int rel_type = il.GetType();
9514 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9515 {
9516 il.GetParent().GetOnReleaseLock().Invoke(it);
9517 }
9518 else if (rel_type == InventoryLocationType.ATTACHMENT)
9519 {
9520 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9521 }
9522 //it.GetOnReleaseLock().Invoke(it);
9523 }
9524 }
9525 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9526 {
9527 //ThrowPhysically(old_player, vector.Zero);
9528 m_ThrowItemOnDrop = false;
9529 }
9530
9531 if (m_OldLocation)
9532 {
9533 m_OldLocation.Reset();
9534 }
9535 }
9536 }
9537
9538 override void EOnContact(IEntity other, Contact extra)
9539 {
9541 {
9542 int liquidType = -1;
9543 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9544 if (impactSpeed > 0.0)
9545 {
9546 m_ImpactSpeed = impactSpeed;
9547 #ifndef SERVER
9548 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9549 #else
9550 m_WantPlayImpactSound = true;
9551 SetSynchDirty();
9552 #endif
9553 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9554 }
9555 }
9556
9557 #ifdef SERVER
9558 if (GetCompEM() && GetCompEM().IsPlugged())
9559 {
9560 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9561 GetCompEM().UnplugThis();
9562 }
9563 #endif
9564 }
9565
9566 void RefreshPhysics();
9567
9568 override void OnCreatePhysics()
9569 {
9571 }
9572
9573 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9574 {
9575
9576 }
9577 // -------------------------------------------------------------------------
9578 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9579 {
9580 super.OnItemLocationChanged(old_owner, new_owner);
9581
9582 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9583 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9584
9585 if (!relatedPlayer && playerNew)
9586 relatedPlayer = playerNew;
9587
9588 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9589 {
9590 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9591 if (actionMgr)
9592 {
9593 ActionBase currentAction = actionMgr.GetRunningAction();
9594 if (currentAction)
9595 currentAction.OnItemLocationChanged(this);
9596 }
9597 }
9598
9599 Man ownerPlayerOld = null;
9600 Man ownerPlayerNew = null;
9601
9602 if (old_owner)
9603 {
9604 if (old_owner.IsMan())
9605 {
9606 ownerPlayerOld = Man.Cast(old_owner);
9607 }
9608 else
9609 {
9610 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9611 }
9612 }
9613 else
9614 {
9615 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9616 {
9617 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9618
9619 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9620 {
9621 GetCompEM().UnplugThis();
9622 }
9623 }
9624 }
9625
9626 if (new_owner)
9627 {
9628 if (new_owner.IsMan())
9629 {
9630 ownerPlayerNew = Man.Cast(new_owner);
9631 }
9632 else
9633 {
9634 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9635 }
9636 }
9637
9638 if (ownerPlayerOld != ownerPlayerNew)
9639 {
9640 if (ownerPlayerOld)
9641 {
9642 array<EntityAI> subItemsExit = new array<EntityAI>;
9643 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
9644 for (int i = 0; i < subItemsExit.Count(); i++)
9645 {
9646 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
9647 itemExit.OnInventoryExit(ownerPlayerOld);
9648 }
9649 }
9650
9651 if (ownerPlayerNew)
9652 {
9653 array<EntityAI> subItemsEnter = new array<EntityAI>;
9654 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
9655 for (int j = 0; j < subItemsEnter.Count(); j++)
9656 {
9657 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
9658 itemEnter.OnInventoryEnter(ownerPlayerNew);
9659 }
9660 }
9661 }
9662 else if (ownerPlayerNew != null)
9663 {
9664 PlayerBase nplayer;
9665 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9666 {
9667 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9668 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
9669 for (int k = 0; k < subItemsUpdate.Count(); k++)
9670 {
9671 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
9672 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9673 }
9674 }
9675 }
9676
9677 if (old_owner)
9678 old_owner.OnChildItemRemoved(this);
9679 if (new_owner)
9680 new_owner.OnChildItemReceived(this);
9681 }
9682
9683 // -------------------------------------------------------------------------------
9684 override void EEDelete(EntityAI parent)
9685 {
9686 super.EEDelete(parent);
9687 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9688 if (player)
9689 {
9690 OnInventoryExit(player);
9691
9692 if (player.IsAlive())
9693 {
9694 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9695 if (r_index >= 0)
9696 {
9697 InventoryLocation r_il = new InventoryLocation;
9698 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9699
9700 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9701 int r_type = r_il.GetType();
9702 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9703 {
9704 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9705 }
9706 else if (r_type == InventoryLocationType.ATTACHMENT)
9707 {
9708 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9709 }
9710
9711 }
9712
9713 player.RemoveQuickBarEntityShortcut(this);
9714 }
9715 }
9716 }
9717 // -------------------------------------------------------------------------------
9718 override void EEKilled(Object killer)
9719 {
9720 super.EEKilled(killer);
9721
9723 if (killer && killer.IsFireplace() && CanExplodeInFire())
9724 {
9725 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9726 {
9727 if (IsMagazine())
9728 {
9729 if (Magazine.Cast(this).GetAmmoCount() > 0)
9730 {
9731 ExplodeAmmo();
9732 }
9733 }
9734 else
9735 {
9736 Explode(DamageType.EXPLOSION);
9737 }
9738 }
9739 }
9740 }
9741
9742 override void OnWasAttached(EntityAI parent, int slot_id)
9743 {
9744 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9745
9746 super.OnWasAttached(parent, slot_id);
9747
9748 if (HasQuantity())
9749 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9750
9751 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
9752 }
9753
9754 override void OnWasDetached(EntityAI parent, int slot_id)
9755 {
9756 super.OnWasDetached(parent, slot_id);
9757
9758 if (HasQuantity())
9759 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9760 }
9761
9762 override string ChangeIntoOnAttach(string slot)
9763 {
9764 int idx;
9765 TStringArray inventory_slots = new TStringArray;
9766 TStringArray attach_types = new TStringArray;
9767
9768 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9769 if (inventory_slots.Count() < 1) //is string
9770 {
9771 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9772 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9773 }
9774 else //is array
9775 {
9776 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9777 }
9778
9779 idx = inventory_slots.Find(slot);
9780 if (idx < 0)
9781 return "";
9782
9783 return attach_types.Get(idx);
9784 }
9785
9786 override string ChangeIntoOnDetach()
9787 {
9788 int idx = -1;
9789 string slot;
9790
9791 TStringArray inventory_slots = new TStringArray;
9792 TStringArray detach_types = new TStringArray;
9793
9794 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9795 if (inventory_slots.Count() < 1) //is string
9796 {
9797 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9798 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9799 }
9800 else //is array
9801 {
9802 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9803 if (detach_types.Count() < 1)
9804 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9805 }
9806
9807 for (int i = 0; i < inventory_slots.Count(); i++)
9808 {
9809 slot = inventory_slots.Get(i);
9810 }
9811
9812 if (slot != "")
9813 {
9814 if (detach_types.Count() == 1)
9815 idx = 0;
9816 else
9817 idx = inventory_slots.Find(slot);
9818 }
9819 if (idx < 0)
9820 return "";
9821
9822 return detach_types.Get(idx);
9823 }
9824
9825 void ExplodeAmmo()
9826 {
9827 //timer
9828 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
9829
9830 //min/max time
9831 float min_time = 1;
9832 float max_time = 3;
9833 float delay = Math.RandomFloat(min_time, max_time);
9834
9835 explode_timer.Run(delay, this, "DoAmmoExplosion");
9836 }
9837
9838 void DoAmmoExplosion()
9839 {
9840 Magazine magazine = Magazine.Cast(this);
9841 int pop_sounds_count = 6;
9842 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9843
9844 //play sound
9845 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9846 string sound_name = pop_sounds[ sound_idx ];
9847 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
9848
9849 //remove ammo count
9850 magazine.ServerAddAmmoCount(-1);
9851
9852 //if condition then repeat -> ExplodeAmmo
9853 float min_temp_to_explode = 100; //min temperature for item to explode
9854
9855 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
9856 {
9857 ExplodeAmmo();
9858 }
9859 }
9860
9861 // -------------------------------------------------------------------------------
9862 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
9863 {
9864 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
9865
9866 const int CHANCE_DAMAGE_CARGO = 4;
9867 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9868 const int CHANCE_DAMAGE_NOTHING = 2;
9869
9870 if (IsClothing() || IsContainer() || IsItemTent())
9871 {
9872 float dmg = damageResult.GetDamage("","Health") * -0.5;
9873 int chances;
9874 int rnd;
9875
9876 if (GetInventory().GetCargo())
9877 {
9878 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9879 rnd = Math.RandomInt(0,chances);
9880
9881 if (rnd < CHANCE_DAMAGE_CARGO)
9882 {
9883 DamageItemInCargo(dmg);
9884 }
9885 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9886 {
9888 }
9889 }
9890 else
9891 {
9892 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9893 rnd = Math.RandomInt(0,chances);
9894
9895 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9896 {
9898 }
9899 }
9900 }
9901 }
9902
9903 bool DamageItemInCargo(float damage)
9904 {
9905 if (GetInventory().GetCargo())
9906 {
9907 int item_count = GetInventory().GetCargo().GetItemCount();
9908 if (item_count > 0)
9909 {
9910 int random_pick = Math.RandomInt(0, item_count);
9911 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9912 if (!item.IsExplosive())
9913 {
9914 item.AddHealth("","",damage);
9915 return true;
9916 }
9917 }
9918 }
9919 return false;
9920 }
9921
9922 bool DamageItemAttachments(float damage)
9923 {
9924 int attachment_count = GetInventory().AttachmentCount();
9925 if (attachment_count > 0)
9926 {
9927 int random_pick = Math.RandomInt(0, attachment_count);
9928 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9929 if (!attachment.IsExplosive())
9930 {
9931 attachment.AddHealth("","",damage);
9932 return true;
9933 }
9934 }
9935 return false;
9936 }
9937
9938 override bool IsSplitable()
9939 {
9940 return m_CanThisBeSplit;
9941 }
9942 //----------------
9943 override bool CanBeSplit()
9944 {
9945 if (IsSplitable() && (GetQuantity() > 1))
9946 return GetInventory().CanRemoveEntity();
9947
9948 return false;
9949 }
9950
9951 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9952 {
9953 if (!CanBeSplit())
9954 return;
9955
9956 if (GetGame().IsClient())
9957 {
9958 if (ScriptInputUserData.CanStoreInputUserData())
9959 {
9960 ScriptInputUserData ctx = new ScriptInputUserData;
9962 ctx.Write(1);
9963 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9964 ctx.Write(i1);
9965 ctx.Write(destination_entity);
9966 ctx.Write(true);
9967 ctx.Write(slot_id);
9968 ctx.Send();
9969 }
9970 }
9971 else if (!GetGame().IsMultiplayer())
9972 {
9973 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9974 }
9975 }
9976
9977 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9978 {
9979 if (!CanBeSplit())
9980 return;
9981
9982 float split_quantity_new;
9983 ref ItemBase new_item;
9984 float quantity = GetQuantity();
9985 float stack_max = GetTargetQuantityMax(slot_id);
9986 InventoryLocation loc = new InventoryLocation;
9987
9988 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9989 {
9990 if (stack_max <= GetQuantity())
9991 split_quantity_new = stack_max;
9992 else
9993 split_quantity_new = GetQuantity();
9994
9995 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9996 if (new_item)
9997 {
9998 new_item.SetResultOfSplit(true);
9999 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10000 AddQuantity(-split_quantity_new);
10001 new_item.SetQuantity(split_quantity_new);
10002 }
10003 }
10004 else if (destination_entity && slot_id == -1)
10005 {
10006 if (quantity > stack_max)
10007 split_quantity_new = stack_max;
10008 else
10009 split_quantity_new = quantity;
10010
10011 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10012 {
10013 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10014 new_item = ItemBase.Cast(o);
10015 }
10016
10017 if (new_item)
10018 {
10019 new_item.SetResultOfSplit(true);
10020 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10021 AddQuantity(-split_quantity_new);
10022 new_item.SetQuantity(split_quantity_new);
10023 }
10024 }
10025 else
10026 {
10027 if (stack_max != 0)
10028 {
10029 if (stack_max < GetQuantity())
10030 {
10031 split_quantity_new = GetQuantity() - stack_max;
10032 }
10033
10034 if (split_quantity_new == 0)
10035 {
10036 if (!GetGame().IsMultiplayer())
10037 player.PhysicalPredictiveDropItem(this);
10038 else
10039 player.ServerDropEntity(this);
10040 return;
10041 }
10042
10043 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10044
10045 if (new_item)
10046 {
10047 new_item.SetResultOfSplit(true);
10048 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10049 SetQuantity(split_quantity_new);
10050 new_item.SetQuantity(stack_max);
10051 new_item.PlaceOnSurface();
10052 }
10053 }
10054 }
10055 }
10056
10057 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
10058 {
10059 if (!CanBeSplit())
10060 return;
10061
10062 float split_quantity_new;
10063 ref ItemBase new_item;
10064 float quantity = GetQuantity();
10065 float stack_max = GetTargetQuantityMax(slot_id);
10066 InventoryLocation loc = new InventoryLocation;
10067
10068 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10069 {
10070 if (stack_max <= GetQuantity())
10071 split_quantity_new = stack_max;
10072 else
10073 split_quantity_new = GetQuantity();
10074
10075 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10076 if (new_item)
10077 {
10078 new_item.SetResultOfSplit(true);
10079 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10080 AddQuantity(-split_quantity_new);
10081 new_item.SetQuantity(split_quantity_new);
10082 }
10083 }
10084 else if (destination_entity && slot_id == -1)
10085 {
10086 if (quantity > stack_max)
10087 split_quantity_new = stack_max;
10088 else
10089 split_quantity_new = quantity;
10090
10091 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10092 {
10093 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10094 new_item = ItemBase.Cast(o);
10095 }
10096
10097 if (new_item)
10098 {
10099 new_item.SetResultOfSplit(true);
10100 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10101 AddQuantity(-split_quantity_new);
10102 new_item.SetQuantity(split_quantity_new);
10103 }
10104 }
10105 else
10106 {
10107 if (stack_max != 0)
10108 {
10109 if (stack_max < GetQuantity())
10110 {
10111 split_quantity_new = GetQuantity() - stack_max;
10112 }
10113
10114 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10115
10116 if (new_item)
10117 {
10118 new_item.SetResultOfSplit(true);
10119 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10120 SetQuantity(split_quantity_new);
10121 new_item.SetQuantity(stack_max);
10122 new_item.PlaceOnSurface();
10123 }
10124 }
10125 }
10126 }
10127
10128 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10129 {
10130 if (!CanBeSplit())
10131 return;
10132
10133 if (GetGame().IsClient())
10134 {
10135 if (ScriptInputUserData.CanStoreInputUserData())
10136 {
10137 ScriptInputUserData ctx = new ScriptInputUserData;
10139 ctx.Write(4);
10140 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10141 ctx.Write(thiz);
10142 dst.WriteToContext(ctx);
10143 ctx.Send();
10144 }
10145 }
10146 else if (!GetGame().IsMultiplayer())
10147 {
10149 }
10150 }
10151
10152 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10153 {
10154 if (!CanBeSplit())
10155 return;
10156
10157 if (GetGame().IsClient())
10158 {
10159 if (ScriptInputUserData.CanStoreInputUserData())
10160 {
10161 ScriptInputUserData ctx = new ScriptInputUserData;
10163 ctx.Write(2);
10164 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10165 ctx.Write(dummy);
10166 ctx.Write(destination_entity);
10167 ctx.Write(true);
10168 ctx.Write(idx);
10169 ctx.Write(row);
10170 ctx.Write(col);
10171 ctx.Send();
10172 }
10173 }
10174 else if (!GetGame().IsMultiplayer())
10175 {
10176 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10177 }
10178 }
10179
10180 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10181 {
10183 }
10184
10185 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10186 {
10187 if (!CanBeSplit())
10188 return this;
10189
10190 float quantity = GetQuantity();
10191 float split_quantity_new;
10192 ItemBase new_item;
10193 if (dst.IsValid())
10194 {
10195 int slot_id = dst.GetSlot();
10196 float stack_max = GetTargetQuantityMax(slot_id);
10197
10198 if (quantity > stack_max)
10199 split_quantity_new = stack_max;
10200 else
10201 split_quantity_new = quantity;
10202
10203 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10204
10205 if (new_item)
10206 {
10207 new_item.SetResultOfSplit(true);
10208 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10209 AddQuantity(-split_quantity_new);
10210 new_item.SetQuantity(split_quantity_new);
10211 }
10212
10213 return new_item;
10214 }
10215
10216 return null;
10217 }
10218
10219 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10220 {
10221 if (!CanBeSplit())
10222 return;
10223
10224 float quantity = GetQuantity();
10225 float split_quantity_new;
10226 ref ItemBase new_item;
10227 if (destination_entity)
10228 {
10229 float stackable = GetTargetQuantityMax();
10230 if (quantity > stackable)
10231 split_quantity_new = stackable;
10232 else
10233 split_quantity_new = quantity;
10234
10235 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10236 if (new_item)
10237 {
10238 new_item.SetResultOfSplit(true);
10239 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10240 AddQuantity(-split_quantity_new);
10241 new_item.SetQuantity(split_quantity_new);
10242 }
10243 }
10244 }
10245
10246 void SplitIntoStackMaxHandsClient(PlayerBase player)
10247 {
10248 if (!CanBeSplit())
10249 return;
10250
10251 if (GetGame().IsClient())
10252 {
10253 if (ScriptInputUserData.CanStoreInputUserData())
10254 {
10255 ScriptInputUserData ctx = new ScriptInputUserData;
10257 ctx.Write(3);
10258 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10259 ctx.Write(i1);
10260 ItemBase destination_entity = this;
10261 ctx.Write(destination_entity);
10262 ctx.Write(true);
10263 ctx.Write(0);
10264 ctx.Send();
10265 }
10266 }
10267 else if (!GetGame().IsMultiplayer())
10268 {
10269 SplitIntoStackMaxHands(player);
10270 }
10271 }
10272
10273 void SplitIntoStackMaxHands(PlayerBase player)
10274 {
10275 if (!CanBeSplit())
10276 return;
10277
10278 float quantity = GetQuantity();
10279 float split_quantity_new;
10280 ref ItemBase new_item;
10281 if (player)
10282 {
10283 float stackable = GetTargetQuantityMax();
10284 if (quantity > stackable)
10285 split_quantity_new = stackable;
10286 else
10287 split_quantity_new = quantity;
10288
10289 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10290 new_item = ItemBase.Cast(in_hands);
10291 if (new_item)
10292 {
10293 new_item.SetResultOfSplit(true);
10294 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10295 AddQuantity(-split_quantity_new);
10296 new_item.SetQuantity(split_quantity_new);
10297 }
10298 }
10299 }
10300
10301 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10302 {
10303 if (!CanBeSplit())
10304 return;
10305
10306 float quantity = GetQuantity();
10307 float split_quantity_new = Math.Floor(quantity * 0.5);
10308
10309 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10310
10311 if (new_item)
10312 {
10313 if (new_item.GetQuantityMax() < split_quantity_new)
10314 {
10315 split_quantity_new = new_item.GetQuantityMax();
10316 }
10317
10318 new_item.SetResultOfSplit(true);
10319 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10320
10321 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10322 {
10323 AddQuantity(-1);
10324 new_item.SetQuantity(1);
10325 }
10326 else
10327 {
10328 AddQuantity(-split_quantity_new);
10329 new_item.SetQuantity(split_quantity_new);
10330 }
10331 }
10332 }
10333
10334 void SplitItem(PlayerBase player)
10335 {
10336 if (!CanBeSplit())
10337 return;
10338
10339 float quantity = GetQuantity();
10340 float split_quantity_new = Math.Floor(quantity / 2);
10341
10342 InventoryLocation invloc = new InventoryLocation;
10343 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10344
10345 ItemBase new_item;
10346 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10347
10348 if (new_item)
10349 {
10350 if (new_item.GetQuantityMax() < split_quantity_new)
10351 {
10352 split_quantity_new = new_item.GetQuantityMax();
10353 }
10354 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10355 {
10356 AddQuantity(-1);
10357 new_item.SetQuantity(1);
10358 }
10359 else
10360 {
10361 AddQuantity(-split_quantity_new);
10362 new_item.SetQuantity(split_quantity_new);
10363 }
10364 }
10365 }
10366
10368 void OnQuantityChanged(float delta)
10369 {
10370 SetWeightDirty();
10371 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10372
10373 if (parent)
10374 parent.OnAttachmentQuantityChangedEx(this, delta);
10375
10376 if (IsLiquidContainer())
10377 {
10378 if (GetQuantityNormalized() <= 0.0)
10379 {
10381 }
10382 else if (GetLiquidType() == LIQUID_NONE)
10383 {
10384 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10386 }
10387 }
10388
10389 }
10390
10393 {
10394 // insert code here
10395 }
10396
10398 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10399 {
10401 }
10402
10403 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10404 {
10405 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10406
10407 if (GetGame().IsServer())
10408 {
10409 if (newLevel == GameConstants.STATE_RUINED)
10410 {
10412 EntityAI parent = GetHierarchyParent();
10413 if (parent && parent.IsFireplace())
10414 {
10415 CargoBase cargo = GetInventory().GetCargo();
10416 if (cargo)
10417 {
10418 for (int i = 0; i < cargo.GetItemCount(); ++i)
10419 {
10420 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10421 }
10422 }
10423 }
10424 }
10425
10426 if (IsResultOfSplit())
10427 {
10428 // reset the splitting result flag, return to normal item behavior
10429 SetResultOfSplit(false);
10430 return;
10431 }
10432
10433 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10434 {
10435 SetCleanness(0);//unclean the item upon damage dealt
10436 }
10437 }
10438 }
10439
10440 // just the split? TODO: verify
10441 override void OnRightClick()
10442 {
10443 super.OnRightClick();
10444
10445 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10446 {
10447 if (GetGame().IsClient())
10448 {
10449 if (ScriptInputUserData.CanStoreInputUserData())
10450 {
10451 vector m4[4];
10452 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10453
10454 EntityAI root = GetHierarchyRoot();
10455
10456 InventoryLocation dst = new InventoryLocation;
10457 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
10458 {
10459 if (root)
10460 {
10461 root.GetTransform(m4);
10462 dst.SetGround(this, m4);
10463 }
10464 else
10465 GetInventory().GetCurrentInventoryLocation(dst);
10466 }
10467 else
10468 {
10469 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10470 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10471 this shouldnt cause issues within this scope*/
10472 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10473 {
10474 if (root)
10475 {
10476 root.GetTransform(m4);
10477 dst.SetGround(this, m4);
10478 }
10479 else
10480 GetInventory().GetCurrentInventoryLocation(dst);
10481 }
10482 else
10483 {
10484 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10485 }
10486 }
10487
10488 ScriptInputUserData ctx = new ScriptInputUserData;
10490 ctx.Write(4);
10491 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10492 ctx.Write(thiz);
10493 dst.WriteToContext(ctx);
10494 ctx.Write(true); // dummy
10495 ctx.Send();
10496 }
10497 }
10498 else if (!GetGame().IsMultiplayer())
10499 {
10500 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10501 }
10502 }
10503 }
10504
10505 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10506 {
10507 //TODO: delete check zero quantity check after fix double posts hands fsm events
10508 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10509 return false;
10510
10511 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10512 return false;
10513
10514 //can_this_be_combined = ConfigGetBool("canBeSplit");
10516 return false;
10517
10518
10519 Magazine mag = Magazine.Cast(this);
10520 if (mag)
10521 {
10522 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10523 return false;
10524
10525 if (stack_max_limit)
10526 {
10527 Magazine other_mag = Magazine.Cast(other_item);
10528 if (other_item)
10529 {
10530 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10531 return false;
10532 }
10533
10534 }
10535 }
10536 else
10537 {
10538 //TODO: delete check zero quantity check after fix double posts hands fsm events
10539 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10540 return false;
10541
10542 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10543 return false;
10544 }
10545
10546 PlayerBase player = null;
10547 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10548 {
10549 if (player.GetInventory().HasAttachment(this))
10550 return false;
10551
10552 if (player.IsItemsToDelete())
10553 return false;
10554 }
10555
10556 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10557 return false;
10558
10559 int slotID;
10560 string slotName;
10561 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10562 return false;
10563
10564 return true;
10565 }
10566
10567 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
10568 {
10569 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
10570 }
10571
10572 bool IsResultOfSplit()
10573 {
10574 return m_IsResultOfSplit;
10575 }
10576
10577 void SetResultOfSplit(bool value)
10578 {
10579 m_IsResultOfSplit = value;
10580 }
10581
10582 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10583 {
10584 return ComputeQuantityUsedEx(other_item, use_stack_max);
10585 }
10586
10587 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10588 {
10589 float other_item_quantity = other_item.GetQuantity();
10590 float this_free_space;
10591
10592 float stack_max = GetQuantityMax();
10593
10594 this_free_space = stack_max - GetQuantity();
10595
10596 if (other_item_quantity > this_free_space)
10597 {
10598 return this_free_space;
10599 }
10600 else
10601 {
10602 return other_item_quantity;
10603 }
10604 }
10605
10606 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10607 {
10608 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10609 }
10610
10611 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10612 {
10613 if (!CanBeCombined(other_item, false))
10614 return;
10615
10616 if (!IsMagazine() && other_item)
10617 {
10618 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10619 if (quantity_used != 0)
10620 {
10621 float hp1 = GetHealth01("","");
10622 float hp2 = other_item.GetHealth01("","");
10623 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10624 hpResult = hpResult / (GetQuantity() + quantity_used);
10625
10626 hpResult *= GetMaxHealth();
10627 Math.Round(hpResult);
10628 SetHealth("", "Health", hpResult);
10629
10630 AddQuantity(quantity_used);
10631 other_item.AddQuantity(-quantity_used);
10632 }
10633 }
10634 OnCombine(other_item);
10635 }
10636
10637 void OnCombine(ItemBase other_item)
10638 {
10639 #ifdef SERVER
10640 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10641 GetHierarchyParent().IncreaseLifetimeUp();
10642 #endif
10643 };
10644
10645 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
10646 {
10647 PlayerBase p = PlayerBase.Cast(player);
10648
10649 array<int> recipesIds = p.m_Recipes;
10650 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10651 if (moduleRecipesManager)
10652 {
10653 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10654 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
10655 }
10656
10657 for (int i = 0;i < recipesIds.Count(); i++)
10658 {
10659 int key = recipesIds.Get(i);
10660 string recipeName = moduleRecipesManager.GetRecipeName(key);
10661 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
10662 }
10663 }
10664
10665 // -------------------------------------------------------------------------
10666 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10667 {
10668 super.GetDebugActions(outputList);
10669
10670 //quantity
10671 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
10672 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
10673 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
10674 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
10675
10676 //health
10677 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
10678 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
10679 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
10680 //temperature
10681 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
10682 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
10683 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
10684
10685 //wet
10686 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
10687 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
10688
10689 //liquidtype
10690 if (IsLiquidContainer())
10691 {
10692 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
10693 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
10694 }
10695
10696 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
10697 // watch
10698 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
10699 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
10700
10701 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10702 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
10703 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10704 }
10705
10706 // -------------------------------------------------------------------------
10707 // -------------------------------------------------------------------------
10708 // -------------------------------------------------------------------------
10709 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
10710 {
10711 super.OnAction(action_id, player, ctx);
10712 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
10713 {
10714 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10715 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
10716 PlayerBase p = PlayerBase.Cast(player);
10717 if (EActions.RECIPES_RANGE_START < 1000)
10718 {
10719 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10720 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10721 }
10722 }
10723 #ifndef SERVER
10724 else if (action_id == EActions.WATCH_PLAYER)
10725 {
10726 PluginDeveloper.SetDeveloperItemClientEx(player);
10727 }
10728 #endif
10729 if (GetGame().IsServer())
10730 {
10731 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10732 {
10733 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10734 OnDebugButtonPressServer(id + 1);
10735 }
10736
10737 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10738 {
10739 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10740 InsertAgent(agent_id,100);
10741 }
10742
10743 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10744 {
10745 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10746 RemoveAgent(agent_id2);
10747 }
10748
10749 else if (action_id == EActions.ADD_QUANTITY)
10750 {
10751 if (IsMagazine())
10752 {
10753 Magazine mag = Magazine.Cast(this);
10754 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10755 }
10756 else
10757 {
10758 AddQuantity(GetQuantityMax() * 0.2);
10759 }
10760
10761 if (m_EM)
10762 {
10763 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10764 }
10765 //PrintVariables();
10766 }
10767
10768 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
10769 {
10770 if (IsMagazine())
10771 {
10772 Magazine mag2 = Magazine.Cast(this);
10773 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10774 }
10775 else
10776 {
10777 AddQuantity(- GetQuantityMax() * 0.2);
10778 }
10779 if (m_EM)
10780 {
10781 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10782 }
10783 //PrintVariables();
10784 }
10785
10786 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
10787 {
10788 SetQuantity(0);
10789
10790 if (m_EM)
10791 {
10792 m_EM.SetEnergy(0);
10793 }
10794 }
10795
10796 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
10797 {
10799
10800 if (m_EM)
10801 {
10802 m_EM.SetEnergy(m_EM.GetEnergyMax());
10803 }
10804 }
10805
10806 else if (action_id == EActions.ADD_HEALTH)
10807 {
10808 AddHealth("","",GetMaxHealth("","Health")/5);
10809 }
10810 else if (action_id == EActions.REMOVE_HEALTH)
10811 {
10812 AddHealth("","",-GetMaxHealth("","Health")/5);
10813 }
10814 else if (action_id == EActions.DESTROY_HEALTH)
10815 {
10816 SetHealth01("","",0);
10817 }
10818 else if (action_id == EActions.WATCH_ITEM)
10819 {
10821 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
10822 #ifdef DEVELOPER
10823 SetDebugDeveloper_item(this);
10824 #endif
10825 }
10826
10827 else if (action_id == EActions.ADD_TEMPERATURE)
10828 {
10829 AddTemperature(20);
10830 //PrintVariables();
10831 }
10832
10833 else if (action_id == EActions.REMOVE_TEMPERATURE)
10834 {
10835 AddTemperature(-20);
10836 //PrintVariables();
10837 }
10838
10839 else if (action_id == EActions.FLIP_FROZEN)
10840 {
10841 SetFrozen(!GetIsFrozen());
10842 //PrintVariables();
10843 }
10844
10845 else if (action_id == EActions.ADD_WETNESS)
10846 {
10847 AddWet(GetWetMax()/5);
10848 //PrintVariables();
10849 }
10850
10851 else if (action_id == EActions.REMOVE_WETNESS)
10852 {
10853 AddWet(-GetWetMax()/5);
10854 //PrintVariables();
10855 }
10856
10857 else if (action_id == EActions.LIQUIDTYPE_UP)
10858 {
10859 int curr_type = GetLiquidType();
10860 SetLiquidType(curr_type * 2);
10861 //AddWet(1);
10862 //PrintVariables();
10863 }
10864
10865 else if (action_id == EActions.LIQUIDTYPE_DOWN)
10866 {
10867 int curr_type2 = GetLiquidType();
10868 SetLiquidType(curr_type2 / 2);
10869 }
10870
10871 else if (action_id == EActions.MAKE_SPECIAL)
10872 {
10873 auto debugParams = DebugSpawnParams.WithPlayer(player);
10874 OnDebugSpawnEx(debugParams);
10875 }
10876
10877 else if (action_id == EActions.DELETE)
10878 {
10879 Delete();
10880 }
10881
10882 }
10883
10884
10885 return false;
10886 }
10887
10888 // -------------------------------------------------------------------------
10889
10890
10893 void OnActivatedByTripWire();
10894
10896 void OnActivatedByItem(notnull ItemBase item);
10897
10898 //----------------------------------------------------------------
10899 //returns true if item is able to explode when put in fire
10900 bool CanExplodeInFire()
10901 {
10902 return false;
10903 }
10904
10905 //----------------------------------------------------------------
10906 bool CanEat()
10907 {
10908 return true;
10909 }
10910
10911 //----------------------------------------------------------------
10912 override bool IsIgnoredByConstruction()
10913 {
10914 return true;
10915 }
10916
10917 //----------------------------------------------------------------
10918 //has FoodStages in config?
10919 bool HasFoodStage()
10920 {
10921 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10922 return GetGame().ConfigIsExisting(config_path);
10923 }
10924
10926 FoodStage GetFoodStage()
10927 {
10928 return null;
10929 }
10930
10931 bool CanBeCooked()
10932 {
10933 return false;
10934 }
10935
10936 bool CanBeCookedOnStick()
10937 {
10938 return false;
10939 }
10940
10942 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10944
10945 //----------------------------------------------------------------
10946 bool CanRepair(ItemBase item_repair_kit)
10947 {
10948 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10949 return module_repairing.CanRepair(this, item_repair_kit);
10950 }
10951
10952 //----------------------------------------------------------------
10953 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10954 {
10955 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10956 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10957 }
10958
10959 //----------------------------------------------------------------
10960 int GetItemSize()
10961 {
10962 /*
10963 vector v_size = this.ConfigGetVector("itemSize");
10964 int v_size_x = v_size[0];
10965 int v_size_y = v_size[1];
10966 int size = v_size_x * v_size_y;
10967 return size;
10968 */
10969
10970 return 1;
10971 }
10972
10973 //----------------------------------------------------------------
10974 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10975 bool CanBeMovedOverride()
10976 {
10977 return m_CanBeMovedOverride;
10978 }
10979
10980 //----------------------------------------------------------------
10981 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10982 void SetCanBeMovedOverride(bool setting)
10983 {
10984 m_CanBeMovedOverride = setting;
10985 }
10986
10987 //----------------------------------------------------------------
10995 void MessageToOwnerStatus(string text)
10996 {
10997 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10998
10999 if (player)
11000 {
11001 player.MessageStatus(text);
11002 }
11003 }
11004
11005 //----------------------------------------------------------------
11013 void MessageToOwnerAction(string text)
11014 {
11015 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11016
11017 if (player)
11018 {
11019 player.MessageAction(text);
11020 }
11021 }
11022
11023 //----------------------------------------------------------------
11031 void MessageToOwnerFriendly(string text)
11032 {
11033 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11034
11035 if (player)
11036 {
11037 player.MessageFriendly(text);
11038 }
11039 }
11040
11041 //----------------------------------------------------------------
11049 void MessageToOwnerImportant(string text)
11050 {
11051 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11052
11053 if (player)
11054 {
11055 player.MessageImportant(text);
11056 }
11057 }
11058
11059 override bool IsItemBase()
11060 {
11061 return true;
11062 }
11063
11064 // Checks if item is of questioned kind
11065 override bool KindOf(string tag)
11066 {
11067 bool found = false;
11068 string item_name = this.GetType();
11069 ref TStringArray item_tag_array = new TStringArray;
11070 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11071
11072 int array_size = item_tag_array.Count();
11073 for (int i = 0; i < array_size; i++)
11074 {
11075 if (item_tag_array.Get(i) == tag)
11076 {
11077 found = true;
11078 break;
11079 }
11080 }
11081 return found;
11082 }
11083
11084
11085 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11086 {
11087 //Debug.Log("OnRPC called");
11088 super.OnRPC(sender, rpc_type,ctx);
11089
11090 //Play soundset for attachment locking (ActionLockAttachment.c)
11091 switch (rpc_type)
11092 {
11093 #ifndef SERVER
11094 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11095 Param2<bool, string> p = new Param2<bool, string>(false, "");
11096
11097 if (!ctx.Read(p))
11098 return;
11099
11100 bool play = p.param1;
11101 string soundSet = p.param2;
11102
11103 if (play)
11104 {
11105 if (m_LockingSound)
11106 {
11108 {
11109 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11110 }
11111 }
11112 else
11113 {
11114 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11115 }
11116 }
11117 else
11118 {
11119 SEffectManager.DestroyEffect(m_LockingSound);
11120 }
11121
11122 break;
11123 #endif
11124
11125 }
11126
11127 if (GetWrittenNoteData())
11128 {
11129 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11130 }
11131 }
11132
11133 //-----------------------------
11134 // VARIABLE MANIPULATION SYSTEM
11135 //-----------------------------
11136 int NameToID(string name)
11137 {
11138 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11139 return plugin.GetID(name);
11140 }
11141
11142 string IDToName(int id)
11143 {
11144 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11145 return plugin.GetName(id);
11146 }
11147
11149 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11150 {
11151 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11152 //read the flags
11153 int varFlags;
11154 if (!ctx.Read(varFlags))
11155 return;
11156
11157 if (varFlags & ItemVariableFlags.FLOAT)
11158 {
11159 ReadVarsFromCTX(ctx);
11160 }
11161 }
11162
11163 override void SerializeNumericalVars(array<float> floats_out)
11164 {
11165 //some variables handled on EntityAI level already!
11166 super.SerializeNumericalVars(floats_out);
11167
11168 // the order of serialization must be the same as the order of de-serialization
11169 //--------------------------------------------
11170 if (IsVariableSet(VARIABLE_QUANTITY))
11171 {
11172 floats_out.Insert(m_VarQuantity);
11173 }
11174 //--------------------------------------------
11175 if (IsVariableSet(VARIABLE_WET))
11176 {
11177 floats_out.Insert(m_VarWet);
11178 }
11179 //--------------------------------------------
11180 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11181 {
11182 floats_out.Insert(m_VarLiquidType);
11183 }
11184 //--------------------------------------------
11185 if (IsVariableSet(VARIABLE_COLOR))
11186 {
11187 floats_out.Insert(m_ColorComponentR);
11188 floats_out.Insert(m_ColorComponentG);
11189 floats_out.Insert(m_ColorComponentB);
11190 floats_out.Insert(m_ColorComponentA);
11191 }
11192 //--------------------------------------------
11193 if (IsVariableSet(VARIABLE_CLEANNESS))
11194 {
11195 floats_out.Insert(m_Cleanness);
11196 }
11197 }
11198
11199 override void DeSerializeNumericalVars(array<float> floats)
11200 {
11201 //some variables handled on EntityAI level already!
11202 super.DeSerializeNumericalVars(floats);
11203
11204 // the order of serialization must be the same as the order of de-serialization
11205 int index = 0;
11206 int mask = Math.Round(floats.Get(index));
11207
11208 index++;
11209 //--------------------------------------------
11210 if (mask & VARIABLE_QUANTITY)
11211 {
11212 if (m_IsStoreLoad)
11213 {
11214 SetStoreLoadedQuantity(floats.Get(index));
11215 }
11216 else
11217 {
11218 float quantity = floats.Get(index);
11219 SetQuantity(quantity, true, false, false, false);
11220 }
11221 index++;
11222 }
11223 //--------------------------------------------
11224 if (mask & VARIABLE_WET)
11225 {
11226 float wet = floats.Get(index);
11227 SetWet(wet);
11228 index++;
11229 }
11230 //--------------------------------------------
11231 if (mask & VARIABLE_LIQUIDTYPE)
11232 {
11233 int liquidtype = Math.Round(floats.Get(index));
11234 SetLiquidType(liquidtype);
11235 index++;
11236 }
11237 //--------------------------------------------
11238 if (mask & VARIABLE_COLOR)
11239 {
11240 m_ColorComponentR = Math.Round(floats.Get(index));
11241 index++;
11242 m_ColorComponentG = Math.Round(floats.Get(index));
11243 index++;
11244 m_ColorComponentB = Math.Round(floats.Get(index));
11245 index++;
11246 m_ColorComponentA = Math.Round(floats.Get(index));
11247 index++;
11248 }
11249 //--------------------------------------------
11250 if (mask & VARIABLE_CLEANNESS)
11251 {
11252 int cleanness = Math.Round(floats.Get(index));
11253 SetCleanness(cleanness);
11254 index++;
11255 }
11256 }
11257
11258 override void WriteVarsToCTX(ParamsWriteContext ctx)
11259 {
11260 super.WriteVarsToCTX(ctx);
11261
11262 //--------------------------------------------
11263 if (IsVariableSet(VARIABLE_QUANTITY))
11264 {
11265 ctx.Write(GetQuantity());
11266 }
11267 //--------------------------------------------
11268 if (IsVariableSet(VARIABLE_WET))
11269 {
11270 ctx.Write(GetWet());
11271 }
11272 //--------------------------------------------
11273 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11274 {
11275 ctx.Write(GetLiquidType());
11276 }
11277 //--------------------------------------------
11278 if (IsVariableSet(VARIABLE_COLOR))
11279 {
11280 int r,g,b,a;
11281 GetColor(r,g,b,a);
11282 ctx.Write(r);
11283 ctx.Write(g);
11284 ctx.Write(b);
11285 ctx.Write(a);
11286 }
11287 //--------------------------------------------
11288 if (IsVariableSet(VARIABLE_CLEANNESS))
11289 {
11290 ctx.Write(GetCleanness());
11291 }
11292 }
11293
11294 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11295 {
11296 if (!super.ReadVarsFromCTX(ctx,version))
11297 return false;
11298
11299 int intValue;
11300 float value;
11301
11302 if (version < 140)
11303 {
11304 if (!ctx.Read(intValue))
11305 return false;
11306
11307 m_VariablesMask = intValue;
11308 }
11309
11310 if (m_VariablesMask & VARIABLE_QUANTITY)
11311 {
11312 if (!ctx.Read(value))
11313 return false;
11314
11315 if (IsStoreLoad())
11316 {
11318 }
11319 else
11320 {
11321 SetQuantity(value, true, false, false, false);
11322 }
11323 }
11324 //--------------------------------------------
11325 if (version < 140)
11326 {
11327 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11328 {
11329 if (!ctx.Read(value))
11330 return false;
11331 SetTemperatureDirect(value);
11332 }
11333 }
11334 //--------------------------------------------
11335 if (m_VariablesMask & VARIABLE_WET)
11336 {
11337 if (!ctx.Read(value))
11338 return false;
11339 SetWet(value);
11340 }
11341 //--------------------------------------------
11342 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11343 {
11344 if (!ctx.Read(intValue))
11345 return false;
11346 SetLiquidType(intValue);
11347 }
11348 //--------------------------------------------
11349 if (m_VariablesMask & VARIABLE_COLOR)
11350 {
11351 int r,g,b,a;
11352 if (!ctx.Read(r))
11353 return false;
11354 if (!ctx.Read(g))
11355 return false;
11356 if (!ctx.Read(b))
11357 return false;
11358 if (!ctx.Read(a))
11359 return false;
11360
11361 SetColor(r,g,b,a);
11362 }
11363 //--------------------------------------------
11364 if (m_VariablesMask & VARIABLE_CLEANNESS)
11365 {
11366 if (!ctx.Read(intValue))
11367 return false;
11368 SetCleanness(intValue);
11369 }
11370 //--------------------------------------------
11371 if (version >= 138 && version < 140)
11372 {
11373 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11374 {
11375 if (!ctx.Read(intValue))
11376 return false;
11377 SetFrozen(intValue);
11378 }
11379 }
11380
11381 return true;
11382 }
11383
11384 //----------------------------------------------------------------
11385 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11386 {
11387 m_IsStoreLoad = true;
11389 {
11390 m_FixDamageSystemInit = true;
11391 }
11392
11393 if (!super.OnStoreLoad(ctx, version))
11394 {
11395 m_IsStoreLoad = false;
11396 return false;
11397 }
11398
11399 if (version >= 114)
11400 {
11401 bool hasQuickBarIndexSaved;
11402
11403 if (!ctx.Read(hasQuickBarIndexSaved))
11404 {
11405 m_IsStoreLoad = false;
11406 return false;
11407 }
11408
11409 if (hasQuickBarIndexSaved)
11410 {
11411 int itmQBIndex;
11412
11413 //Load quickbar item bind
11414 if (!ctx.Read(itmQBIndex))
11415 {
11416 m_IsStoreLoad = false;
11417 return false;
11418 }
11419
11420 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11421 if (itmQBIndex != -1 && parentPlayer)
11422 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11423 }
11424 }
11425 else
11426 {
11427 // Backup of how it used to be
11428 PlayerBase player;
11429 int itemQBIndex;
11430 if (version == int.MAX)
11431 {
11432 if (!ctx.Read(itemQBIndex))
11433 {
11434 m_IsStoreLoad = false;
11435 return false;
11436 }
11437 }
11438 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11439 {
11440 //Load quickbar item bind
11441 if (!ctx.Read(itemQBIndex))
11442 {
11443 m_IsStoreLoad = false;
11444 return false;
11445 }
11446 if (itemQBIndex != -1 && player)
11447 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11448 }
11449 }
11450
11451 if (version < 140)
11452 {
11453 // variable management system
11454 if (!LoadVariables(ctx, version))
11455 {
11456 m_IsStoreLoad = false;
11457 return false;
11458 }
11459 }
11460
11461 //agent trasmission system
11462 if (!LoadAgents(ctx, version))
11463 {
11464 m_IsStoreLoad = false;
11465 return false;
11466 }
11467 if (version >= 132)
11468 {
11469 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11470 if (raib)
11471 {
11472 if (!raib.OnStoreLoad(ctx,version))
11473 {
11474 m_IsStoreLoad = false;
11475 return false;
11476 }
11477 }
11478 }
11479
11480 m_IsStoreLoad = false;
11481 return true;
11482 }
11483
11484 //----------------------------------------------------------------
11485
11486 override void OnStoreSave(ParamsWriteContext ctx)
11487 {
11488 super.OnStoreSave(ctx);
11489
11490 PlayerBase player;
11491 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11492 {
11493 ctx.Write(true); // Keep track of if we should actually read this in or not
11494 //Save quickbar item bind
11495 int itemQBIndex = -1;
11496 itemQBIndex = player.FindQuickBarEntityIndex(this);
11497 ctx.Write(itemQBIndex);
11498 }
11499 else
11500 {
11501 ctx.Write(false); // Keep track of if we should actually read this in or not
11502 }
11503
11504 SaveAgents(ctx);//agent trasmission system
11505
11506 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11507 if (raib)
11508 {
11509 raib.OnStoreSave(ctx);
11510 }
11511 }
11512 //----------------------------------------------------------------
11513
11514 override void AfterStoreLoad()
11515 {
11516 super.AfterStoreLoad();
11517
11519 {
11521 }
11522
11523 if (GetStoreLoadedQuantity() != float.LOWEST)
11524 {
11526 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
11527 }
11528 }
11529
11530 override void EEOnAfterLoad()
11531 {
11532 super.EEOnAfterLoad();
11533
11535 {
11536 m_FixDamageSystemInit = false;
11537 }
11538
11541 }
11542
11543 bool CanBeDisinfected()
11544 {
11545 return false;
11546 }
11547
11548
11549 //----------------------------------------------------------------
11550 override void OnVariablesSynchronized()
11551 {
11552 if (m_Initialized)
11553 {
11554 #ifdef PLATFORM_CONSOLE
11555 //bruteforce it is
11556 if (IsSplitable())
11557 {
11558 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
11559 if (menu)
11560 {
11561 menu.Refresh();
11562 }
11563 }
11564 #endif
11565 }
11566
11568 {
11569 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
11570 m_WantPlayImpactSound = false;
11571 }
11572
11574 {
11575 SetWeightDirty();
11577 }
11578 if (m_VarWet != m_VarWetPrev)
11579 {
11582 }
11583
11584 if (m_SoundSyncPlay != 0)
11585 {
11586 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11587 m_SoundSyncPlay = 0;
11588 }
11589 if (m_SoundSyncStop != 0)
11590 {
11591 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11592 m_SoundSyncStop = 0;
11593 }
11594
11595 super.OnVariablesSynchronized();
11596 }
11597
11598 //------------------------- Quantity
11599 //----------------------------------------------------------------
11601 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11602 {
11603 if (!IsServerCheck(allow_client))
11604 return false;
11605
11606 if (!HasQuantity())
11607 return false;
11608
11609 float min = GetQuantityMin();
11610 float max = GetQuantityMax();
11611
11612 if (value <= (min + 0.001))
11613 value = min;
11614
11615 if (value == min)
11616 {
11617 if (destroy_config)
11618 {
11619 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11620 if (dstr)
11621 {
11622 m_VarQuantity = Math.Clamp(value, min, max);
11623 this.Delete();
11624 return true;
11625 }
11626 }
11627 else if (destroy_forced)
11628 {
11629 m_VarQuantity = Math.Clamp(value, min, max);
11630 this.Delete();
11631 return true;
11632 }
11633 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11634 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11635 }
11636
11637 float delta = m_VarQuantity;
11638 m_VarQuantity = Math.Clamp(value, min, max);
11639
11640 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11641 {
11642 delta = m_VarQuantity - delta;
11643
11644 if (delta)
11645 OnQuantityChanged(delta);
11646 }
11647
11648 SetVariableMask(VARIABLE_QUANTITY);
11649
11650 return false;
11651 }
11652
11653 //----------------------------------------------------------------
11655 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
11656 {
11657 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
11658 }
11659 //----------------------------------------------------------------
11660 void SetQuantityMax()
11661 {
11662 float max = GetQuantityMax();
11663 SetQuantity(max);
11664 }
11665
11666 override void SetQuantityToMinimum()
11667 {
11668 float min = GetQuantityMin();
11669 SetQuantity(min);
11670 }
11671 //----------------------------------------------------------------
11673 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
11674 {
11675 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
11676 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
11677 SetQuantity(result, destroy_config, destroy_forced);
11678 }
11679
11680 //----------------------------------------------------------------
11682 override float GetQuantityNormalized()
11683 {
11684 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
11685 }
11686
11688 {
11689 return GetQuantityNormalized();
11690 }
11691
11692 /*void SetAmmoNormalized(float value)
11693 {
11694 float value_clamped = Math.Clamp(value, 0, 1);
11695 Magazine this_mag = Magazine.Cast(this);
11696 int max_rounds = this_mag.GetAmmoMax();
11697 int result = value * max_rounds;//can the rounded if higher precision is required
11698 this_mag.SetAmmoCount(result);
11699 }*/
11700 //----------------------------------------------------------------
11701 override int GetQuantityMax()
11702 {
11703 int slot = -1;
11704 if (GetInventory())
11705 {
11706 InventoryLocation il = new InventoryLocation;
11707 GetInventory().GetCurrentInventoryLocation(il);
11708 slot = il.GetSlot();
11709 }
11710
11711 return GetTargetQuantityMax(slot);
11712 }
11713
11714 override int GetTargetQuantityMax(int attSlotID = -1)
11715 {
11716 float quantity_max = 0;
11717
11718 if (IsSplitable()) //only stackable/splitable items can check for stack size
11719 {
11720 if (attSlotID != -1)
11721 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11722
11723 if (quantity_max <= 0)
11724 quantity_max = m_VarStackMax;
11725 }
11726
11727 if (quantity_max <= 0)
11728 quantity_max = m_VarQuantityMax;
11729
11730 return quantity_max;
11731 }
11732 //----------------------------------------------------------------
11733 override int GetQuantityMin()
11734 {
11735 return m_VarQuantityMin;
11736 }
11737 //----------------------------------------------------------------
11738 int GetQuantityInit()
11739 {
11740 return m_VarQuantityInit;
11741 }
11742
11743 //----------------------------------------------------------------
11744 override bool HasQuantity()
11745 {
11746 return !(GetQuantityMax() - GetQuantityMin() == 0);
11747 }
11748
11749 override float GetQuantity()
11750 {
11751 return m_VarQuantity;
11752 }
11753
11754 bool IsFullQuantity()
11755 {
11756 return GetQuantity() >= GetQuantityMax();
11757 }
11758
11759 //Calculates weight of single item without attachments and cargo
11760 override float GetSingleInventoryItemWeightEx()
11761 {
11762 //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
11763 float weightEx = GetWeightEx();//overall weight of the item
11764 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
11765 return weightEx - special;
11766 }
11767
11768 // Obsolete, use GetSingleInventoryItemWeightEx() instead
11770 {
11772 }
11773
11774 override protected float GetWeightSpecialized(bool forceRecalc = false)
11775 {
11776 if (IsSplitable()) //quantity determines size of the stack
11777 {
11778 #ifdef DEVELOPER
11779 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11780 {
11781 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11782 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
11783 }
11784 #endif
11785
11786 return GetQuantity() * GetConfigWeightModified();
11787 }
11788 else if (HasEnergyManager())// items with energy manager
11789 {
11790 #ifdef DEVELOPER
11791 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11792 {
11793 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11794 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
11795 }
11796 #endif
11797 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11798 }
11799 else//everything else
11800 {
11801 #ifdef DEVELOPER
11802 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11803 {
11804 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11805 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
11806 }
11807 #endif
11808 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11809 }
11810 }
11811
11813 int GetNumberOfItems()
11814 {
11815 int item_count = 0;
11816 ItemBase item;
11817
11818 if (GetInventory().GetCargo() != NULL)
11819 {
11820 item_count = GetInventory().GetCargo().GetItemCount();
11821 }
11822
11823 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11824 {
11825 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11826 if (item)
11827 item_count += item.GetNumberOfItems();
11828 }
11829 return item_count;
11830 }
11831
11833 float GetUnitWeight(bool include_wetness = true)
11834 {
11835 float weight = 0;
11836 float wetness = 1;
11837 if (include_wetness)
11838 wetness += GetWet();
11839 if (IsSplitable()) //quantity determines size of the stack
11840 {
11841 weight = wetness * m_ConfigWeight;
11842 }
11843 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
11844 {
11845 weight = 1;
11846 }
11847 return weight;
11848 }
11849
11850 //-----------------------------------------------------------------
11851
11852 override void ClearInventory()
11853 {
11854 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
11855 {
11856 GameInventory inv = GetInventory();
11857 array<EntityAI> items = new array<EntityAI>;
11858 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
11859 for (int i = 0; i < items.Count(); i++)
11860 {
11861 ItemBase item = ItemBase.Cast(items.Get(i));
11862 if (item)
11863 {
11864 GetGame().ObjectDelete(item);
11865 }
11866 }
11867 }
11868 }
11869
11870 //------------------------- Energy
11871
11872 //----------------------------------------------------------------
11873 float GetEnergy()
11874 {
11875 float energy = 0;
11876 if (HasEnergyManager())
11877 {
11878 energy = GetCompEM().GetEnergy();
11879 }
11880 return energy;
11881 }
11882
11883
11884 override void OnEnergyConsumed()
11885 {
11886 super.OnEnergyConsumed();
11887
11889 }
11890
11891 override void OnEnergyAdded()
11892 {
11893 super.OnEnergyAdded();
11894
11896 }
11897
11898 // Converts energy (from Energy Manager) to quantity, if enabled.
11900 {
11901 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11902 {
11903 if (HasQuantity())
11904 {
11905 float energy_0to1 = GetCompEM().GetEnergy0To1();
11906 SetQuantityNormalized(energy_0to1);
11907 }
11908 }
11909 }
11910
11911 //----------------------------------------------------------------
11912 float GetHeatIsolationInit()
11913 {
11914 return ConfigGetFloat("heatIsolation");
11915 }
11916
11917 float GetHeatIsolation()
11918 {
11919 return m_HeatIsolation;
11920 }
11921
11922 float GetDryingIncrement(string pIncrementName)
11923 {
11924 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11925 if (GetGame().ConfigIsExisting(paramPath))
11926 return GetGame().ConfigGetFloat(paramPath);
11927
11928 return 0.0;
11929 }
11930
11931 float GetSoakingIncrement(string pIncrementName)
11932 {
11933 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11934 if (GetGame().ConfigIsExisting(paramPath))
11935 return GetGame().ConfigGetFloat(paramPath);
11936
11937 return 0.0;
11938 }
11939 //----------------------------------------------------------------
11940 override void SetWet(float value, bool allow_client = false)
11941 {
11942 if (!IsServerCheck(allow_client))
11943 return;
11944
11945 float min = GetWetMin();
11946 float max = GetWetMax();
11947
11948 float previousValue = m_VarWet;
11949
11950 m_VarWet = Math.Clamp(value, min, max);
11951
11952 if (previousValue != m_VarWet)
11953 {
11954 SetVariableMask(VARIABLE_WET);
11955 OnWetChanged(m_VarWet, previousValue);
11956 }
11957 }
11958 //----------------------------------------------------------------
11959 override void AddWet(float value)
11960 {
11961 SetWet(GetWet() + value);
11962 }
11963 //----------------------------------------------------------------
11964 override void SetWetMax()
11965 {
11967 }
11968 //----------------------------------------------------------------
11969 override float GetWet()
11970 {
11971 return m_VarWet;
11972 }
11973 //----------------------------------------------------------------
11974 override float GetWetMax()
11975 {
11976 return m_VarWetMax;
11977 }
11978 //----------------------------------------------------------------
11979 override float GetWetMin()
11980 {
11981 return m_VarWetMin;
11982 }
11983 //----------------------------------------------------------------
11984 override float GetWetInit()
11985 {
11986 return m_VarWetInit;
11987 }
11988 //----------------------------------------------------------------
11989 override void OnWetChanged(float newVal, float oldVal)
11990 {
11991 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11992 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11993 if (newLevel != oldLevel)
11994 {
11995 OnWetLevelChanged(newLevel,oldLevel);
11996 }
11997 }
11998
11999 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
12000 {
12001 SetWeightDirty();
12002 }
12003
12004 override EWetnessLevel GetWetLevel()
12005 {
12006 return GetWetLevelInternal(m_VarWet);
12007 }
12008
12009 //----------------------------------------------------------------
12010
12011 override void SetStoreLoad(bool value)
12012 {
12013 m_IsStoreLoad = value;
12014 }
12015
12016 override bool IsStoreLoad()
12017 {
12018 return m_IsStoreLoad;
12019 }
12020
12021 override void SetStoreLoadedQuantity(float value)
12022 {
12023 m_StoreLoadedQuantity = value;
12024 }
12025
12026 override float GetStoreLoadedQuantity()
12027 {
12028 return m_StoreLoadedQuantity;
12029 }
12030
12031 //----------------------------------------------------------------
12032
12033 float GetItemModelLength()
12034 {
12035 if (ConfigIsExisting("itemModelLength"))
12036 {
12037 return ConfigGetFloat("itemModelLength");
12038 }
12039 return 0;
12040 }
12041
12042 float GetItemAttachOffset()
12043 {
12044 if (ConfigIsExisting("itemAttachOffset"))
12045 {
12046 return ConfigGetFloat("itemAttachOffset");
12047 }
12048 return 0;
12049 }
12050
12051 override void SetCleanness(int value, bool allow_client = false)
12052 {
12053 if (!IsServerCheck(allow_client))
12054 return;
12055
12056 int previousValue = m_Cleanness;
12057
12058 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
12059
12060 if (previousValue != m_Cleanness)
12061 SetVariableMask(VARIABLE_CLEANNESS);
12062 }
12063
12064 override int GetCleanness()
12065 {
12066 return m_Cleanness;
12067 }
12068
12070 {
12071 return true;
12072 }
12073
12074 //----------------------------------------------------------------
12075 // ATTACHMENT LOCKING
12076 // Getters relevant to generic ActionLockAttachment
12077 int GetLockType()
12078 {
12079 return m_LockType;
12080 }
12081
12082 string GetLockSoundSet()
12083 {
12084 return m_LockSoundSet;
12085 }
12086
12087 //----------------------------------------------------------------
12088 //------------------------- Color
12089 // sets items color variable given color components
12090 override void SetColor(int r, int g, int b, int a)
12091 {
12096 SetVariableMask(VARIABLE_COLOR);
12097 }
12099 override void GetColor(out int r,out int g,out int b,out int a)
12100 {
12105 }
12106
12107 bool IsColorSet()
12108 {
12109 return IsVariableSet(VARIABLE_COLOR);
12110 }
12111
12113 string GetColorString()
12114 {
12115 int r,g,b,a;
12116 GetColor(r,g,b,a);
12117 r = r/255;
12118 g = g/255;
12119 b = b/255;
12120 a = a/255;
12121 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12122 }
12123 //----------------------------------------------------------------
12124 //------------------------- LiquidType
12125
12126 override void SetLiquidType(int value, bool allow_client = false)
12127 {
12128 if (!IsServerCheck(allow_client))
12129 return;
12130
12131 int old = m_VarLiquidType;
12132 m_VarLiquidType = value;
12133 OnLiquidTypeChanged(old,value);
12134 SetVariableMask(VARIABLE_LIQUIDTYPE);
12135 }
12136
12137 int GetLiquidTypeInit()
12138 {
12139 return ConfigGetInt("varLiquidTypeInit");
12140 }
12141
12142 override int GetLiquidType()
12143 {
12144 return m_VarLiquidType;
12145 }
12146
12147 protected void OnLiquidTypeChanged(int oldType, int newType)
12148 {
12149 if (newType == LIQUID_NONE && GetIsFrozen())
12150 SetFrozen(false);
12151 }
12152
12154 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12155 {
12156 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12157 }
12158
12159 // -------------------------------------------------------------------------
12161 void OnInventoryEnter(Man player)
12162 {
12163 PlayerBase nplayer;
12164 if (PlayerBase.CastTo(nplayer, player))
12165 {
12166 m_CanPlayImpactSound = true;
12167 //nplayer.OnItemInventoryEnter(this);
12168 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12169 }
12170 }
12171
12172 // -------------------------------------------------------------------------
12174 void OnInventoryExit(Man player)
12175 {
12176 PlayerBase nplayer;
12177 if (PlayerBase.CastTo(nplayer,player))
12178 {
12179 //nplayer.OnItemInventoryExit(this);
12180 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12181
12182 }
12183
12184 //if (!GetGame().IsDedicatedServer())
12185 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12186
12187
12188 if (HasEnergyManager())
12189 {
12190 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12191 }
12192 }
12193
12194 // ADVANCED PLACEMENT EVENTS
12195 override void OnPlacementStarted(Man player)
12196 {
12197 super.OnPlacementStarted(player);
12198
12199 SetTakeable(false);
12200 }
12201
12202 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12203 {
12204 if (m_AdminLog)
12205 {
12206 m_AdminLog.OnPlacementComplete(player, this);
12207 }
12208
12209 super.OnPlacementComplete(player, position, orientation);
12210 }
12211
12212 //-----------------------------
12213 // AGENT SYSTEM
12214 //-----------------------------
12215 //--------------------------------------------------------------------------
12216 bool ContainsAgent(int agent_id)
12217 {
12218 if (agent_id & m_AttachedAgents)
12219 {
12220 return true;
12221 }
12222 else
12223 {
12224 return false;
12225 }
12226 }
12227
12228 //--------------------------------------------------------------------------
12229 override void RemoveAgent(int agent_id)
12230 {
12231 if (ContainsAgent(agent_id))
12232 {
12233 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12234 }
12235 }
12236
12237 //--------------------------------------------------------------------------
12238 override void RemoveAllAgents()
12239 {
12240 m_AttachedAgents = 0;
12241 }
12242 //--------------------------------------------------------------------------
12243 override void RemoveAllAgentsExcept(int agent_to_keep)
12244 {
12245 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12246 }
12247 // -------------------------------------------------------------------------
12248 override void InsertAgent(int agent, float count = 1)
12249 {
12250 if (count < 1)
12251 return;
12252 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12254 }
12255
12257 void TransferAgents(int agents)
12258 {
12260 }
12261
12262 // -------------------------------------------------------------------------
12263 override int GetAgents()
12264 {
12265 return m_AttachedAgents;
12266 }
12267 //----------------------------------------------------------------------
12268
12269 /*int GetContaminationType()
12270 {
12271 int contamination_type;
12272
12273 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12274 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12275 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12276 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12277
12278 Edible_Base edible = Edible_Base.Cast(this);
12279 int agents = GetAgents();
12280 if (edible)
12281 {
12282 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12283 if (profile)
12284 {
12285 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12286 }
12287 }
12288 if (agents & CONTAMINATED_MASK)
12289 {
12290 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12291 }
12292 if (agents & POISONED_MASK)
12293 {
12294 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12295 }
12296 if (agents & NERVE_GAS_MASK)
12297 {
12298 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12299 }
12300 if (agents & DIRTY_MASK)
12301 {
12302 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12303 }
12304
12305 return agents;
12306 }*/
12307
12308 // -------------------------------------------------------------------------
12309 bool LoadAgents(ParamsReadContext ctx, int version)
12310 {
12311 if (!ctx.Read(m_AttachedAgents))
12312 return false;
12313 return true;
12314 }
12315 // -------------------------------------------------------------------------
12317 {
12318
12320 }
12321 // -------------------------------------------------------------------------
12322
12324 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12325 {
12326 super.CheckForRoofLimited(timeTresholdMS);
12327
12328 float time = GetGame().GetTime();
12329 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12330 {
12331 m_PreviousRoofTestTime = time;
12332 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12333 }
12334 }
12335
12336 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12337 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12338 {
12339 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12340 {
12341 return 0;
12342 }
12343
12344 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12345 {
12346 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12347 if (filter)
12348 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12349 else
12350 return 0;//otherwise return 0 when no filter attached
12351 }
12352
12353 string subclassPath, entryName;
12354
12355 switch (type)
12356 {
12357 case DEF_BIOLOGICAL:
12358 entryName = "biological";
12359 break;
12360 case DEF_CHEMICAL:
12361 entryName = "chemical";
12362 break;
12363 default:
12364 entryName = "biological";
12365 break;
12366 }
12367
12368 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12369
12370 return GetGame().ConfigGetFloat(subclassPath + entryName);
12371 }
12372
12373
12374
12376 override void EEOnCECreate()
12377 {
12378 if (!IsMagazine())
12380
12382 }
12383
12384
12385 //-------------------------
12386 // OPEN/CLOSE USER ACTIONS
12387 //-------------------------
12389 void Open();
12390 void Close();
12391 bool IsOpen()
12392 {
12393 return true;
12394 }
12395
12396 override bool CanDisplayCargo()
12397 {
12398 return IsOpen();
12399 }
12400
12401
12402 // ------------------------------------------------------------
12403 // CONDITIONS
12404 // ------------------------------------------------------------
12405 override bool CanPutInCargo(EntityAI parent)
12406 {
12407 if (parent)
12408 {
12409 if (parent.IsInherited(DayZInfected))
12410 return true;
12411
12412 if (!parent.IsRuined())
12413 return true;
12414 }
12415
12416 return true;
12417 }
12418
12419 override bool CanPutAsAttachment(EntityAI parent)
12420 {
12421 if (!super.CanPutAsAttachment(parent))
12422 {
12423 return false;
12424 }
12425
12426 if (!IsRuined() && !parent.IsRuined())
12427 {
12428 return true;
12429 }
12430
12431 return false;
12432 }
12433
12434 override bool CanReceiveItemIntoCargo(EntityAI item)
12435 {
12436 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12437 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12438 // return false;
12439
12440 return super.CanReceiveItemIntoCargo(item);
12441 }
12442
12443 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12444 {
12445 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12446 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12447 // return false;
12448
12449 GameInventory attachmentInv = attachment.GetInventory();
12450 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12451 {
12452 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12453 return false;
12454 }
12455
12456 InventoryLocation loc = new InventoryLocation();
12457 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12458 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12459 return false;
12460
12461 return super.CanReceiveAttachment(attachment, slotId);
12462 }
12463
12464 override bool CanReleaseAttachment(EntityAI attachment)
12465 {
12466 if (!super.CanReleaseAttachment(attachment))
12467 return false;
12468
12469 return GetInventory().AreChildrenAccessible();
12470 }
12471
12472 /*override bool CanLoadAttachment(EntityAI attachment)
12473 {
12474 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12475 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12476 // return false;
12477
12478 GameInventory attachmentInv = attachment.GetInventory();
12479 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12480 {
12481 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12482 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12483
12484 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12485 return false;
12486 }
12487
12488 return super.CanLoadAttachment(attachment);
12489 }*/
12490
12491 // Plays muzzle flash particle effects
12492 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12493 {
12494 int id = muzzle_owner.GetMuzzleID();
12495 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12496
12497 if (WPOF_array)
12498 {
12499 for (int i = 0; i < WPOF_array.Count(); i++)
12500 {
12501 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12502
12503 if (WPOF)
12504 {
12505 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12506 }
12507 }
12508 }
12509 }
12510
12511 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12512 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12513 {
12514 int id = muzzle_owner.GetMuzzleID();
12515 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12516
12517 if (WPOBE_array)
12518 {
12519 for (int i = 0; i < WPOBE_array.Count(); i++)
12520 {
12521 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12522
12523 if (WPOBE)
12524 {
12525 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12526 }
12527 }
12528 }
12529 }
12530
12531 // Plays all weapon overheating particles
12532 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12533 {
12534 int id = muzzle_owner.GetMuzzleID();
12535 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12536
12537 if (WPOOH_array)
12538 {
12539 for (int i = 0; i < WPOOH_array.Count(); i++)
12540 {
12541 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12542
12543 if (WPOOH)
12544 {
12545 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12546 }
12547 }
12548 }
12549 }
12550
12551 // Updates all weapon overheating particles
12552 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12553 {
12554 int id = muzzle_owner.GetMuzzleID();
12555 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12556
12557 if (WPOOH_array)
12558 {
12559 for (int i = 0; i < WPOOH_array.Count(); i++)
12560 {
12561 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12562
12563 if (WPOOH)
12564 {
12565 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12566 }
12567 }
12568 }
12569 }
12570
12571 // Stops overheating particles
12572 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12573 {
12574 int id = muzzle_owner.GetMuzzleID();
12575 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12576
12577 if (WPOOH_array)
12578 {
12579 for (int i = 0; i < WPOOH_array.Count(); i++)
12580 {
12581 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12582
12583 if (WPOOH)
12584 {
12585 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12586 }
12587 }
12588 }
12589 }
12590
12591 //----------------------------------------------------------------
12592 //Item Behaviour - unified approach
12593 override bool IsHeavyBehaviour()
12594 {
12595 if (m_ItemBehaviour == 0)
12596 {
12597 return true;
12598 }
12599
12600 return false;
12601 }
12602
12603 override bool IsOneHandedBehaviour()
12604 {
12605 if (m_ItemBehaviour == 1)
12606 {
12607 return true;
12608 }
12609
12610 return false;
12611 }
12612
12613 override bool IsTwoHandedBehaviour()
12614 {
12615 if (m_ItemBehaviour == 2)
12616 {
12617 return true;
12618 }
12619
12620 return false;
12621 }
12622
12623 bool IsDeployable()
12624 {
12625 return false;
12626 }
12627
12629 float GetDeployTime()
12630 {
12631 return UATimeSpent.DEFAULT_DEPLOY;
12632 }
12633
12634
12635 //----------------------------------------------------------------
12636 // Item Targeting (User Actions)
12637 override void SetTakeable(bool pState)
12638 {
12639 m_IsTakeable = pState;
12640 SetSynchDirty();
12641 }
12642
12643 override bool IsTakeable()
12644 {
12645 return m_IsTakeable;
12646 }
12647
12648 // For cases where we want to show object widget which cant be taken to hands
12650 {
12651 return false;
12652 }
12653
12655 protected void PreLoadSoundAttachmentType()
12656 {
12657 string att_type = "None";
12658
12659 if (ConfigIsExisting("soundAttType"))
12660 {
12661 att_type = ConfigGetString("soundAttType");
12662 }
12663
12664 m_SoundAttType = att_type;
12665 }
12666
12667 override string GetAttachmentSoundType()
12668 {
12669 return m_SoundAttType;
12670 }
12671
12672 //----------------------------------------------------------------
12673 //SOUNDS - ItemSoundHandler
12674 //----------------------------------------------------------------
12675
12676 string GetPlaceSoundset(); // played when deploy starts
12677 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
12678 string GetDeploySoundset(); // played when deploy sucessfully finishes
12679
12681 {
12682 if (!m_ItemSoundHandler)
12684
12685 return m_ItemSoundHandler;
12686 }
12687
12688 // override to initialize sounds
12689 protected void InitItemSounds()
12690 {
12691 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
12692 return;
12693
12695
12696 if (GetPlaceSoundset() != string.Empty)
12697 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
12698
12699 if (GetDeploySoundset() != string.Empty)
12700 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
12701
12702 SoundParameters params = new SoundParameters();
12703 params.m_Loop = true;
12704 if (GetLoopDeploySoundset() != string.Empty)
12705 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
12706 }
12707
12708 // Start sound using ItemSoundHandler
12709 void StartItemSoundServer(int id)
12710 {
12711 if (!GetGame().IsServer())
12712 return;
12713
12714 m_SoundSyncPlay = id;
12715 SetSynchDirty();
12716
12717 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
12719 }
12720
12721 // Stop sound using ItemSoundHandler
12722 void StopItemSoundServer(int id)
12723 {
12724 if (!GetGame().IsServer())
12725 return;
12726
12727 m_SoundSyncStop = id;
12728 SetSynchDirty();
12729
12730 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
12732 }
12733
12734 protected void ClearStartItemSoundServer()
12735 {
12736 m_SoundSyncPlay = 0;
12737 }
12738
12739 protected void ClearStopItemSoundServer()
12740 {
12741 m_SoundSyncStop = 0;
12742 }
12743
12745 void PlayAttachSound(string slot_type)
12746 {
12747 if (!GetGame().IsDedicatedServer())
12748 {
12749 if (ConfigIsExisting("attachSoundSet"))
12750 {
12751 string cfg_path = "";
12752 string soundset = "";
12753 string type_name = GetType();
12754
12755 TStringArray cfg_soundset_array = new TStringArray;
12756 TStringArray cfg_slot_array = new TStringArray;
12757 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12758 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12759
12760 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12761 {
12762 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12763 {
12764 if (cfg_slot_array[i] == slot_type)
12765 {
12766 soundset = cfg_soundset_array[i];
12767 break;
12768 }
12769 }
12770 }
12771
12772 if (soundset != "")
12773 {
12774 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
12775 sound.SetAutodestroy(true);
12776 }
12777 }
12778 }
12779 }
12780
12781 void PlayDetachSound(string slot_type)
12782 {
12783 //TODO - evaluate if needed and devise universal config structure if so
12784 }
12785
12786 void OnApply(PlayerBase player);
12787
12789 {
12790 return 1.0;
12791 };
12792 //returns applicable selection
12793 array<string> GetHeadHidingSelection()
12794 {
12796 }
12797
12799 {
12801 }
12802
12803 WrittenNoteData GetWrittenNoteData() {};
12804
12806 {
12807 SetDynamicPhysicsLifeTime(0.01);
12808 m_ItemBeingDroppedPhys = false;
12809 }
12810
12812 {
12813 array<string> zone_names = new array<string>;
12814 GetDamageZones(zone_names);
12815 for (int i = 0; i < zone_names.Count(); i++)
12816 {
12817 SetHealthMax(zone_names.Get(i),"Health");
12818 }
12819 SetHealthMax("","Health");
12820 }
12821
12823 void SetZoneDamageCEInit()
12824 {
12825 float global_health = GetHealth01("","Health");
12826 array<string> zones = new array<string>;
12827 GetDamageZones(zones);
12828 //set damage of all zones to match global health level
12829 for (int i = 0; i < zones.Count(); i++)
12830 {
12831 SetHealth01(zones.Get(i),"Health",global_health);
12832 }
12833 }
12834
12836 bool IsCoverFaceForShave(string slot_name)
12837 {
12838 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12839 }
12840
12841 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12842 {
12843 if (!hasRootAsPlayer)
12844 {
12845 if (refParentIB)
12846 {
12847 // parent is wet
12848 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
12849 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12850 // parent has liquid inside
12851 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
12852 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12853 // drying
12854 else if (m_VarWet > m_VarWetMin)
12855 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
12856 }
12857 else
12858 {
12859 // drying on ground or inside non-itembase (car, ...)
12860 if (m_VarWet > m_VarWetMin)
12861 AddWet(-1 * delta * GetDryingIncrement("ground"));
12862 }
12863 }
12864 }
12865
12866 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12867 {
12869 {
12870 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
12871 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12872 {
12873 float heatPermCoef = 1.0;
12874 EntityAI ent = this;
12875 while (ent)
12876 {
12877 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12878 ent = ent.GetHierarchyParent();
12879 }
12880
12881 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12882 }
12883 }
12884 }
12885
12886 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
12887 {
12888 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
12889 EntityAI parent = GetHierarchyParent();
12890 if (!parent)
12891 {
12892 hasParent = false;
12893 hasRootAsPlayer = false;
12894 }
12895 else
12896 {
12897 hasParent = true;
12898 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12899 refParentIB = ItemBase.Cast(parent);
12900 }
12901 }
12902
12903 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12904 {
12905 // this is stub, implemented on Edible_Base
12906 }
12907
12908 bool CanDecay()
12909 {
12910 // return true used on selected food clases so they can decay
12911 return false;
12912 }
12913
12914 protected bool CanProcessDecay()
12915 {
12916 // this is stub, implemented on Edible_Base class
12917 // used to determine whether it is still necessary for the food to decay
12918 return false;
12919 }
12920
12921 protected bool CanHaveWetness()
12922 {
12923 // return true used on selected items that have a wetness effect
12924 return false;
12925 }
12926
12928 bool CanBeConsumed(ConsumeConditionData data = null)
12929 {
12930 return !GetIsFrozen() && IsOpen();
12931 }
12932
12933 override void ProcessVariables()
12934 {
12935 bool hasParent = false, hasRootAsPlayer = false;
12936 ItemBase refParentIB;
12937
12938 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12939 bool foodDecay = g_Game.IsFoodDecayEnabled();
12940
12941 if (wwtu || foodDecay)
12942 {
12943 bool processWetness = wwtu && CanHaveWetness();
12944 bool processTemperature = wwtu && CanHaveTemperature();
12945 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12946
12947 if (processWetness || processTemperature || processDecay)
12948 {
12949 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12950
12951 if (processWetness)
12952 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12953
12954 if (processTemperature)
12955 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12956
12957 if (processDecay)
12958 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12959 }
12960 }
12961 }
12962
12965 {
12966 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12967 }
12968
12969 override float GetTemperatureFreezeThreshold()
12970 {
12972 return Liquid.GetFreezeThreshold(GetLiquidType());
12973
12974 return super.GetTemperatureFreezeThreshold();
12975 }
12976
12977 override float GetTemperatureThawThreshold()
12978 {
12980 return Liquid.GetThawThreshold(GetLiquidType());
12981
12982 return super.GetTemperatureThawThreshold();
12983 }
12984
12985 override float GetItemOverheatThreshold()
12986 {
12988 return Liquid.GetBoilThreshold(GetLiquidType());
12989
12990 return super.GetItemOverheatThreshold();
12991 }
12992
12993 override float GetTemperatureFreezeTime()
12994 {
12995 if (HasQuantity())
12996 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12997
12998 return super.GetTemperatureFreezeTime();
12999 }
13000
13001 override float GetTemperatureThawTime()
13002 {
13003 if (HasQuantity())
13004 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
13005
13006 return super.GetTemperatureThawTime();
13007 }
13008
13010 void AffectLiquidContainerOnFill(int liquid_type, float amount);
13012 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
13013
13014 bool IsCargoException4x3(EntityAI item)
13015 {
13016 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13017 }
13018
13020 {
13021 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13022 }
13023
13025 void AddLightSourceItem(ItemBase lightsource)
13026 {
13027 m_LightSourceItem = lightsource;
13028 }
13029
13031 {
13032 m_LightSourceItem = null;
13033 }
13034
13036 {
13037 return m_LightSourceItem;
13038 }
13039
13041 array<int> GetValidFinishers()
13042 {
13043 return null;
13044 }
13045
13047 bool GetActionWidgetOverride(out typename name)
13048 {
13049 return false;
13050 }
13051
13052 bool PairWithDevice(notnull ItemBase otherDevice)
13053 {
13054 if (GetGame().IsServer())
13055 {
13056 ItemBase explosive = otherDevice;
13058 if (!trg)
13059 {
13060 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13061 explosive = this;
13062 }
13063
13064 explosive.PairRemote(trg);
13065 trg.SetControlledDevice(explosive);
13066
13067 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13068 trg.SetPersistentPairID(persistentID);
13069 explosive.SetPersistentPairID(persistentID);
13070
13071 return true;
13072 }
13073 return false;
13074 }
13075
13077 float GetBaitEffectivity()
13078 {
13079 float ret = 1.0;
13080 if (HasQuantity())
13081 ret *= GetQuantityNormalized();
13082 ret *= GetHealth01();
13083
13084 return ret;
13085 }
13086
13087 #ifdef DEVELOPER
13088 override void SetDebugItem()
13089 {
13090 super.SetDebugItem();
13091 _itemBase = this;
13092 }
13093
13094 override string GetDebugText()
13095 {
13096 string text = super.GetDebugText();
13097
13098 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13099 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13100
13101 return text;
13102 }
13103 #endif
13104
13105 bool CanBeUsedForSuicide()
13106 {
13107 return true;
13108 }
13109
13111 //DEPRECATED BELOW
13113 // Backwards compatibility
13114 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13115 {
13116 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13117 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13118 }
13119
13120 // replaced by ItemSoundHandler
13121 protected EffectSound m_SoundDeployFinish;
13122 protected EffectSound m_SoundPlace;
13123 protected EffectSound m_DeployLoopSoundEx;
13124 protected EffectSound m_SoundDeploy;
13125 bool m_IsPlaceSound;
13126 bool m_IsDeploySound;
13128
13129 string GetDeployFinishSoundset();
13130 void PlayDeploySound();
13131 void PlayDeployFinishSound();
13132 void PlayPlaceSound();
13133 void PlayDeployLoopSoundEx();
13134 void StopDeployLoopSoundEx();
13135 void SoundSynchRemoteReset();
13136 void SoundSynchRemote();
13137 bool UsesGlobalDeploy(){return false;}
13138 bool CanPlayDeployLoopSound(){return false;}
13140 bool IsPlaceSound(){return m_IsPlaceSound;}
13141 bool IsDeploySound(){return m_IsDeploySound;}
13142 void SetIsPlaceSound(bool is_place_sound);
13143 void SetIsDeploySound(bool is_deploy_sound);
13144}
13145
13146EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13147{
13148 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13149 if (entity)
13150 {
13151 bool is_item = entity.IsInherited(ItemBase);
13152 if (is_item && full_quantity)
13153 {
13154 ItemBase item = ItemBase.Cast(entity);
13155 item.SetQuantity(item.GetQuantityInit());
13156 }
13157 }
13158 else
13159 {
13160 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13161 return NULL;
13162 }
13163 return entity;
13164}
13165
13166void SetupSpawnedItem(ItemBase item, float health, float quantity)
13167{
13168 if (item)
13169 {
13170 if (health > 0)
13171 item.SetHealth("", "", health);
13172
13173 if (item.CanHaveTemperature())
13174 {
13175 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13176 if (item.CanFreeze())
13177 item.SetFrozen(false);
13178 }
13179
13180 if (item.HasEnergyManager())
13181 {
13182 if (quantity >= 0)
13183 {
13184 item.GetCompEM().SetEnergy0To1(quantity);
13185 }
13186 else
13187 {
13188 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13189 }
13190 }
13191 else if (item.IsMagazine())
13192 {
13193 Magazine mag = Magazine.Cast(item);
13194 if (quantity >= 0)
13195 {
13196 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13197 }
13198 else
13199 {
13200 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13201 }
13202
13203 }
13204 else
13205 {
13206 if (quantity >= 0)
13207 {
13208 item.SetQuantityNormalized(quantity, false);
13209 }
13210 else
13211 {
13212 item.SetQuantity(Math.AbsFloat(quantity));
13213 }
13214
13215 }
13216 }
13217}
13218
13219#ifdef DEVELOPER
13220ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13221#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::OnAction(), FlammableBase::OnWork() и InventoryItem::ProcessItemWetness().