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

◆ AllowFoodConsumption()

bool SpawnItemOnLocation::AllowFoodConsumption ( )
protected

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

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