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

◆ SetLiquidType()

override void SpawnItemOnLocation::SetLiquidType ( int value,
bool allow_client = false )
protected

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

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

Используется в InventoryItem::DeSerializeNumericalVars(), InventoryItem::OnAction(), InventoryItem::OnQuantityChanged() и InventoryItem::ReadVarsFromCTX().