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

◆ GetColorString()

string SpawnItemOnLocation::GetColorString ( )
protected

Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,0.15,0.15,1.0,CO)".

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

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