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

◆ SetStoreLoad()

override void SpawnItemOnLocation::SetStoreLoad ( bool value)
protected

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

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