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

◆ GetHeatIsolation()

float SpawnItemOnLocation::GetHeatIsolation ( )
protected

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

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