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

◆ AddDebugActionsMask()

static void SpawnItemOnLocation::AddDebugActionsMask ( int mask)
staticprivate

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

5562{
5563 override bool CanPutAsAttachment(EntityAI parent)
5564 {
5565 return true;
5566 }
5567};
5568
5569//const bool QUANTITY_DEBUG_REMOVE_ME = false;
5570
5571class ItemBase extends InventoryItem
5572{
5576
5578
5579 static int m_DebugActionsMask;
5581 // ============================================
5582 // Variable Manipulation System
5583 // ============================================
5584 // Quantity
5585
5586 float m_VarQuantity;
5587 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
5589 int m_VarQuantityMin;
5590 int m_VarQuantityMax;
5591 int m_Count;
5592 float m_VarStackMax;
5593 float m_StoreLoadedQuantity = float.LOWEST;
5594 // Wet
5595 float m_VarWet;
5596 float m_VarWetPrev;//for client to know wetness changed during synchronization
5597 float m_VarWetInit;
5598 float m_VarWetMin;
5599 float m_VarWetMax;
5600 // Cleanness
5601 int m_Cleanness;
5602 int m_CleannessInit;
5603 int m_CleannessMin;
5604 int m_CleannessMax;
5605 // impact sounds
5607 bool m_CanPlayImpactSound = true;
5608 float m_ImpactSpeed;
5610 //
5611 float m_HeatIsolation;
5612 float m_ItemModelLength;
5613 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
5615 int m_VarLiquidType;
5616 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
5617 int m_QuickBarBonus;
5618 bool m_IsBeingPlaced;
5619 bool m_IsHologram;
5620 bool m_IsTakeable;
5621 bool m_ThrowItemOnDrop;
5624 bool m_FixDamageSystemInit = false; //can be changed on storage version check
5625 bool can_this_be_combined; //Check if item can be combined
5626 bool m_CanThisBeSplit; //Check if item can be split
5627 bool m_IsStoreLoad = false;
5628 bool m_CanShowQuantity;
5629 bool m_HasQuantityBar;
5630 protected bool m_CanBeDigged;
5631 protected bool m_IsResultOfSplit
5632
5633 string m_SoundAttType;
5634 // items color variables
5639 //-------------------------------------------------------
5640
5641 // light source managing
5643
5647
5648 //==============================================
5649 // agent system
5650 private int m_AttachedAgents;
5651
5653 void TransferModifiers(PlayerBase reciever);
5654
5655
5656 // Weapons & suppressors particle effects
5661 static int m_LastRegisteredWeaponID = 0;
5662
5663 // Overheating effects
5665 float m_OverheatingShots;
5666 ref Timer m_CheckOverheating;
5667 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
5668 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
5669 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
5670 ref array <ref OverheatingParticle> m_OverheatingParticles;
5671
5673 protected bool m_HideSelectionsBySlot;
5674
5675 // Admin Log
5676 PluginAdminLog m_AdminLog;
5677
5678 // misc
5679 ref Timer m_PhysDropTimer;
5680
5681 // Attachment Locking variables
5682 ref array<int> m_CompatibleLocks;
5683 protected int m_LockType;
5684 protected ref EffectSound m_LockingSound;
5685 protected string m_LockSoundSet;
5686
5687 // ItemSoundHandler
5688 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
5689 protected int m_SoundSyncPlay; // id for sound to play
5690 protected int m_SoundSyncStop; // id for sound to stop
5692
5693 //temperature
5694 private float m_TemperaturePerQuantityWeight;
5695
5696 // -------------------------------------------------------------------------
5697 void ItemBase()
5698 {
5699 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
5703
5704 if (!GetGame().IsDedicatedServer())
5705 {
5706 if (HasMuzzle())
5707 {
5709
5711 {
5713 }
5714 }
5715
5717 m_ActionsInitialize = false;
5718 }
5719
5720 m_OldLocation = null;
5721
5722 if (GetGame().IsServer())
5723 {
5724 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
5725 }
5726
5727 if (ConfigIsExisting("headSelectionsToHide"))
5728 {
5730 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
5731 }
5732
5733 m_HideSelectionsBySlot = false;
5734 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5735 {
5736 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
5737 }
5738
5739 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
5740
5741 m_IsResultOfSplit = false;
5742
5744 }
5745
5746 override void InitItemVariables()
5747 {
5748 super.InitItemVariables();
5749
5750 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
5751 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
5752 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
5753 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
5754 m_VarStackMax = ConfigGetFloat("varStackMax");
5755 m_Count = ConfigGetInt("count");
5756
5757 m_CanShowQuantity = ConfigGetBool("quantityShow");
5758 m_HasQuantityBar = ConfigGetBool("quantityBar");
5759
5760 m_CleannessInit = ConfigGetInt("varCleannessInit");
5762 m_CleannessMin = ConfigGetInt("varCleannessMin");
5763 m_CleannessMax = ConfigGetInt("varCleannessMax");
5764
5765 m_WantPlayImpactSound = false;
5766 m_ImpactSpeed = 0.0;
5767
5768 m_VarWetInit = ConfigGetFloat("varWetInit");
5770 m_VarWetMin = ConfigGetFloat("varWetMin");
5771 m_VarWetMax = ConfigGetFloat("varWetMax");
5772
5773 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
5774 if (IsLiquidContainer() && GetQuantity() != 0)
5776 m_IsBeingPlaced = false;
5777 m_IsHologram = false;
5778 m_IsTakeable = true;
5779 m_CanBeMovedOverride = false;
5783 m_CanBeDigged = ConfigGetBool("canBeDigged");
5784
5785 m_CompatibleLocks = new array<int>();
5786 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
5787 m_LockType = ConfigGetInt("lockType");
5788
5789 //Define if item can be split and set ability to be combined accordingly
5790 m_CanThisBeSplit = false;
5791 can_this_be_combined = false;
5792 if (ConfigIsExisting("canBeSplit"))
5793 {
5794 can_this_be_combined = ConfigGetBool("canBeSplit");
5796 }
5797
5798 m_ItemBehaviour = -1;
5799 if (ConfigIsExisting("itemBehaviour"))
5800 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
5801
5802 //RegisterNetSyncVariableInt("m_VariablesMask");
5803 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
5804 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
5805 RegisterNetSyncVariableInt("m_VarLiquidType");
5806 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5807
5808 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5809 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5810 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5811
5812 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5813 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5814 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5815 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5816
5817 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5818 RegisterNetSyncVariableBool("m_IsTakeable");
5819 RegisterNetSyncVariableBool("m_IsHologram");
5820
5821 InitItemSounds();
5823 {
5824 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
5825 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
5826 }
5827
5828 m_LockSoundSet = ConfigGetString("lockSoundSet");
5829
5831 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5832 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
5833
5834 }
5835
5836 override int GetQuickBarBonus()
5837 {
5838 return m_QuickBarBonus;
5839 }
5840
5841 void InitializeActions()
5842 {
5844 if (!m_InputActionMap)
5845 {
5847 m_InputActionMap = iam;
5848 SetActions();
5850 }
5851 }
5852
5853 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
5854 {
5856 {
5857 m_ActionsInitialize = true;
5859 }
5860
5861 actions = m_InputActionMap.Get(action_input_type);
5862 }
5863
5864 void SetActions()
5865 {
5866 AddAction(ActionTakeItem);
5867 AddAction(ActionTakeItemToHands);
5868 AddAction(ActionWorldCraft);
5870 AddAction(ActionAttachWithSwitch);
5871 }
5872
5873 void SetActionAnimOverrides(); // Override action animation for specific item
5874
5875 void AddAction(typename actionName)
5876 {
5877 ActionBase action = ActionManagerBase.GetAction(actionName);
5878
5879 if (!action)
5880 {
5881 Debug.LogError("Action " + actionName + " dosn't exist!");
5882 return;
5883 }
5884
5885 typename ai = action.GetInputType();
5886 if (!ai)
5887 {
5888 m_ActionsInitialize = false;
5889 return;
5890 }
5891
5892 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5893 if (!action_array)
5894 {
5895 action_array = new array<ActionBase_Basic>;
5896 m_InputActionMap.Insert(ai, action_array);
5897 }
5898 if (LogManager.IsActionLogEnable())
5899 {
5900 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
5901 }
5902
5903 if (action_array.Find(action) != -1)
5904 {
5905 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
5906 }
5907 else
5908 {
5909 action_array.Insert(action);
5910 }
5911 }
5912
5913 void RemoveAction(typename actionName)
5914 {
5915 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
5916 ActionBase action = player.GetActionManager().GetAction(actionName);
5917 typename ai = action.GetInputType();
5918 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5919
5920 if (action_array)
5921 {
5922 action_array.RemoveItem(action);
5923 }
5924 }
5925
5926 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
5927 // Set -1 for params which should stay in default state
5928 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
5929 {
5930 ActionOverrideData overrideData = new ActionOverrideData();
5931 overrideData.m_CommandUID = commandUID;
5932 overrideData.m_CommandUIDProne = commandUIDProne;
5933 overrideData.m_StanceMask = stanceMask;
5934
5935 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
5936 if (!actionMap) // create new map of action > overidables map
5937 {
5938 actionMap = new TActionAnimOverrideMap();
5939 m_ItemActionOverrides.Insert(action, actionMap);
5940 }
5941
5942 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
5943
5944 }
5945
5946 void OnItemInHandsPlayerSwimStart(PlayerBase player);
5947
5948 ScriptedLightBase GetLight();
5949
5950 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
5951 void LoadParticleConfigOnFire(int id)
5952 {
5953 if (!m_OnFireEffect)
5955
5958
5959 string config_to_search = "CfgVehicles";
5960 string muzzle_owner_config;
5961
5962 if (!m_OnFireEffect.Contains(id))
5963 {
5964 if (IsInherited(Weapon))
5965 config_to_search = "CfgWeapons";
5966
5967 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5968
5969 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5970
5971 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
5972
5973 if (config_OnFire_subclass_count > 0)
5974 {
5975 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5976
5977 for (int i = 0; i < config_OnFire_subclass_count; i++)
5978 {
5979 string particle_class = "";
5980 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
5981 string config_OnFire_entry = config_OnFire_class + particle_class;
5982 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5983 WPOF_array.Insert(WPOF);
5984 }
5985
5986
5987 m_OnFireEffect.Insert(id, WPOF_array);
5988 }
5989 }
5990
5991 if (!m_OnBulletCasingEjectEffect.Contains(id))
5992 {
5993 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
5994 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5995
5996 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5997
5998 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5999
6000 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6001 {
6002 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6003
6004 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6005 {
6006 string particle_class2 = "";
6007 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6008 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6009 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6010 WPOBE_array.Insert(WPOBE);
6011 }
6012
6013
6014 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
6015 }
6016 }
6017 }
6018
6019 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6021 {
6024
6025 if (!m_OnOverheatingEffect.Contains(id))
6026 {
6027 string config_to_search = "CfgVehicles";
6028
6029 if (IsInherited(Weapon))
6030 config_to_search = "CfgWeapons";
6031
6032 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
6033 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6034
6035 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
6036 {
6037
6038 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
6039
6041 {
6042 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
6043 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6044 Error(error);
6045 return;
6046 }
6047
6048 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
6049 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
6050
6051
6052
6053 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
6054 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6055
6056 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6057 {
6058 string particle_class = "";
6059 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6060 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6061 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
6062
6063 if (entry_type == CT_CLASS)
6064 {
6065 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6066 WPOOH_array.Insert(WPOF);
6067 }
6068 }
6069
6070
6071 m_OnOverheatingEffect.Insert(id, WPOOH_array);
6072 }
6073 }
6074 }
6075
6076 float GetOverheatingValue()
6077 {
6078 return m_OverheatingShots;
6079 }
6080
6081 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
6082 {
6083 if (m_MaxOverheatingValue > 0)
6084 {
6086
6087 if (!m_CheckOverheating)
6089
6091 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6092
6093 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6094 }
6095 }
6096
6097 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6098 {
6100 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6101
6103 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6104
6106 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6107
6109 {
6111 }
6112 }
6113
6115 {
6117 }
6118
6119 void OnOverheatingDecay()
6120 {
6121 if (m_MaxOverheatingValue > 0)
6122 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
6123 else
6125
6126 if (m_OverheatingShots <= 0)
6127 {
6130 }
6131 else
6132 {
6133 if (!m_CheckOverheating)
6135
6137 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6138 }
6139
6140 CheckOverheating(this, "", this);
6141 }
6142
6143 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6144 {
6146 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6147 }
6148
6149 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6150 {
6152 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6154 }
6155
6156 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6157 {
6159 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6160 }
6161
6162 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
6163 {
6165 m_OverheatingParticles = new array<ref OverheatingParticle>;
6166
6167 OverheatingParticle OP = new OverheatingParticle();
6168 OP.RegisterParticle(p);
6169 OP.SetOverheatingLimitMin(min_heat_coef);
6170 OP.SetOverheatingLimitMax(max_heat_coef);
6171 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
6172
6173 m_OverheatingParticles.Insert(OP);
6174 }
6175
6176 float GetOverheatingCoef()
6177 {
6178 if (m_MaxOverheatingValue > 0)
6180
6181 return -1;
6182 }
6183
6185 {
6187 {
6188 float overheat_coef = GetOverheatingCoef();
6189 int count = m_OverheatingParticles.Count();
6190
6191 for (int i = count; i > 0; --i)
6192 {
6193 int id = i - 1;
6194 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6195 Particle p = OP.GetParticle();
6196
6197 float overheat_min = OP.GetOverheatingLimitMin();
6198 float overheat_max = OP.GetOverheatingLimitMax();
6199
6200 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6201 {
6202 if (p)
6203 {
6204 p.Stop();
6205 OP.RegisterParticle(null);
6206 }
6207 }
6208 }
6209 }
6210 }
6211
6213 {
6215 {
6216 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
6217 {
6218 int id = i - 1;
6219 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6220
6221 if (OP)
6222 {
6223 Particle p = OP.GetParticle();
6224
6225 if (p)
6226 {
6227 p.Stop();
6228 }
6229
6230 delete OP;
6231 }
6232 }
6233
6234 m_OverheatingParticles.Clear();
6236 }
6237 }
6238
6240 float GetInfectionChance(int system = 0, Param param = null)
6241 {
6242 return 0.0;
6243 }
6244
6245
6246 float GetDisinfectQuantity(int system = 0, Param param1 = null)
6247 {
6248 return 250;//default value
6249 }
6250
6251 float GetFilterDamageRatio()
6252 {
6253 return 0;
6254 }
6255
6257 bool HasMuzzle()
6258 {
6259 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
6260 return true;
6261
6262 return false;
6263 }
6264
6266 int GetMuzzleID()
6267 {
6268 if (!m_WeaponTypeToID)
6270
6271 if (m_WeaponTypeToID.Contains(GetType()))
6272 {
6273 return m_WeaponTypeToID.Get(GetType());
6274 }
6275 else
6276 {
6277 // Register new weapon ID
6279 }
6280
6282 }
6283
6290 {
6291 return -1;
6292 }
6293
6294
6295
6296 // -------------------------------------------------------------------------
6297 void ~ItemBase()
6298 {
6299 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
6300 {
6301 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6302 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6303
6304 if (r_index >= 0)
6305 {
6306 InventoryLocation r_il = new InventoryLocation;
6307 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6308
6309 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6310 int r_type = r_il.GetType();
6311 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6312 {
6313 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6314 }
6315 else if (r_type == InventoryLocationType.ATTACHMENT)
6316 {
6317 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6318 }
6319
6320 }
6321
6322 player.GetHumanInventory().ClearUserReservedLocation(this);
6323 }
6324
6325 if (m_LockingSound)
6326 SEffectManager.DestroyEffect(m_LockingSound);
6327 }
6328
6329
6330
6331 // -------------------------------------------------------------------------
6332 static int GetDebugActionsMask()
6333 {
6334 return ItemBase.m_DebugActionsMask;
6335 }
6336
6337 static bool HasDebugActionsMask(int mask)
6338 {
6339 return ItemBase.m_DebugActionsMask & mask;
6340 }
6341
6342 static void SetDebugActionsMask(int mask)
6343 {
6344 ItemBase.m_DebugActionsMask = mask;
6345 }
6346
6347 static void AddDebugActionsMask(int mask)
6348 {
6349 ItemBase.m_DebugActionsMask |= mask;
6350 }
6351
6352 static void RemoveDebugActionsMask(int mask)
6353 {
6354 ItemBase.m_DebugActionsMask &= ~mask;
6355 }
6356
6357 static void ToggleDebugActionsMask(int mask)
6358 {
6359 if (HasDebugActionsMask(mask))
6360 {
6362 }
6363 else
6364 {
6365 AddDebugActionsMask(mask);
6366 }
6367 }
6368
6369 // -------------------------------------------------------------------------
6370 void SetCEBasedQuantity()
6371 {
6372 if (GetEconomyProfile())
6373 {
6374 float q_max = GetEconomyProfile().GetQuantityMax();
6375 if (q_max > 0)
6376 {
6377 float q_min = GetEconomyProfile().GetQuantityMin();
6378 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6379
6380 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
6381 {
6382 ComponentEnergyManager comp = GetCompEM();
6383 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
6384 {
6385 comp.SetEnergy0To1(quantity_randomized);
6386 }
6387 }
6388 else if (HasQuantity())
6389 {
6390 SetQuantityNormalized(quantity_randomized, false);
6391 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
6392 }
6393
6394 }
6395 }
6396 }
6397
6399 void LockToParent()
6400 {
6401 EntityAI parent = GetHierarchyParent();
6402
6403 if (parent)
6404 {
6405 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6406 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6407 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
6408 }
6409 }
6410
6412 void UnlockFromParent()
6413 {
6414 EntityAI parent = GetHierarchyParent();
6415
6416 if (parent)
6417 {
6418 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6419 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6420 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
6421 }
6422 }
6423
6424 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
6425 {
6426 /*
6427 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
6428 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
6429 */
6430 ItemBase item2 = ItemBase.Cast(entity2);
6431
6432 if (GetGame().IsClient())
6433 {
6434 if (ScriptInputUserData.CanStoreInputUserData())
6435 {
6436 ScriptInputUserData ctx = new ScriptInputUserData;
6438 ctx.Write(-1);
6439 ItemBase i1 = this; // @NOTE: workaround for correct serialization
6440 ctx.Write(i1);
6441 ctx.Write(item2);
6442 ctx.Write(use_stack_max);
6443 ctx.Write(-1);
6444 ctx.Send();
6445
6446 if (IsCombineAll(item2, use_stack_max))
6447 {
6448 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6449 }
6450 }
6451 }
6452 else if (!GetGame().IsMultiplayer())
6453 {
6454 CombineItems(item2, use_stack_max);
6455 }
6456 }
6457
6458 bool IsLiquidPresent()
6459 {
6460 return (GetLiquidType() != 0 && HasQuantity());
6461 }
6462
6463 bool IsLiquidContainer()
6464 {
6465 return m_LiquidContainerMask != 0;
6466 }
6467
6469 {
6470 return m_LiquidContainerMask;
6471 }
6472
6473 bool IsBloodContainer()
6474 {
6475 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
6476 return false;
6477 }
6478
6479 bool IsNVG()
6480 {
6481 return false;
6482 }
6483
6486 bool IsExplosive()
6487 {
6488 return false;
6489 }
6490
6492 {
6493 return "";
6494 }
6495
6497
6498 bool IsLightSource()
6499 {
6500 return false;
6501 }
6502
6504 {
6505 return true;
6506 }
6507
6508 //--- ACTION CONDITIONS
6509 //direction
6510 bool IsFacingPlayer(PlayerBase player, string selection)
6511 {
6512 return true;
6513 }
6514
6515 bool IsPlayerInside(PlayerBase player, string selection)
6516 {
6517 return true;
6518 }
6519
6520 override bool CanObstruct()
6521 {
6522 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
6523 return !player || !IsPlayerInside(player, "");
6524 }
6525
6526 override bool IsBeingPlaced()
6527 {
6528 return m_IsBeingPlaced;
6529 }
6530
6531 void SetIsBeingPlaced(bool is_being_placed)
6532 {
6533 m_IsBeingPlaced = is_being_placed;
6534 if (!is_being_placed)
6536 SetSynchDirty();
6537 }
6538
6539 //server-side
6540 void OnEndPlacement() {}
6541
6542 override bool IsHologram()
6543 {
6544 return m_IsHologram;
6545 }
6546
6547 bool CanBeDigged()
6548 {
6549 return m_CanBeDigged;
6550 }
6551
6553 {
6554 return 1;
6555 }
6556
6557 bool CanMakeGardenplot()
6558 {
6559 return false;
6560 }
6561
6562 void SetIsHologram(bool is_hologram)
6563 {
6564 m_IsHologram = is_hologram;
6565 SetSynchDirty();
6566 }
6567 /*
6568 protected float GetNutritionalEnergy()
6569 {
6570 Edible_Base edible = Edible_Base.Cast(this);
6571 return edible.GetFoodEnergy();
6572 }
6573
6574 protected float GetNutritionalWaterContent()
6575 {
6576 Edible_Base edible = Edible_Base.Cast(this);
6577 return edible.GetFoodWater();
6578 }
6579
6580 protected float GetNutritionalIndex()
6581 {
6582 Edible_Base edible = Edible_Base.Cast(this);
6583 return edible.GetFoodNutritionalIndex();
6584 }
6585
6586 protected float GetNutritionalFullnessIndex()
6587 {
6588 Edible_Base edible = Edible_Base.Cast(this);
6589 return edible.GetFoodTotalVolume();
6590 }
6591
6592 protected float GetNutritionalToxicity()
6593 {
6594 Edible_Base edible = Edible_Base.Cast(this);
6595 return edible.GetFoodToxicity();
6596
6597 }
6598 */
6599
6600
6601 // -------------------------------------------------------------------------
6602 override void OnMovedInsideCargo(EntityAI container)
6603 {
6604 super.OnMovedInsideCargo(container);
6605
6606 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6607 }
6608
6609 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6610 {
6611 super.EEItemLocationChanged(oldLoc,newLoc);
6612
6613 PlayerBase new_player = null;
6614 PlayerBase old_player = null;
6615
6616 if (newLoc.GetParent())
6617 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6618
6619 if (oldLoc.GetParent())
6620 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6621
6622 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
6623 {
6624 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6625
6626 if (r_index >= 0)
6627 {
6628 InventoryLocation r_il = new InventoryLocation;
6629 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6630
6631 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6632 int r_type = r_il.GetType();
6633 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6634 {
6635 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6636 }
6637 else if (r_type == InventoryLocationType.ATTACHMENT)
6638 {
6639 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6640 }
6641
6642 }
6643 }
6644
6645 if (newLoc.GetType() == InventoryLocationType.HANDS)
6646 {
6647 if (new_player)
6648 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6649
6650 if (new_player == old_player)
6651 {
6652
6653 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6654 {
6655 if (oldLoc.GetType() == InventoryLocationType.CARGO)
6656 {
6657 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6658 {
6659 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6660 }
6661 }
6662 else
6663 {
6664 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6665 }
6666 }
6667
6668 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6669 {
6670 int type = oldLoc.GetType();
6671 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
6672 {
6673 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6674 }
6675 else if (type == InventoryLocationType.ATTACHMENT)
6676 {
6677 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6678 }
6679 }
6680 if (!m_OldLocation)
6681 {
6682 m_OldLocation = new InventoryLocation;
6683 }
6684 m_OldLocation.Copy(oldLoc);
6685 }
6686 else
6687 {
6688 if (m_OldLocation)
6689 {
6690 m_OldLocation.Reset();
6691 }
6692 }
6693
6695 }
6696 else
6697 {
6698 if (new_player)
6699 {
6700 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6701 if (res_index >= 0)
6702 {
6703 InventoryLocation il = new InventoryLocation;
6704 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6705 ItemBase it = ItemBase.Cast(il.GetItem());
6706 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6707 int rel_type = il.GetType();
6708 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
6709 {
6710 il.GetParent().GetOnReleaseLock().Invoke(it);
6711 }
6712 else if (rel_type == InventoryLocationType.ATTACHMENT)
6713 {
6714 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
6715 }
6716 //it.GetOnReleaseLock().Invoke(it);
6717 }
6718 }
6719 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
6720 {
6721 //ThrowPhysically(old_player, vector.Zero);
6722 m_ThrowItemOnDrop = false;
6723 }
6724
6725 if (m_OldLocation)
6726 {
6727 m_OldLocation.Reset();
6728 }
6729 }
6730 }
6731
6732 override void EOnContact(IEntity other, Contact extra)
6733 {
6735 {
6736 int liquidType = -1;
6737 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
6738 if (impactSpeed > 0.0)
6739 {
6740 m_ImpactSpeed = impactSpeed;
6741 #ifndef SERVER
6742 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
6743 #else
6744 m_WantPlayImpactSound = true;
6745 SetSynchDirty();
6746 #endif
6747 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
6748 }
6749 }
6750
6751 #ifdef SERVER
6752 if (GetCompEM() && GetCompEM().IsPlugged())
6753 {
6754 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
6755 GetCompEM().UnplugThis();
6756 }
6757 #endif
6758 }
6759
6760 void RefreshPhysics();
6761
6762 override void OnCreatePhysics()
6763 {
6765 }
6766
6767 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6768 {
6769
6770 }
6771 // -------------------------------------------------------------------------
6772 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
6773 {
6774 super.OnItemLocationChanged(old_owner, new_owner);
6775
6776 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6777 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6778
6779 if (!relatedPlayer && playerNew)
6780 relatedPlayer = playerNew;
6781
6782 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6783 {
6784 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
6785 if (actionMgr)
6786 {
6787 ActionBase currentAction = actionMgr.GetRunningAction();
6788 if (currentAction)
6789 currentAction.OnItemLocationChanged(this);
6790 }
6791 }
6792
6793 Man ownerPlayerOld = null;
6794 Man ownerPlayerNew = null;
6795
6796 if (old_owner)
6797 {
6798 if (old_owner.IsMan())
6799 {
6800 ownerPlayerOld = Man.Cast(old_owner);
6801 }
6802 else
6803 {
6804 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6805 }
6806 }
6807 else
6808 {
6809 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
6810 {
6811 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
6812
6813 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
6814 {
6815 GetCompEM().UnplugThis();
6816 }
6817 }
6818 }
6819
6820 if (new_owner)
6821 {
6822 if (new_owner.IsMan())
6823 {
6824 ownerPlayerNew = Man.Cast(new_owner);
6825 }
6826 else
6827 {
6828 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6829 }
6830 }
6831
6832 if (ownerPlayerOld != ownerPlayerNew)
6833 {
6834 if (ownerPlayerOld)
6835 {
6836 array<EntityAI> subItemsExit = new array<EntityAI>;
6837 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
6838 for (int i = 0; i < subItemsExit.Count(); i++)
6839 {
6840 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
6841 itemExit.OnInventoryExit(ownerPlayerOld);
6842 }
6843 }
6844
6845 if (ownerPlayerNew)
6846 {
6847 array<EntityAI> subItemsEnter = new array<EntityAI>;
6848 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
6849 for (int j = 0; j < subItemsEnter.Count(); j++)
6850 {
6851 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
6852 itemEnter.OnInventoryEnter(ownerPlayerNew);
6853 }
6854 }
6855 }
6856 else if (ownerPlayerNew != null)
6857 {
6858 PlayerBase nplayer;
6859 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6860 {
6861 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6862 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
6863 for (int k = 0; k < subItemsUpdate.Count(); k++)
6864 {
6865 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
6866 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6867 }
6868 }
6869 }
6870
6871 if (old_owner)
6872 old_owner.OnChildItemRemoved(this);
6873 if (new_owner)
6874 new_owner.OnChildItemReceived(this);
6875 }
6876
6877 // -------------------------------------------------------------------------------
6878 override void EEDelete(EntityAI parent)
6879 {
6880 super.EEDelete(parent);
6881 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6882 if (player)
6883 {
6884 OnInventoryExit(player);
6885
6886 if (player.IsAlive())
6887 {
6888 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6889 if (r_index >= 0)
6890 {
6891 InventoryLocation r_il = new InventoryLocation;
6892 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6893
6894 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6895 int r_type = r_il.GetType();
6896 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6897 {
6898 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6899 }
6900 else if (r_type == InventoryLocationType.ATTACHMENT)
6901 {
6902 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6903 }
6904
6905 }
6906
6907 player.RemoveQuickBarEntityShortcut(this);
6908 }
6909 }
6910 }
6911 // -------------------------------------------------------------------------------
6912 override void EEKilled(Object killer)
6913 {
6914 super.EEKilled(killer);
6915
6917 if (killer && killer.IsFireplace() && CanExplodeInFire())
6918 {
6919 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6920 {
6921 if (IsMagazine())
6922 {
6923 if (Magazine.Cast(this).GetAmmoCount() > 0)
6924 {
6925 ExplodeAmmo();
6926 }
6927 }
6928 else
6929 {
6930 Explode(DamageType.EXPLOSION);
6931 }
6932 }
6933 }
6934 }
6935
6936 override void OnWasAttached(EntityAI parent, int slot_id)
6937 {
6938 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6939
6940 super.OnWasAttached(parent, slot_id);
6941
6942 if (HasQuantity())
6943 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6944
6945 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
6946 }
6947
6948 override void OnWasDetached(EntityAI parent, int slot_id)
6949 {
6950 super.OnWasDetached(parent, slot_id);
6951
6952 if (HasQuantity())
6953 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6954 }
6955
6956 override string ChangeIntoOnAttach(string slot)
6957 {
6958 int idx;
6959 TStringArray inventory_slots = new TStringArray;
6960 TStringArray attach_types = new TStringArray;
6961
6962 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6963 if (inventory_slots.Count() < 1) //is string
6964 {
6965 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6966 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6967 }
6968 else //is array
6969 {
6970 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6971 }
6972
6973 idx = inventory_slots.Find(slot);
6974 if (idx < 0)
6975 return "";
6976
6977 return attach_types.Get(idx);
6978 }
6979
6980 override string ChangeIntoOnDetach()
6981 {
6982 int idx = -1;
6983 string slot;
6984
6985 TStringArray inventory_slots = new TStringArray;
6986 TStringArray detach_types = new TStringArray;
6987
6988 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6989 if (inventory_slots.Count() < 1) //is string
6990 {
6991 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6992 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6993 }
6994 else //is array
6995 {
6996 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6997 if (detach_types.Count() < 1)
6998 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6999 }
7000
7001 for (int i = 0; i < inventory_slots.Count(); i++)
7002 {
7003 slot = inventory_slots.Get(i);
7004 }
7005
7006 if (slot != "")
7007 {
7008 if (detach_types.Count() == 1)
7009 idx = 0;
7010 else
7011 idx = inventory_slots.Find(slot);
7012 }
7013 if (idx < 0)
7014 return "";
7015
7016 return detach_types.Get(idx);
7017 }
7018
7019 void ExplodeAmmo()
7020 {
7021 //timer
7022 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
7023
7024 //min/max time
7025 float min_time = 1;
7026 float max_time = 3;
7027 float delay = Math.RandomFloat(min_time, max_time);
7028
7029 explode_timer.Run(delay, this, "DoAmmoExplosion");
7030 }
7031
7032 void DoAmmoExplosion()
7033 {
7034 Magazine magazine = Magazine.Cast(this);
7035 int pop_sounds_count = 6;
7036 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7037
7038 //play sound
7039 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7040 string sound_name = pop_sounds[ sound_idx ];
7041 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
7042
7043 //remove ammo count
7044 magazine.ServerAddAmmoCount(-1);
7045
7046 //if condition then repeat -> ExplodeAmmo
7047 float min_temp_to_explode = 100; //min temperature for item to explode
7048
7049 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
7050 {
7051 ExplodeAmmo();
7052 }
7053 }
7054
7055 // -------------------------------------------------------------------------------
7056 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
7057 {
7058 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
7059
7060 const int CHANCE_DAMAGE_CARGO = 4;
7061 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7062 const int CHANCE_DAMAGE_NOTHING = 2;
7063
7064 if (IsClothing() || IsContainer() || IsItemTent())
7065 {
7066 float dmg = damageResult.GetDamage("","Health") * -0.5;
7067 int chances;
7068 int rnd;
7069
7070 if (GetInventory().GetCargo())
7071 {
7072 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7073 rnd = Math.RandomInt(0,chances);
7074
7075 if (rnd < CHANCE_DAMAGE_CARGO)
7076 {
7077 DamageItemInCargo(dmg);
7078 }
7079 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7080 {
7082 }
7083 }
7084 else
7085 {
7086 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7087 rnd = Math.RandomInt(0,chances);
7088
7089 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7090 {
7092 }
7093 }
7094 }
7095 }
7096
7097 bool DamageItemInCargo(float damage)
7098 {
7099 if (GetInventory().GetCargo())
7100 {
7101 int item_count = GetInventory().GetCargo().GetItemCount();
7102 if (item_count > 0)
7103 {
7104 int random_pick = Math.RandomInt(0, item_count);
7105 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
7106 if (!item.IsExplosive())
7107 {
7108 item.AddHealth("","",damage);
7109 return true;
7110 }
7111 }
7112 }
7113 return false;
7114 }
7115
7116 bool DamageItemAttachments(float damage)
7117 {
7118 int attachment_count = GetInventory().AttachmentCount();
7119 if (attachment_count > 0)
7120 {
7121 int random_pick = Math.RandomInt(0, attachment_count);
7122 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7123 if (!attachment.IsExplosive())
7124 {
7125 attachment.AddHealth("","",damage);
7126 return true;
7127 }
7128 }
7129 return false;
7130 }
7131
7132 override bool IsSplitable()
7133 {
7134 return m_CanThisBeSplit;
7135 }
7136 //----------------
7137 override bool CanBeSplit()
7138 {
7139 if (IsSplitable() && (GetQuantity() > 1))
7140 return GetInventory().CanRemoveEntity();
7141
7142 return false;
7143 }
7144
7145 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
7146 {
7147 if (!CanBeSplit())
7148 return;
7149
7150 if (GetGame().IsClient())
7151 {
7152 if (ScriptInputUserData.CanStoreInputUserData())
7153 {
7154 ScriptInputUserData ctx = new ScriptInputUserData;
7156 ctx.Write(1);
7157 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7158 ctx.Write(i1);
7159 ctx.Write(destination_entity);
7160 ctx.Write(true);
7161 ctx.Write(slot_id);
7162 ctx.Send();
7163 }
7164 }
7165 else if (!GetGame().IsMultiplayer())
7166 {
7167 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
7168 }
7169 }
7170
7171 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
7172 {
7173 if (!CanBeSplit())
7174 return;
7175
7176 float split_quantity_new;
7177 ref ItemBase new_item;
7178 float quantity = GetQuantity();
7179 float stack_max = GetTargetQuantityMax(slot_id);
7180 InventoryLocation loc = new InventoryLocation;
7181
7182 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7183 {
7184 if (stack_max <= GetQuantity())
7185 split_quantity_new = stack_max;
7186 else
7187 split_quantity_new = GetQuantity();
7188
7189 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7190 if (new_item)
7191 {
7192 new_item.SetResultOfSplit(true);
7193 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7194 AddQuantity(-split_quantity_new);
7195 new_item.SetQuantity(split_quantity_new);
7196 }
7197 }
7198 else if (destination_entity && slot_id == -1)
7199 {
7200 if (quantity > stack_max)
7201 split_quantity_new = stack_max;
7202 else
7203 split_quantity_new = quantity;
7204
7205 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7206 {
7207 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7208 new_item = ItemBase.Cast(o);
7209 }
7210
7211 if (new_item)
7212 {
7213 new_item.SetResultOfSplit(true);
7214 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7215 AddQuantity(-split_quantity_new);
7216 new_item.SetQuantity(split_quantity_new);
7217 }
7218 }
7219 else
7220 {
7221 if (stack_max != 0)
7222 {
7223 if (stack_max < GetQuantity())
7224 {
7225 split_quantity_new = GetQuantity() - stack_max;
7226 }
7227
7228 if (split_quantity_new == 0)
7229 {
7230 if (!GetGame().IsMultiplayer())
7231 player.PhysicalPredictiveDropItem(this);
7232 else
7233 player.ServerDropEntity(this);
7234 return;
7235 }
7236
7237 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7238
7239 if (new_item)
7240 {
7241 new_item.SetResultOfSplit(true);
7242 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7243 SetQuantity(split_quantity_new);
7244 new_item.SetQuantity(stack_max);
7245 new_item.PlaceOnSurface();
7246 }
7247 }
7248 }
7249 }
7250
7251 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
7252 {
7253 if (!CanBeSplit())
7254 return;
7255
7256 float split_quantity_new;
7257 ref ItemBase new_item;
7258 float quantity = GetQuantity();
7259 float stack_max = GetTargetQuantityMax(slot_id);
7260 InventoryLocation loc = new InventoryLocation;
7261
7262 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7263 {
7264 if (stack_max <= GetQuantity())
7265 split_quantity_new = stack_max;
7266 else
7267 split_quantity_new = GetQuantity();
7268
7269 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7270 if (new_item)
7271 {
7272 new_item.SetResultOfSplit(true);
7273 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7274 AddQuantity(-split_quantity_new);
7275 new_item.SetQuantity(split_quantity_new);
7276 }
7277 }
7278 else if (destination_entity && slot_id == -1)
7279 {
7280 if (quantity > stack_max)
7281 split_quantity_new = stack_max;
7282 else
7283 split_quantity_new = quantity;
7284
7285 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7286 {
7287 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7288 new_item = ItemBase.Cast(o);
7289 }
7290
7291 if (new_item)
7292 {
7293 new_item.SetResultOfSplit(true);
7294 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7295 AddQuantity(-split_quantity_new);
7296 new_item.SetQuantity(split_quantity_new);
7297 }
7298 }
7299 else
7300 {
7301 if (stack_max != 0)
7302 {
7303 if (stack_max < GetQuantity())
7304 {
7305 split_quantity_new = GetQuantity() - stack_max;
7306 }
7307
7308 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7309
7310 if (new_item)
7311 {
7312 new_item.SetResultOfSplit(true);
7313 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7314 SetQuantity(split_quantity_new);
7315 new_item.SetQuantity(stack_max);
7316 new_item.PlaceOnSurface();
7317 }
7318 }
7319 }
7320 }
7321
7322 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
7323 {
7324 if (!CanBeSplit())
7325 return;
7326
7327 if (GetGame().IsClient())
7328 {
7329 if (ScriptInputUserData.CanStoreInputUserData())
7330 {
7331 ScriptInputUserData ctx = new ScriptInputUserData;
7333 ctx.Write(4);
7334 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7335 ctx.Write(thiz);
7336 dst.WriteToContext(ctx);
7337 ctx.Send();
7338 }
7339 }
7340 else if (!GetGame().IsMultiplayer())
7341 {
7343 }
7344 }
7345
7346 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
7347 {
7348 if (!CanBeSplit())
7349 return;
7350
7351 if (GetGame().IsClient())
7352 {
7353 if (ScriptInputUserData.CanStoreInputUserData())
7354 {
7355 ScriptInputUserData ctx = new ScriptInputUserData;
7357 ctx.Write(2);
7358 ItemBase dummy = this; // @NOTE: workaround for correct serialization
7359 ctx.Write(dummy);
7360 ctx.Write(destination_entity);
7361 ctx.Write(true);
7362 ctx.Write(idx);
7363 ctx.Write(row);
7364 ctx.Write(col);
7365 ctx.Send();
7366 }
7367 }
7368 else if (!GetGame().IsMultiplayer())
7369 {
7370 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
7371 }
7372 }
7373
7374 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
7375 {
7377 }
7378
7379 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
7380 {
7381 if (!CanBeSplit())
7382 return this;
7383
7384 float quantity = GetQuantity();
7385 float split_quantity_new;
7386 ItemBase new_item;
7387 if (dst.IsValid())
7388 {
7389 int slot_id = dst.GetSlot();
7390 float stack_max = GetTargetQuantityMax(slot_id);
7391
7392 if (quantity > stack_max)
7393 split_quantity_new = stack_max;
7394 else
7395 split_quantity_new = quantity;
7396
7397 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7398
7399 if (new_item)
7400 {
7401 new_item.SetResultOfSplit(true);
7402 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7403 AddQuantity(-split_quantity_new);
7404 new_item.SetQuantity(split_quantity_new);
7405 }
7406
7407 return new_item;
7408 }
7409
7410 return null;
7411 }
7412
7413 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
7414 {
7415 if (!CanBeSplit())
7416 return;
7417
7418 float quantity = GetQuantity();
7419 float split_quantity_new;
7420 ref ItemBase new_item;
7421 if (destination_entity)
7422 {
7423 float stackable = GetTargetQuantityMax();
7424 if (quantity > stackable)
7425 split_quantity_new = stackable;
7426 else
7427 split_quantity_new = quantity;
7428
7429 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
7430 if (new_item)
7431 {
7432 new_item.SetResultOfSplit(true);
7433 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7434 AddQuantity(-split_quantity_new);
7435 new_item.SetQuantity(split_quantity_new);
7436 }
7437 }
7438 }
7439
7440 void SplitIntoStackMaxHandsClient(PlayerBase player)
7441 {
7442 if (!CanBeSplit())
7443 return;
7444
7445 if (GetGame().IsClient())
7446 {
7447 if (ScriptInputUserData.CanStoreInputUserData())
7448 {
7449 ScriptInputUserData ctx = new ScriptInputUserData;
7451 ctx.Write(3);
7452 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7453 ctx.Write(i1);
7454 ItemBase destination_entity = this;
7455 ctx.Write(destination_entity);
7456 ctx.Write(true);
7457 ctx.Write(0);
7458 ctx.Send();
7459 }
7460 }
7461 else if (!GetGame().IsMultiplayer())
7462 {
7463 SplitIntoStackMaxHands(player);
7464 }
7465 }
7466
7467 void SplitIntoStackMaxHands(PlayerBase player)
7468 {
7469 if (!CanBeSplit())
7470 return;
7471
7472 float quantity = GetQuantity();
7473 float split_quantity_new;
7474 ref ItemBase new_item;
7475 if (player)
7476 {
7477 float stackable = GetTargetQuantityMax();
7478 if (quantity > stackable)
7479 split_quantity_new = stackable;
7480 else
7481 split_quantity_new = quantity;
7482
7483 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
7484 new_item = ItemBase.Cast(in_hands);
7485 if (new_item)
7486 {
7487 new_item.SetResultOfSplit(true);
7488 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7489 AddQuantity(-split_quantity_new);
7490 new_item.SetQuantity(split_quantity_new);
7491 }
7492 }
7493 }
7494
7495 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
7496 {
7497 if (!CanBeSplit())
7498 return;
7499
7500 float quantity = GetQuantity();
7501 float split_quantity_new = Math.Floor(quantity * 0.5);
7502
7503 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7504
7505 if (new_item)
7506 {
7507 if (new_item.GetQuantityMax() < split_quantity_new)
7508 {
7509 split_quantity_new = new_item.GetQuantityMax();
7510 }
7511
7512 new_item.SetResultOfSplit(true);
7513 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7514
7515 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7516 {
7517 AddQuantity(-1);
7518 new_item.SetQuantity(1);
7519 }
7520 else
7521 {
7522 AddQuantity(-split_quantity_new);
7523 new_item.SetQuantity(split_quantity_new);
7524 }
7525 }
7526 }
7527
7528 void SplitItem(PlayerBase player)
7529 {
7530 if (!CanBeSplit())
7531 return;
7532
7533 float quantity = GetQuantity();
7534 float split_quantity_new = Math.Floor(quantity / 2);
7535
7536 InventoryLocation invloc = new InventoryLocation;
7537 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
7538
7539 ItemBase new_item;
7540 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7541
7542 if (new_item)
7543 {
7544 if (new_item.GetQuantityMax() < split_quantity_new)
7545 {
7546 split_quantity_new = new_item.GetQuantityMax();
7547 }
7548 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7549 {
7550 AddQuantity(-1);
7551 new_item.SetQuantity(1);
7552 }
7553 else
7554 {
7555 AddQuantity(-split_quantity_new);
7556 new_item.SetQuantity(split_quantity_new);
7557 }
7558 }
7559 }
7560
7562 void OnQuantityChanged(float delta)
7563 {
7564 SetWeightDirty();
7565 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
7566
7567 if (parent)
7568 parent.OnAttachmentQuantityChangedEx(this, delta);
7569
7570 if (IsLiquidContainer())
7571 {
7572 if (GetQuantityNormalized() <= 0.0)
7573 {
7575 }
7576 else if (GetLiquidType() == LIQUID_NONE)
7577 {
7578 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
7580 }
7581 }
7582
7583 }
7584
7587 {
7588 // insert code here
7589 }
7590
7592 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
7593 {
7595 }
7596
7597 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
7598 {
7599 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7600
7601 if (GetGame().IsServer())
7602 {
7603 if (newLevel == GameConstants.STATE_RUINED)
7604 {
7606 EntityAI parent = GetHierarchyParent();
7607 if (parent && parent.IsFireplace())
7608 {
7609 CargoBase cargo = GetInventory().GetCargo();
7610 if (cargo)
7611 {
7612 for (int i = 0; i < cargo.GetItemCount(); ++i)
7613 {
7614 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
7615 }
7616 }
7617 }
7618 }
7619
7620 if (IsResultOfSplit())
7621 {
7622 // reset the splitting result flag, return to normal item behavior
7623 SetResultOfSplit(false);
7624 return;
7625 }
7626
7627 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7628 {
7629 SetCleanness(0);//unclean the item upon damage dealt
7630 }
7631 }
7632 }
7633
7634 // just the split? TODO: verify
7635 override void OnRightClick()
7636 {
7637 super.OnRightClick();
7638
7639 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
7640 {
7641 if (GetGame().IsClient())
7642 {
7643 if (ScriptInputUserData.CanStoreInputUserData())
7644 {
7645 vector m4[4];
7646 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7647
7648 EntityAI root = GetHierarchyRoot();
7649
7650 InventoryLocation dst = new InventoryLocation;
7651 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
7652 {
7653 if (root)
7654 {
7655 root.GetTransform(m4);
7656 dst.SetGround(this, m4);
7657 }
7658 else
7659 GetInventory().GetCurrentInventoryLocation(dst);
7660 }
7661 else
7662 {
7663 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
7664 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
7665 this shouldnt cause issues within this scope*/
7666 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
7667 {
7668 if (root)
7669 {
7670 root.GetTransform(m4);
7671 dst.SetGround(this, m4);
7672 }
7673 else
7674 GetInventory().GetCurrentInventoryLocation(dst);
7675 }
7676 else
7677 {
7678 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7679 }
7680 }
7681
7682 ScriptInputUserData ctx = new ScriptInputUserData;
7684 ctx.Write(4);
7685 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7686 ctx.Write(thiz);
7687 dst.WriteToContext(ctx);
7688 ctx.Write(true); // dummy
7689 ctx.Send();
7690 }
7691 }
7692 else if (!GetGame().IsMultiplayer())
7693 {
7694 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
7695 }
7696 }
7697 }
7698
7699 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
7700 {
7701 //TODO: delete check zero quantity check after fix double posts hands fsm events
7702 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
7703 return false;
7704
7705 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7706 return false;
7707
7708 //can_this_be_combined = ConfigGetBool("canBeSplit");
7710 return false;
7711
7712
7713 Magazine mag = Magazine.Cast(this);
7714 if (mag)
7715 {
7716 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7717 return false;
7718
7719 if (stack_max_limit)
7720 {
7721 Magazine other_mag = Magazine.Cast(other_item);
7722 if (other_item)
7723 {
7724 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7725 return false;
7726 }
7727
7728 }
7729 }
7730 else
7731 {
7732 //TODO: delete check zero quantity check after fix double posts hands fsm events
7733 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
7734 return false;
7735
7736 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
7737 return false;
7738 }
7739
7740 PlayerBase player = null;
7741 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
7742 {
7743 if (player.GetInventory().HasAttachment(this))
7744 return false;
7745
7746 if (player.IsItemsToDelete())
7747 return false;
7748 }
7749
7750 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7751 return false;
7752
7753 int slotID;
7754 string slotName;
7755 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7756 return false;
7757
7758 return true;
7759 }
7760
7761 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
7762 {
7763 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
7764 }
7765
7766 bool IsResultOfSplit()
7767 {
7768 return m_IsResultOfSplit;
7769 }
7770
7771 void SetResultOfSplit(bool value)
7772 {
7773 m_IsResultOfSplit = value;
7774 }
7775
7776 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
7777 {
7778 return ComputeQuantityUsedEx(other_item, use_stack_max);
7779 }
7780
7781 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
7782 {
7783 float other_item_quantity = other_item.GetQuantity();
7784 float this_free_space;
7785
7786 float stack_max = GetQuantityMax();
7787
7788 this_free_space = stack_max - GetQuantity();
7789
7790 if (other_item_quantity > this_free_space)
7791 {
7792 return this_free_space;
7793 }
7794 else
7795 {
7796 return other_item_quantity;
7797 }
7798 }
7799
7800 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
7801 {
7802 CombineItems(ItemBase.Cast(entity2),use_stack_max);
7803 }
7804
7805 void CombineItems(ItemBase other_item, bool use_stack_max = true)
7806 {
7807 if (!CanBeCombined(other_item, false))
7808 return;
7809
7810 if (!IsMagazine() && other_item)
7811 {
7812 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
7813 if (quantity_used != 0)
7814 {
7815 float hp1 = GetHealth01("","");
7816 float hp2 = other_item.GetHealth01("","");
7817 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
7818 hpResult = hpResult / (GetQuantity() + quantity_used);
7819
7820 hpResult *= GetMaxHealth();
7821 Math.Round(hpResult);
7822 SetHealth("", "Health", hpResult);
7823
7824 AddQuantity(quantity_used);
7825 other_item.AddQuantity(-quantity_used);
7826 }
7827 }
7828 OnCombine(other_item);
7829 }
7830
7831 void OnCombine(ItemBase other_item)
7832 {
7833 #ifdef SERVER
7834 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7835 GetHierarchyParent().IncreaseLifetimeUp();
7836 #endif
7837 };
7838
7839 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
7840 {
7841 PlayerBase p = PlayerBase.Cast(player);
7842
7843 array<int> recipesIds = p.m_Recipes;
7844 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7845 if (moduleRecipesManager)
7846 {
7847 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7848 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
7849 }
7850
7851 for (int i = 0;i < recipesIds.Count(); i++)
7852 {
7853 int key = recipesIds.Get(i);
7854 string recipeName = moduleRecipesManager.GetRecipeName(key);
7855 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
7856 }
7857 }
7858
7859 // -------------------------------------------------------------------------
7860 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7861 {
7862 super.GetDebugActions(outputList);
7863
7864 //quantity
7865 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
7866 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
7867 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
7868 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
7869
7870 //health
7871 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
7872 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
7873 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
7874 //temperature
7875 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
7876 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
7877 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
7878
7879 //wet
7880 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
7881 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
7882
7883 //liquidtype
7884 if (IsLiquidContainer())
7885 {
7886 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
7887 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
7888 }
7889
7890 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
7891 // watch
7892 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
7893 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
7894
7895 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
7896 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
7897 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
7898 }
7899
7900 // -------------------------------------------------------------------------
7901 // -------------------------------------------------------------------------
7902 // -------------------------------------------------------------------------
7903 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
7904 {
7905 super.OnAction(action_id, player, ctx);
7906 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
7907 {
7908 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7909 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
7910 PlayerBase p = PlayerBase.Cast(player);
7911 if (EActions.RECIPES_RANGE_START < 1000)
7912 {
7913 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7914 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7915 }
7916 }
7917 #ifndef SERVER
7918 else if (action_id == EActions.WATCH_PLAYER)
7919 {
7920 PluginDeveloper.SetDeveloperItemClientEx(player);
7921 }
7922 #endif
7923 if (GetGame().IsServer())
7924 {
7925 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7926 {
7927 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7928 OnDebugButtonPressServer(id + 1);
7929 }
7930
7931 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7932 {
7933 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7934 InsertAgent(agent_id,100);
7935 }
7936
7937 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7938 {
7939 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7940 RemoveAgent(agent_id2);
7941 }
7942
7943 else if (action_id == EActions.ADD_QUANTITY)
7944 {
7945 if (IsMagazine())
7946 {
7947 Magazine mag = Magazine.Cast(this);
7948 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7949 }
7950 else
7951 {
7952 AddQuantity(GetQuantityMax() * 0.2);
7953 }
7954
7955 if (m_EM)
7956 {
7957 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7958 }
7959 //PrintVariables();
7960 }
7961
7962 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
7963 {
7964 if (IsMagazine())
7965 {
7966 Magazine mag2 = Magazine.Cast(this);
7967 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7968 }
7969 else
7970 {
7971 AddQuantity(- GetQuantityMax() * 0.2);
7972 }
7973 if (m_EM)
7974 {
7975 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7976 }
7977 //PrintVariables();
7978 }
7979
7980 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
7981 {
7982 SetQuantity(0);
7983
7984 if (m_EM)
7985 {
7986 m_EM.SetEnergy(0);
7987 }
7988 }
7989
7990 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
7991 {
7993
7994 if (m_EM)
7995 {
7996 m_EM.SetEnergy(m_EM.GetEnergyMax());
7997 }
7998 }
7999
8000 else if (action_id == EActions.ADD_HEALTH)
8001 {
8002 AddHealth("","",GetMaxHealth("","Health")/5);
8003 }
8004 else if (action_id == EActions.REMOVE_HEALTH)
8005 {
8006 AddHealth("","",-GetMaxHealth("","Health")/5);
8007 }
8008 else if (action_id == EActions.DESTROY_HEALTH)
8009 {
8010 SetHealth01("","",0);
8011 }
8012 else if (action_id == EActions.WATCH_ITEM)
8013 {
8015 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
8016 #ifdef DEVELOPER
8017 SetDebugDeveloper_item(this);
8018 #endif
8019 }
8020
8021 else if (action_id == EActions.ADD_TEMPERATURE)
8022 {
8023 AddTemperature(20);
8024 //PrintVariables();
8025 }
8026
8027 else if (action_id == EActions.REMOVE_TEMPERATURE)
8028 {
8029 AddTemperature(-20);
8030 //PrintVariables();
8031 }
8032
8033 else if (action_id == EActions.FLIP_FROZEN)
8034 {
8035 SetFrozen(!GetIsFrozen());
8036 //PrintVariables();
8037 }
8038
8039 else if (action_id == EActions.ADD_WETNESS)
8040 {
8041 AddWet(GetWetMax()/5);
8042 //PrintVariables();
8043 }
8044
8045 else if (action_id == EActions.REMOVE_WETNESS)
8046 {
8047 AddWet(-GetWetMax()/5);
8048 //PrintVariables();
8049 }
8050
8051 else if (action_id == EActions.LIQUIDTYPE_UP)
8052 {
8053 int curr_type = GetLiquidType();
8054 SetLiquidType(curr_type * 2);
8055 //AddWet(1);
8056 //PrintVariables();
8057 }
8058
8059 else if (action_id == EActions.LIQUIDTYPE_DOWN)
8060 {
8061 int curr_type2 = GetLiquidType();
8062 SetLiquidType(curr_type2 / 2);
8063 }
8064
8065 else if (action_id == EActions.MAKE_SPECIAL)
8066 {
8067 auto debugParams = DebugSpawnParams.WithPlayer(player);
8068 OnDebugSpawnEx(debugParams);
8069 }
8070
8071 else if (action_id == EActions.DELETE)
8072 {
8073 Delete();
8074 }
8075
8076 }
8077
8078
8079 return false;
8080 }
8081
8082 // -------------------------------------------------------------------------
8083
8084
8087 void OnActivatedByTripWire();
8088
8090 void OnActivatedByItem(notnull ItemBase item);
8091
8092 //----------------------------------------------------------------
8093 //returns true if item is able to explode when put in fire
8094 bool CanExplodeInFire()
8095 {
8096 return false;
8097 }
8098
8099 //----------------------------------------------------------------
8100 bool CanEat()
8101 {
8102 return true;
8103 }
8104
8105 //----------------------------------------------------------------
8106 override bool IsIgnoredByConstruction()
8107 {
8108 return true;
8109 }
8110
8111 //----------------------------------------------------------------
8112 //has FoodStages in config?
8113 bool HasFoodStage()
8114 {
8115 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
8116 return GetGame().ConfigIsExisting(config_path);
8117 }
8118
8120 FoodStage GetFoodStage()
8121 {
8122 return null;
8123 }
8124
8125 bool CanBeCooked()
8126 {
8127 return false;
8128 }
8129
8130 bool CanBeCookedOnStick()
8131 {
8132 return false;
8133 }
8134
8136 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
8138
8139 //----------------------------------------------------------------
8140 bool CanRepair(ItemBase item_repair_kit)
8141 {
8142 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8143 return module_repairing.CanRepair(this, item_repair_kit);
8144 }
8145
8146 //----------------------------------------------------------------
8147 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
8148 {
8149 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8150 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8151 }
8152
8153 //----------------------------------------------------------------
8154 int GetItemSize()
8155 {
8156 /*
8157 vector v_size = this.ConfigGetVector("itemSize");
8158 int v_size_x = v_size[0];
8159 int v_size_y = v_size[1];
8160 int size = v_size_x * v_size_y;
8161 return size;
8162 */
8163
8164 return 1;
8165 }
8166
8167 //----------------------------------------------------------------
8168 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8169 bool CanBeMovedOverride()
8170 {
8171 return m_CanBeMovedOverride;
8172 }
8173
8174 //----------------------------------------------------------------
8175 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8176 void SetCanBeMovedOverride(bool setting)
8177 {
8178 m_CanBeMovedOverride = setting;
8179 }
8180
8181 //----------------------------------------------------------------
8189 void MessageToOwnerStatus(string text)
8190 {
8191 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8192
8193 if (player)
8194 {
8195 player.MessageStatus(text);
8196 }
8197 }
8198
8199 //----------------------------------------------------------------
8207 void MessageToOwnerAction(string text)
8208 {
8209 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8210
8211 if (player)
8212 {
8213 player.MessageAction(text);
8214 }
8215 }
8216
8217 //----------------------------------------------------------------
8225 void MessageToOwnerFriendly(string text)
8226 {
8227 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8228
8229 if (player)
8230 {
8231 player.MessageFriendly(text);
8232 }
8233 }
8234
8235 //----------------------------------------------------------------
8243 void MessageToOwnerImportant(string text)
8244 {
8245 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8246
8247 if (player)
8248 {
8249 player.MessageImportant(text);
8250 }
8251 }
8252
8253 override bool IsItemBase()
8254 {
8255 return true;
8256 }
8257
8258 // Checks if item is of questioned kind
8259 override bool KindOf(string tag)
8260 {
8261 bool found = false;
8262 string item_name = this.GetType();
8263 ref TStringArray item_tag_array = new TStringArray;
8264 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
8265
8266 int array_size = item_tag_array.Count();
8267 for (int i = 0; i < array_size; i++)
8268 {
8269 if (item_tag_array.Get(i) == tag)
8270 {
8271 found = true;
8272 break;
8273 }
8274 }
8275 return found;
8276 }
8277
8278
8279 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
8280 {
8281 //Debug.Log("OnRPC called");
8282 super.OnRPC(sender, rpc_type,ctx);
8283
8284 //Play soundset for attachment locking (ActionLockAttachment.c)
8285 switch (rpc_type)
8286 {
8287 #ifndef SERVER
8288 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8289 Param2<bool, string> p = new Param2<bool, string>(false, "");
8290
8291 if (!ctx.Read(p))
8292 return;
8293
8294 bool play = p.param1;
8295 string soundSet = p.param2;
8296
8297 if (play)
8298 {
8299 if (m_LockingSound)
8300 {
8302 {
8303 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8304 }
8305 }
8306 else
8307 {
8308 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8309 }
8310 }
8311 else
8312 {
8313 SEffectManager.DestroyEffect(m_LockingSound);
8314 }
8315
8316 break;
8317 #endif
8318
8319 }
8320
8321 if (GetWrittenNoteData())
8322 {
8323 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
8324 }
8325 }
8326
8327 //-----------------------------
8328 // VARIABLE MANIPULATION SYSTEM
8329 //-----------------------------
8330 int NameToID(string name)
8331 {
8332 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8333 return plugin.GetID(name);
8334 }
8335
8336 string IDToName(int id)
8337 {
8338 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8339 return plugin.GetName(id);
8340 }
8341
8343 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
8344 {
8345 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
8346 //read the flags
8347 int varFlags;
8348 if (!ctx.Read(varFlags))
8349 return;
8350
8351 if (varFlags & ItemVariableFlags.FLOAT)
8352 {
8353 ReadVarsFromCTX(ctx);
8354 }
8355 }
8356
8357 override void SerializeNumericalVars(array<float> floats_out)
8358 {
8359 //some variables handled on EntityAI level already!
8360 super.SerializeNumericalVars(floats_out);
8361
8362 // the order of serialization must be the same as the order of de-serialization
8363 //--------------------------------------------
8364 if (IsVariableSet(VARIABLE_QUANTITY))
8365 {
8366 floats_out.Insert(m_VarQuantity);
8367 }
8368 //--------------------------------------------
8369 if (IsVariableSet(VARIABLE_WET))
8370 {
8371 floats_out.Insert(m_VarWet);
8372 }
8373 //--------------------------------------------
8374 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8375 {
8376 floats_out.Insert(m_VarLiquidType);
8377 }
8378 //--------------------------------------------
8379 if (IsVariableSet(VARIABLE_COLOR))
8380 {
8381 floats_out.Insert(m_ColorComponentR);
8382 floats_out.Insert(m_ColorComponentG);
8383 floats_out.Insert(m_ColorComponentB);
8384 floats_out.Insert(m_ColorComponentA);
8385 }
8386 //--------------------------------------------
8387 if (IsVariableSet(VARIABLE_CLEANNESS))
8388 {
8389 floats_out.Insert(m_Cleanness);
8390 }
8391 }
8392
8393 override void DeSerializeNumericalVars(array<float> floats)
8394 {
8395 //some variables handled on EntityAI level already!
8396 super.DeSerializeNumericalVars(floats);
8397
8398 // the order of serialization must be the same as the order of de-serialization
8399 int index = 0;
8400 int mask = Math.Round(floats.Get(index));
8401
8402 index++;
8403 //--------------------------------------------
8404 if (mask & VARIABLE_QUANTITY)
8405 {
8406 if (m_IsStoreLoad)
8407 {
8408 SetStoreLoadedQuantity(floats.Get(index));
8409 }
8410 else
8411 {
8412 float quantity = floats.Get(index);
8413 SetQuantity(quantity, true, false, false, false);
8414 }
8415 index++;
8416 }
8417 //--------------------------------------------
8418 if (mask & VARIABLE_WET)
8419 {
8420 float wet = floats.Get(index);
8421 SetWet(wet);
8422 index++;
8423 }
8424 //--------------------------------------------
8425 if (mask & VARIABLE_LIQUIDTYPE)
8426 {
8427 int liquidtype = Math.Round(floats.Get(index));
8428 SetLiquidType(liquidtype);
8429 index++;
8430 }
8431 //--------------------------------------------
8432 if (mask & VARIABLE_COLOR)
8433 {
8434 m_ColorComponentR = Math.Round(floats.Get(index));
8435 index++;
8436 m_ColorComponentG = Math.Round(floats.Get(index));
8437 index++;
8438 m_ColorComponentB = Math.Round(floats.Get(index));
8439 index++;
8440 m_ColorComponentA = Math.Round(floats.Get(index));
8441 index++;
8442 }
8443 //--------------------------------------------
8444 if (mask & VARIABLE_CLEANNESS)
8445 {
8446 int cleanness = Math.Round(floats.Get(index));
8447 SetCleanness(cleanness);
8448 index++;
8449 }
8450 }
8451
8452 override void WriteVarsToCTX(ParamsWriteContext ctx)
8453 {
8454 super.WriteVarsToCTX(ctx);
8455
8456 //--------------------------------------------
8457 if (IsVariableSet(VARIABLE_QUANTITY))
8458 {
8459 ctx.Write(GetQuantity());
8460 }
8461 //--------------------------------------------
8462 if (IsVariableSet(VARIABLE_WET))
8463 {
8464 ctx.Write(GetWet());
8465 }
8466 //--------------------------------------------
8467 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8468 {
8469 ctx.Write(GetLiquidType());
8470 }
8471 //--------------------------------------------
8472 if (IsVariableSet(VARIABLE_COLOR))
8473 {
8474 int r,g,b,a;
8475 GetColor(r,g,b,a);
8476 ctx.Write(r);
8477 ctx.Write(g);
8478 ctx.Write(b);
8479 ctx.Write(a);
8480 }
8481 //--------------------------------------------
8482 if (IsVariableSet(VARIABLE_CLEANNESS))
8483 {
8484 ctx.Write(GetCleanness());
8485 }
8486 }
8487
8488 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
8489 {
8490 if (!super.ReadVarsFromCTX(ctx,version))
8491 return false;
8492
8493 int intValue;
8494 float value;
8495
8496 if (version < 140)
8497 {
8498 if (!ctx.Read(intValue))
8499 return false;
8500
8501 m_VariablesMask = intValue;
8502 }
8503
8504 if (m_VariablesMask & VARIABLE_QUANTITY)
8505 {
8506 if (!ctx.Read(value))
8507 return false;
8508
8509 if (IsStoreLoad())
8510 {
8512 }
8513 else
8514 {
8515 SetQuantity(value, true, false, false, false);
8516 }
8517 }
8518 //--------------------------------------------
8519 if (version < 140)
8520 {
8521 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8522 {
8523 if (!ctx.Read(value))
8524 return false;
8525 SetTemperatureDirect(value);
8526 }
8527 }
8528 //--------------------------------------------
8529 if (m_VariablesMask & VARIABLE_WET)
8530 {
8531 if (!ctx.Read(value))
8532 return false;
8533 SetWet(value);
8534 }
8535 //--------------------------------------------
8536 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
8537 {
8538 if (!ctx.Read(intValue))
8539 return false;
8540 SetLiquidType(intValue);
8541 }
8542 //--------------------------------------------
8543 if (m_VariablesMask & VARIABLE_COLOR)
8544 {
8545 int r,g,b,a;
8546 if (!ctx.Read(r))
8547 return false;
8548 if (!ctx.Read(g))
8549 return false;
8550 if (!ctx.Read(b))
8551 return false;
8552 if (!ctx.Read(a))
8553 return false;
8554
8555 SetColor(r,g,b,a);
8556 }
8557 //--------------------------------------------
8558 if (m_VariablesMask & VARIABLE_CLEANNESS)
8559 {
8560 if (!ctx.Read(intValue))
8561 return false;
8562 SetCleanness(intValue);
8563 }
8564 //--------------------------------------------
8565 if (version >= 138 && version < 140)
8566 {
8567 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8568 {
8569 if (!ctx.Read(intValue))
8570 return false;
8571 SetFrozen(intValue);
8572 }
8573 }
8574
8575 return true;
8576 }
8577
8578 //----------------------------------------------------------------
8579 override bool OnStoreLoad(ParamsReadContext ctx, int version)
8580 {
8581 m_IsStoreLoad = true;
8583 {
8584 m_FixDamageSystemInit = true;
8585 }
8586
8587 if (!super.OnStoreLoad(ctx, version))
8588 {
8589 m_IsStoreLoad = false;
8590 return false;
8591 }
8592
8593 if (version >= 114)
8594 {
8595 bool hasQuickBarIndexSaved;
8596
8597 if (!ctx.Read(hasQuickBarIndexSaved))
8598 {
8599 m_IsStoreLoad = false;
8600 return false;
8601 }
8602
8603 if (hasQuickBarIndexSaved)
8604 {
8605 int itmQBIndex;
8606
8607 //Load quickbar item bind
8608 if (!ctx.Read(itmQBIndex))
8609 {
8610 m_IsStoreLoad = false;
8611 return false;
8612 }
8613
8614 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8615 if (itmQBIndex != -1 && parentPlayer)
8616 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8617 }
8618 }
8619 else
8620 {
8621 // Backup of how it used to be
8622 PlayerBase player;
8623 int itemQBIndex;
8624 if (version == int.MAX)
8625 {
8626 if (!ctx.Read(itemQBIndex))
8627 {
8628 m_IsStoreLoad = false;
8629 return false;
8630 }
8631 }
8632 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8633 {
8634 //Load quickbar item bind
8635 if (!ctx.Read(itemQBIndex))
8636 {
8637 m_IsStoreLoad = false;
8638 return false;
8639 }
8640 if (itemQBIndex != -1 && player)
8641 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8642 }
8643 }
8644
8645 if (version < 140)
8646 {
8647 // variable management system
8648 if (!LoadVariables(ctx, version))
8649 {
8650 m_IsStoreLoad = false;
8651 return false;
8652 }
8653 }
8654
8655 //agent trasmission system
8656 if (!LoadAgents(ctx, version))
8657 {
8658 m_IsStoreLoad = false;
8659 return false;
8660 }
8661 if (version >= 132)
8662 {
8663 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8664 if (raib)
8665 {
8666 if (!raib.OnStoreLoad(ctx,version))
8667 {
8668 m_IsStoreLoad = false;
8669 return false;
8670 }
8671 }
8672 }
8673
8674 m_IsStoreLoad = false;
8675 return true;
8676 }
8677
8678 //----------------------------------------------------------------
8679
8680 override void OnStoreSave(ParamsWriteContext ctx)
8681 {
8682 super.OnStoreSave(ctx);
8683
8684 PlayerBase player;
8685 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8686 {
8687 ctx.Write(true); // Keep track of if we should actually read this in or not
8688 //Save quickbar item bind
8689 int itemQBIndex = -1;
8690 itemQBIndex = player.FindQuickBarEntityIndex(this);
8691 ctx.Write(itemQBIndex);
8692 }
8693 else
8694 {
8695 ctx.Write(false); // Keep track of if we should actually read this in or not
8696 }
8697
8698 SaveAgents(ctx);//agent trasmission system
8699
8700 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8701 if (raib)
8702 {
8703 raib.OnStoreSave(ctx);
8704 }
8705 }
8706 //----------------------------------------------------------------
8707
8708 override void AfterStoreLoad()
8709 {
8710 super.AfterStoreLoad();
8711
8713 {
8715 }
8716
8717 if (GetStoreLoadedQuantity() != float.LOWEST)
8718 {
8720 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
8721 }
8722 }
8723
8724 override void EEOnAfterLoad()
8725 {
8726 super.EEOnAfterLoad();
8727
8729 {
8730 m_FixDamageSystemInit = false;
8731 }
8732
8735 }
8736
8737 bool CanBeDisinfected()
8738 {
8739 return false;
8740 }
8741
8742
8743 //----------------------------------------------------------------
8744 override void OnVariablesSynchronized()
8745 {
8746 if (m_Initialized)
8747 {
8748 #ifdef PLATFORM_CONSOLE
8749 //bruteforce it is
8750 if (IsSplitable())
8751 {
8752 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
8753 if (menu)
8754 {
8755 menu.Refresh();
8756 }
8757 }
8758 #endif
8759 }
8760
8762 {
8763 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8764 m_WantPlayImpactSound = false;
8765 }
8766
8768 {
8769 SetWeightDirty();
8771 }
8772 if (m_VarWet != m_VarWetPrev)
8773 {
8776 }
8777
8778 if (m_SoundSyncPlay != 0)
8779 {
8780 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
8781 m_SoundSyncPlay = 0;
8782 }
8783 if (m_SoundSyncStop != 0)
8784 {
8785 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
8786 m_SoundSyncStop = 0;
8787 }
8788
8789 super.OnVariablesSynchronized();
8790 }
8791
8792 //------------------------- Quantity
8793 //----------------------------------------------------------------
8795 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
8796 {
8797 if (!IsServerCheck(allow_client))
8798 return false;
8799
8800 if (!HasQuantity())
8801 return false;
8802
8803 float min = GetQuantityMin();
8804 float max = GetQuantityMax();
8805
8806 if (value <= (min + 0.001))
8807 value = min;
8808
8809 if (value == min)
8810 {
8811 if (destroy_config)
8812 {
8813 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8814 if (dstr)
8815 {
8816 m_VarQuantity = Math.Clamp(value, min, max);
8817 this.Delete();
8818 return true;
8819 }
8820 }
8821 else if (destroy_forced)
8822 {
8823 m_VarQuantity = Math.Clamp(value, min, max);
8824 this.Delete();
8825 return true;
8826 }
8827 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
8828 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
8829 }
8830
8831 float delta = m_VarQuantity;
8832 m_VarQuantity = Math.Clamp(value, min, max);
8833
8834 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
8835 {
8836 delta = m_VarQuantity - delta;
8837
8838 if (delta)
8839 OnQuantityChanged(delta);
8840 }
8841
8842 SetVariableMask(VARIABLE_QUANTITY);
8843
8844 return false;
8845 }
8846
8847 //----------------------------------------------------------------
8849 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
8850 {
8851 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
8852 }
8853 //----------------------------------------------------------------
8854 void SetQuantityMax()
8855 {
8856 float max = GetQuantityMax();
8857 SetQuantity(max);
8858 }
8859
8860 override void SetQuantityToMinimum()
8861 {
8862 float min = GetQuantityMin();
8863 SetQuantity(min);
8864 }
8865 //----------------------------------------------------------------
8867 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
8868 {
8869 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
8870 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
8871 SetQuantity(result, destroy_config, destroy_forced);
8872 }
8873
8874 //----------------------------------------------------------------
8876 override float GetQuantityNormalized()
8877 {
8878 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
8879 }
8880
8882 {
8883 return GetQuantityNormalized();
8884 }
8885
8886 /*void SetAmmoNormalized(float value)
8887 {
8888 float value_clamped = Math.Clamp(value, 0, 1);
8889 Magazine this_mag = Magazine.Cast(this);
8890 int max_rounds = this_mag.GetAmmoMax();
8891 int result = value * max_rounds;//can the rounded if higher precision is required
8892 this_mag.SetAmmoCount(result);
8893 }*/
8894 //----------------------------------------------------------------
8895 override int GetQuantityMax()
8896 {
8897 int slot = -1;
8898 if (GetInventory())
8899 {
8900 InventoryLocation il = new InventoryLocation;
8901 GetInventory().GetCurrentInventoryLocation(il);
8902 slot = il.GetSlot();
8903 }
8904
8905 return GetTargetQuantityMax(slot);
8906 }
8907
8908 override int GetTargetQuantityMax(int attSlotID = -1)
8909 {
8910 float quantity_max = 0;
8911
8912 if (IsSplitable()) //only stackable/splitable items can check for stack size
8913 {
8914 if (attSlotID != -1)
8915 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8916
8917 if (quantity_max <= 0)
8918 quantity_max = m_VarStackMax;
8919 }
8920
8921 if (quantity_max <= 0)
8922 quantity_max = m_VarQuantityMax;
8923
8924 return quantity_max;
8925 }
8926 //----------------------------------------------------------------
8927 override int GetQuantityMin()
8928 {
8929 return m_VarQuantityMin;
8930 }
8931 //----------------------------------------------------------------
8932 int GetQuantityInit()
8933 {
8934 return m_VarQuantityInit;
8935 }
8936
8937 //----------------------------------------------------------------
8938 override bool HasQuantity()
8939 {
8940 return !(GetQuantityMax() - GetQuantityMin() == 0);
8941 }
8942
8943 override float GetQuantity()
8944 {
8945 return m_VarQuantity;
8946 }
8947
8948 bool IsFullQuantity()
8949 {
8950 return GetQuantity() >= GetQuantityMax();
8951 }
8952
8953 //Calculates weight of single item without attachments and cargo
8954 override float GetSingleInventoryItemWeightEx()
8955 {
8956 //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
8957 float weightEx = GetWeightEx();//overall weight of the item
8958 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
8959 return weightEx - special;
8960 }
8961
8962 // Obsolete, use GetSingleInventoryItemWeightEx() instead
8964 {
8966 }
8967
8968 override protected float GetWeightSpecialized(bool forceRecalc = false)
8969 {
8970 if (IsSplitable()) //quantity determines size of the stack
8971 {
8972 #ifdef DEVELOPER
8973 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8974 {
8975 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8976 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
8977 }
8978 #endif
8979
8980 return GetQuantity() * GetConfigWeightModified();
8981 }
8982 else if (HasEnergyManager())// items with energy manager
8983 {
8984 #ifdef DEVELOPER
8985 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8986 {
8987 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8988 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
8989 }
8990 #endif
8991 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
8992 }
8993 else//everything else
8994 {
8995 #ifdef DEVELOPER
8996 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8997 {
8998 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8999 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
9000 }
9001 #endif
9002 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
9003 }
9004 }
9005
9007 int GetNumberOfItems()
9008 {
9009 int item_count = 0;
9010 ItemBase item;
9011
9012 if (GetInventory().GetCargo() != NULL)
9013 {
9014 item_count = GetInventory().GetCargo().GetItemCount();
9015 }
9016
9017 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9018 {
9019 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9020 if (item)
9021 item_count += item.GetNumberOfItems();
9022 }
9023 return item_count;
9024 }
9025
9027 float GetUnitWeight(bool include_wetness = true)
9028 {
9029 float weight = 0;
9030 float wetness = 1;
9031 if (include_wetness)
9032 wetness += GetWet();
9033 if (IsSplitable()) //quantity determines size of the stack
9034 {
9035 weight = wetness * m_ConfigWeight;
9036 }
9037 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
9038 {
9039 weight = 1;
9040 }
9041 return weight;
9042 }
9043
9044 //-----------------------------------------------------------------
9045
9046 override void ClearInventory()
9047 {
9048 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
9049 {
9050 GameInventory inv = GetInventory();
9051 array<EntityAI> items = new array<EntityAI>;
9052 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
9053 for (int i = 0; i < items.Count(); i++)
9054 {
9055 ItemBase item = ItemBase.Cast(items.Get(i));
9056 if (item)
9057 {
9058 GetGame().ObjectDelete(item);
9059 }
9060 }
9061 }
9062 }
9063
9064 //------------------------- Energy
9065
9066 //----------------------------------------------------------------
9067 float GetEnergy()
9068 {
9069 float energy = 0;
9070 if (HasEnergyManager())
9071 {
9072 energy = GetCompEM().GetEnergy();
9073 }
9074 return energy;
9075 }
9076
9077
9078 override void OnEnergyConsumed()
9079 {
9080 super.OnEnergyConsumed();
9081
9083 }
9084
9085 override void OnEnergyAdded()
9086 {
9087 super.OnEnergyAdded();
9088
9090 }
9091
9092 // Converts energy (from Energy Manager) to quantity, if enabled.
9094 {
9095 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9096 {
9097 if (HasQuantity())
9098 {
9099 float energy_0to1 = GetCompEM().GetEnergy0To1();
9100 SetQuantityNormalized(energy_0to1);
9101 }
9102 }
9103 }
9104
9105 //----------------------------------------------------------------
9106 float GetHeatIsolationInit()
9107 {
9108 return ConfigGetFloat("heatIsolation");
9109 }
9110
9111 float GetHeatIsolation()
9112 {
9113 return m_HeatIsolation;
9114 }
9115
9116 float GetDryingIncrement(string pIncrementName)
9117 {
9118 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
9119 if (GetGame().ConfigIsExisting(paramPath))
9120 return GetGame().ConfigGetFloat(paramPath);
9121
9122 return 0.0;
9123 }
9124
9125 float GetSoakingIncrement(string pIncrementName)
9126 {
9127 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
9128 if (GetGame().ConfigIsExisting(paramPath))
9129 return GetGame().ConfigGetFloat(paramPath);
9130
9131 return 0.0;
9132 }
9133 //----------------------------------------------------------------
9134 override void SetWet(float value, bool allow_client = false)
9135 {
9136 if (!IsServerCheck(allow_client))
9137 return;
9138
9139 float min = GetWetMin();
9140 float max = GetWetMax();
9141
9142 float previousValue = m_VarWet;
9143
9144 m_VarWet = Math.Clamp(value, min, max);
9145
9146 if (previousValue != m_VarWet)
9147 {
9148 SetVariableMask(VARIABLE_WET);
9149 OnWetChanged(m_VarWet, previousValue);
9150 }
9151 }
9152 //----------------------------------------------------------------
9153 override void AddWet(float value)
9154 {
9155 SetWet(GetWet() + value);
9156 }
9157 //----------------------------------------------------------------
9158 override void SetWetMax()
9159 {
9161 }
9162 //----------------------------------------------------------------
9163 override float GetWet()
9164 {
9165 return m_VarWet;
9166 }
9167 //----------------------------------------------------------------
9168 override float GetWetMax()
9169 {
9170 return m_VarWetMax;
9171 }
9172 //----------------------------------------------------------------
9173 override float GetWetMin()
9174 {
9175 return m_VarWetMin;
9176 }
9177 //----------------------------------------------------------------
9178 override float GetWetInit()
9179 {
9180 return m_VarWetInit;
9181 }
9182 //----------------------------------------------------------------
9183 override void OnWetChanged(float newVal, float oldVal)
9184 {
9185 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
9186 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
9187 if (newLevel != oldLevel)
9188 {
9189 OnWetLevelChanged(newLevel,oldLevel);
9190 }
9191 }
9192
9193 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
9194 {
9195 SetWeightDirty();
9196 }
9197
9198 override EWetnessLevel GetWetLevel()
9199 {
9200 return GetWetLevelInternal(m_VarWet);
9201 }
9202
9203 //----------------------------------------------------------------
9204
9205 override void SetStoreLoad(bool value)
9206 {
9207 m_IsStoreLoad = value;
9208 }
9209
9210 override bool IsStoreLoad()
9211 {
9212 return m_IsStoreLoad;
9213 }
9214
9215 override void SetStoreLoadedQuantity(float value)
9216 {
9217 m_StoreLoadedQuantity = value;
9218 }
9219
9220 override float GetStoreLoadedQuantity()
9221 {
9222 return m_StoreLoadedQuantity;
9223 }
9224
9225 //----------------------------------------------------------------
9226
9227 float GetItemModelLength()
9228 {
9229 if (ConfigIsExisting("itemModelLength"))
9230 {
9231 return ConfigGetFloat("itemModelLength");
9232 }
9233 return 0;
9234 }
9235
9236 float GetItemAttachOffset()
9237 {
9238 if (ConfigIsExisting("itemAttachOffset"))
9239 {
9240 return ConfigGetFloat("itemAttachOffset");
9241 }
9242 return 0;
9243 }
9244
9245 override void SetCleanness(int value, bool allow_client = false)
9246 {
9247 if (!IsServerCheck(allow_client))
9248 return;
9249
9250 int previousValue = m_Cleanness;
9251
9252 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
9253
9254 if (previousValue != m_Cleanness)
9255 SetVariableMask(VARIABLE_CLEANNESS);
9256 }
9257
9258 override int GetCleanness()
9259 {
9260 return m_Cleanness;
9261 }
9262
9264 {
9265 return true;
9266 }
9267
9268 //----------------------------------------------------------------
9269 // ATTACHMENT LOCKING
9270 // Getters relevant to generic ActionLockAttachment
9271 int GetLockType()
9272 {
9273 return m_LockType;
9274 }
9275
9276 string GetLockSoundSet()
9277 {
9278 return m_LockSoundSet;
9279 }
9280
9281 //----------------------------------------------------------------
9282 //------------------------- Color
9283 // sets items color variable given color components
9284 override void SetColor(int r, int g, int b, int a)
9285 {
9290 SetVariableMask(VARIABLE_COLOR);
9291 }
9293 override void GetColor(out int r,out int g,out int b,out int a)
9294 {
9299 }
9300
9301 bool IsColorSet()
9302 {
9303 return IsVariableSet(VARIABLE_COLOR);
9304 }
9305
9307 string GetColorString()
9308 {
9309 int r,g,b,a;
9310 GetColor(r,g,b,a);
9311 r = r/255;
9312 g = g/255;
9313 b = b/255;
9314 a = a/255;
9315 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9316 }
9317 //----------------------------------------------------------------
9318 //------------------------- LiquidType
9319
9320 override void SetLiquidType(int value, bool allow_client = false)
9321 {
9322 if (!IsServerCheck(allow_client))
9323 return;
9324
9325 int old = m_VarLiquidType;
9326 m_VarLiquidType = value;
9327 OnLiquidTypeChanged(old,value);
9328 SetVariableMask(VARIABLE_LIQUIDTYPE);
9329 }
9330
9331 int GetLiquidTypeInit()
9332 {
9333 return ConfigGetInt("varLiquidTypeInit");
9334 }
9335
9336 override int GetLiquidType()
9337 {
9338 return m_VarLiquidType;
9339 }
9340
9341 protected void OnLiquidTypeChanged(int oldType, int newType)
9342 {
9343 if (newType == LIQUID_NONE && GetIsFrozen())
9344 SetFrozen(false);
9345 }
9346
9348 void UpdateQuickbarShortcutVisibility(PlayerBase player)
9349 {
9350 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9351 }
9352
9353 // -------------------------------------------------------------------------
9355 void OnInventoryEnter(Man player)
9356 {
9357 PlayerBase nplayer;
9358 if (PlayerBase.CastTo(nplayer, player))
9359 {
9360 m_CanPlayImpactSound = true;
9361 //nplayer.OnItemInventoryEnter(this);
9362 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9363 }
9364 }
9365
9366 // -------------------------------------------------------------------------
9368 void OnInventoryExit(Man player)
9369 {
9370 PlayerBase nplayer;
9371 if (PlayerBase.CastTo(nplayer,player))
9372 {
9373 //nplayer.OnItemInventoryExit(this);
9374 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9375
9376 }
9377
9378 //if (!GetGame().IsDedicatedServer())
9379 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9380
9381
9382 if (HasEnergyManager())
9383 {
9384 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
9385 }
9386 }
9387
9388 // ADVANCED PLACEMENT EVENTS
9389 override void OnPlacementStarted(Man player)
9390 {
9391 super.OnPlacementStarted(player);
9392
9393 SetTakeable(false);
9394 }
9395
9396 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
9397 {
9398 if (m_AdminLog)
9399 {
9400 m_AdminLog.OnPlacementComplete(player, this);
9401 }
9402
9403 super.OnPlacementComplete(player, position, orientation);
9404 }
9405
9406 //-----------------------------
9407 // AGENT SYSTEM
9408 //-----------------------------
9409 //--------------------------------------------------------------------------
9410 bool ContainsAgent(int agent_id)
9411 {
9412 if (agent_id & m_AttachedAgents)
9413 {
9414 return true;
9415 }
9416 else
9417 {
9418 return false;
9419 }
9420 }
9421
9422 //--------------------------------------------------------------------------
9423 override void RemoveAgent(int agent_id)
9424 {
9425 if (ContainsAgent(agent_id))
9426 {
9427 m_AttachedAgents = ~agent_id & m_AttachedAgents;
9428 }
9429 }
9430
9431 //--------------------------------------------------------------------------
9432 override void RemoveAllAgents()
9433 {
9434 m_AttachedAgents = 0;
9435 }
9436 //--------------------------------------------------------------------------
9437 override void RemoveAllAgentsExcept(int agent_to_keep)
9438 {
9439 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
9440 }
9441 // -------------------------------------------------------------------------
9442 override void InsertAgent(int agent, float count = 1)
9443 {
9444 if (count < 1)
9445 return;
9446 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
9448 }
9449
9451 void TransferAgents(int agents)
9452 {
9454 }
9455
9456 // -------------------------------------------------------------------------
9457 override int GetAgents()
9458 {
9459 return m_AttachedAgents;
9460 }
9461 //----------------------------------------------------------------------
9462
9463 /*int GetContaminationType()
9464 {
9465 int contamination_type;
9466
9467 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
9468 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
9469 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
9470 const int DIRTY_MASK = eAgents.WOUND_AGENT;
9471
9472 Edible_Base edible = Edible_Base.Cast(this);
9473 int agents = GetAgents();
9474 if (edible)
9475 {
9476 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
9477 if (profile)
9478 {
9479 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
9480 }
9481 }
9482 if (agents & CONTAMINATED_MASK)
9483 {
9484 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
9485 }
9486 if (agents & POISONED_MASK)
9487 {
9488 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
9489 }
9490 if (agents & NERVE_GAS_MASK)
9491 {
9492 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
9493 }
9494 if (agents & DIRTY_MASK)
9495 {
9496 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
9497 }
9498
9499 return agents;
9500 }*/
9501
9502 // -------------------------------------------------------------------------
9503 bool LoadAgents(ParamsReadContext ctx, int version)
9504 {
9505 if (!ctx.Read(m_AttachedAgents))
9506 return false;
9507 return true;
9508 }
9509 // -------------------------------------------------------------------------
9511 {
9512
9514 }
9515 // -------------------------------------------------------------------------
9516
9518 override void CheckForRoofLimited(float timeTresholdMS = 3000)
9519 {
9520 super.CheckForRoofLimited(timeTresholdMS);
9521
9522 float time = GetGame().GetTime();
9523 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9524 {
9525 m_PreviousRoofTestTime = time;
9526 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9527 }
9528 }
9529
9530 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
9531 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
9532 {
9533 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
9534 {
9535 return 0;
9536 }
9537
9538 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
9539 {
9540 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
9541 if (filter)
9542 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
9543 else
9544 return 0;//otherwise return 0 when no filter attached
9545 }
9546
9547 string subclassPath, entryName;
9548
9549 switch (type)
9550 {
9551 case DEF_BIOLOGICAL:
9552 entryName = "biological";
9553 break;
9554 case DEF_CHEMICAL:
9555 entryName = "chemical";
9556 break;
9557 default:
9558 entryName = "biological";
9559 break;
9560 }
9561
9562 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
9563
9564 return GetGame().ConfigGetFloat(subclassPath + entryName);
9565 }
9566
9567
9568
9570 override void EEOnCECreate()
9571 {
9572 if (!IsMagazine())
9574
9576 }
9577
9578
9579 //-------------------------
9580 // OPEN/CLOSE USER ACTIONS
9581 //-------------------------
9583 void Open();
9584 void Close();
9585 bool IsOpen()
9586 {
9587 return true;
9588 }
9589
9590 override bool CanDisplayCargo()
9591 {
9592 return IsOpen();
9593 }
9594
9595
9596 // ------------------------------------------------------------
9597 // CONDITIONS
9598 // ------------------------------------------------------------
9599 override bool CanPutInCargo(EntityAI parent)
9600 {
9601 if (parent)
9602 {
9603 if (parent.IsInherited(DayZInfected))
9604 return true;
9605
9606 if (!parent.IsRuined())
9607 return true;
9608 }
9609
9610 return true;
9611 }
9612
9613 override bool CanPutAsAttachment(EntityAI parent)
9614 {
9615 if (!super.CanPutAsAttachment(parent))
9616 {
9617 return false;
9618 }
9619
9620 if (!IsRuined() && !parent.IsRuined())
9621 {
9622 return true;
9623 }
9624
9625 return false;
9626 }
9627
9628 override bool CanReceiveItemIntoCargo(EntityAI item)
9629 {
9630 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9631 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9632 // return false;
9633
9634 return super.CanReceiveItemIntoCargo(item);
9635 }
9636
9637 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
9638 {
9639 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9640 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9641 // return false;
9642
9643 GameInventory attachmentInv = attachment.GetInventory();
9644 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9645 {
9646 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9647 return false;
9648 }
9649
9650 InventoryLocation loc = new InventoryLocation();
9651 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9652 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
9653 return false;
9654
9655 return super.CanReceiveAttachment(attachment, slotId);
9656 }
9657
9658 override bool CanReleaseAttachment(EntityAI attachment)
9659 {
9660 if (!super.CanReleaseAttachment(attachment))
9661 return false;
9662
9663 return GetInventory().AreChildrenAccessible();
9664 }
9665
9666 /*override bool CanLoadAttachment(EntityAI attachment)
9667 {
9668 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9669 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9670 // return false;
9671
9672 GameInventory attachmentInv = attachment.GetInventory();
9673 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9674 {
9675 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
9676 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
9677
9678 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9679 return false;
9680 }
9681
9682 return super.CanLoadAttachment(attachment);
9683 }*/
9684
9685 // Plays muzzle flash particle effects
9686 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9687 {
9688 int id = muzzle_owner.GetMuzzleID();
9689 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
9690
9691 if (WPOF_array)
9692 {
9693 for (int i = 0; i < WPOF_array.Count(); i++)
9694 {
9695 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9696
9697 if (WPOF)
9698 {
9699 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9700 }
9701 }
9702 }
9703 }
9704
9705 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
9706 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9707 {
9708 int id = muzzle_owner.GetMuzzleID();
9709 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
9710
9711 if (WPOBE_array)
9712 {
9713 for (int i = 0; i < WPOBE_array.Count(); i++)
9714 {
9715 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9716
9717 if (WPOBE)
9718 {
9719 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9720 }
9721 }
9722 }
9723 }
9724
9725 // Plays all weapon overheating particles
9726 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9727 {
9728 int id = muzzle_owner.GetMuzzleID();
9729 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9730
9731 if (WPOOH_array)
9732 {
9733 for (int i = 0; i < WPOOH_array.Count(); i++)
9734 {
9735 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9736
9737 if (WPOOH)
9738 {
9739 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9740 }
9741 }
9742 }
9743 }
9744
9745 // Updates all weapon overheating particles
9746 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9747 {
9748 int id = muzzle_owner.GetMuzzleID();
9749 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9750
9751 if (WPOOH_array)
9752 {
9753 for (int i = 0; i < WPOOH_array.Count(); i++)
9754 {
9755 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9756
9757 if (WPOOH)
9758 {
9759 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9760 }
9761 }
9762 }
9763 }
9764
9765 // Stops overheating particles
9766 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9767 {
9768 int id = muzzle_owner.GetMuzzleID();
9769 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9770
9771 if (WPOOH_array)
9772 {
9773 for (int i = 0; i < WPOOH_array.Count(); i++)
9774 {
9775 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9776
9777 if (WPOOH)
9778 {
9779 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9780 }
9781 }
9782 }
9783 }
9784
9785 //----------------------------------------------------------------
9786 //Item Behaviour - unified approach
9787 override bool IsHeavyBehaviour()
9788 {
9789 if (m_ItemBehaviour == 0)
9790 {
9791 return true;
9792 }
9793
9794 return false;
9795 }
9796
9797 override bool IsOneHandedBehaviour()
9798 {
9799 if (m_ItemBehaviour == 1)
9800 {
9801 return true;
9802 }
9803
9804 return false;
9805 }
9806
9807 override bool IsTwoHandedBehaviour()
9808 {
9809 if (m_ItemBehaviour == 2)
9810 {
9811 return true;
9812 }
9813
9814 return false;
9815 }
9816
9817 bool IsDeployable()
9818 {
9819 return false;
9820 }
9821
9823 float GetDeployTime()
9824 {
9825 return UATimeSpent.DEFAULT_DEPLOY;
9826 }
9827
9828
9829 //----------------------------------------------------------------
9830 // Item Targeting (User Actions)
9831 override void SetTakeable(bool pState)
9832 {
9833 m_IsTakeable = pState;
9834 SetSynchDirty();
9835 }
9836
9837 override bool IsTakeable()
9838 {
9839 return m_IsTakeable;
9840 }
9841
9842 // For cases where we want to show object widget which cant be taken to hands
9844 {
9845 return false;
9846 }
9847
9849 protected void PreLoadSoundAttachmentType()
9850 {
9851 string att_type = "None";
9852
9853 if (ConfigIsExisting("soundAttType"))
9854 {
9855 att_type = ConfigGetString("soundAttType");
9856 }
9857
9858 m_SoundAttType = att_type;
9859 }
9860
9861 override string GetAttachmentSoundType()
9862 {
9863 return m_SoundAttType;
9864 }
9865
9866 //----------------------------------------------------------------
9867 //SOUNDS - ItemSoundHandler
9868 //----------------------------------------------------------------
9869
9870 string GetPlaceSoundset(); // played when deploy starts
9871 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
9872 string GetDeploySoundset(); // played when deploy sucessfully finishes
9873
9875 {
9876 if (!m_ItemSoundHandler)
9878
9879 return m_ItemSoundHandler;
9880 }
9881
9882 // override to initialize sounds
9883 protected void InitItemSounds()
9884 {
9885 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
9886 return;
9887
9889
9890 if (GetPlaceSoundset() != string.Empty)
9891 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
9892
9893 if (GetDeploySoundset() != string.Empty)
9894 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
9895
9896 SoundParameters params = new SoundParameters();
9897 params.m_Loop = true;
9898 if (GetLoopDeploySoundset() != string.Empty)
9899 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
9900 }
9901
9902 // Start sound using ItemSoundHandler
9903 void StartItemSoundServer(int id)
9904 {
9905 if (!GetGame().IsServer())
9906 return;
9907
9908 m_SoundSyncPlay = id;
9909 SetSynchDirty();
9910
9911 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
9913 }
9914
9915 // Stop sound using ItemSoundHandler
9916 void StopItemSoundServer(int id)
9917 {
9918 if (!GetGame().IsServer())
9919 return;
9920
9921 m_SoundSyncStop = id;
9922 SetSynchDirty();
9923
9924 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
9926 }
9927
9928 protected void ClearStartItemSoundServer()
9929 {
9930 m_SoundSyncPlay = 0;
9931 }
9932
9933 protected void ClearStopItemSoundServer()
9934 {
9935 m_SoundSyncStop = 0;
9936 }
9937
9939 void PlayAttachSound(string slot_type)
9940 {
9941 if (!GetGame().IsDedicatedServer())
9942 {
9943 if (ConfigIsExisting("attachSoundSet"))
9944 {
9945 string cfg_path = "";
9946 string soundset = "";
9947 string type_name = GetType();
9948
9949 TStringArray cfg_soundset_array = new TStringArray;
9950 TStringArray cfg_slot_array = new TStringArray;
9951 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9952 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9953
9954 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9955 {
9956 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9957 {
9958 if (cfg_slot_array[i] == slot_type)
9959 {
9960 soundset = cfg_soundset_array[i];
9961 break;
9962 }
9963 }
9964 }
9965
9966 if (soundset != "")
9967 {
9968 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
9969 sound.SetAutodestroy(true);
9970 }
9971 }
9972 }
9973 }
9974
9975 void PlayDetachSound(string slot_type)
9976 {
9977 //TODO - evaluate if needed and devise universal config structure if so
9978 }
9979
9980 void OnApply(PlayerBase player);
9981
9983 {
9984 return 1.0;
9985 };
9986 //returns applicable selection
9987 array<string> GetHeadHidingSelection()
9988 {
9990 }
9991
9993 {
9995 }
9996
9997 WrittenNoteData GetWrittenNoteData() {};
9998
10000 {
10001 SetDynamicPhysicsLifeTime(0.01);
10002 m_ItemBeingDroppedPhys = false;
10003 }
10004
10006 {
10007 array<string> zone_names = new array<string>;
10008 GetDamageZones(zone_names);
10009 for (int i = 0; i < zone_names.Count(); i++)
10010 {
10011 SetHealthMax(zone_names.Get(i),"Health");
10012 }
10013 SetHealthMax("","Health");
10014 }
10015
10017 void SetZoneDamageCEInit()
10018 {
10019 float global_health = GetHealth01("","Health");
10020 array<string> zones = new array<string>;
10021 GetDamageZones(zones);
10022 //set damage of all zones to match global health level
10023 for (int i = 0; i < zones.Count(); i++)
10024 {
10025 SetHealth01(zones.Get(i),"Health",global_health);
10026 }
10027 }
10028
10030 bool IsCoverFaceForShave(string slot_name)
10031 {
10032 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10033 }
10034
10035 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10036 {
10037 if (!hasRootAsPlayer)
10038 {
10039 if (refParentIB)
10040 {
10041 // parent is wet
10042 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
10043 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10044 // parent has liquid inside
10045 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
10046 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10047 // drying
10048 else if (m_VarWet > m_VarWetMin)
10049 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
10050 }
10051 else
10052 {
10053 // drying on ground or inside non-itembase (car, ...)
10054 if (m_VarWet > m_VarWetMin)
10055 AddWet(-1 * delta * GetDryingIncrement("ground"));
10056 }
10057 }
10058 }
10059
10060 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10061 {
10063 {
10064 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
10065 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10066 {
10067 float heatPermCoef = 1.0;
10068 EntityAI ent = this;
10069 while (ent)
10070 {
10071 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10072 ent = ent.GetHierarchyParent();
10073 }
10074
10075 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10076 }
10077 }
10078 }
10079
10080 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
10081 {
10082 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
10083 EntityAI parent = GetHierarchyParent();
10084 if (!parent)
10085 {
10086 hasParent = false;
10087 hasRootAsPlayer = false;
10088 }
10089 else
10090 {
10091 hasParent = true;
10092 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10093 refParentIB = ItemBase.Cast(parent);
10094 }
10095 }
10096
10097 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
10098 {
10099 // this is stub, implemented on Edible_Base
10100 }
10101
10102 bool CanDecay()
10103 {
10104 // return true used on selected food clases so they can decay
10105 return false;
10106 }
10107
10108 protected bool CanProcessDecay()
10109 {
10110 // this is stub, implemented on Edible_Base class
10111 // used to determine whether it is still necessary for the food to decay
10112 return false;
10113 }
10114
10115 protected bool CanHaveWetness()
10116 {
10117 // return true used on selected items that have a wetness effect
10118 return false;
10119 }
10120
10122 bool CanBeConsumed(ConsumeConditionData data = null)
10123 {
10124 return !GetIsFrozen() && IsOpen();
10125 }
10126
10127 override void ProcessVariables()
10128 {
10129 bool hasParent = false, hasRootAsPlayer = false;
10130 ItemBase refParentIB;
10131
10132 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
10133 bool foodDecay = g_Game.IsFoodDecayEnabled();
10134
10135 if (wwtu || foodDecay)
10136 {
10137 bool processWetness = wwtu && CanHaveWetness();
10138 bool processTemperature = wwtu && CanHaveTemperature();
10139 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
10140
10141 if (processWetness || processTemperature || processDecay)
10142 {
10143 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
10144
10145 if (processWetness)
10146 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10147
10148 if (processTemperature)
10149 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10150
10151 if (processDecay)
10152 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10153 }
10154 }
10155 }
10156
10159 {
10160 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
10161 }
10162
10163 override float GetTemperatureFreezeThreshold()
10164 {
10166 return Liquid.GetFreezeThreshold(GetLiquidType());
10167
10168 return super.GetTemperatureFreezeThreshold();
10169 }
10170
10171 override float GetTemperatureThawThreshold()
10172 {
10174 return Liquid.GetThawThreshold(GetLiquidType());
10175
10176 return super.GetTemperatureThawThreshold();
10177 }
10178
10179 override float GetItemOverheatThreshold()
10180 {
10182 return Liquid.GetBoilThreshold(GetLiquidType());
10183
10184 return super.GetItemOverheatThreshold();
10185 }
10186
10187 override float GetTemperatureFreezeTime()
10188 {
10189 if (HasQuantity())
10190 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
10191
10192 return super.GetTemperatureFreezeTime();
10193 }
10194
10195 override float GetTemperatureThawTime()
10196 {
10197 if (HasQuantity())
10198 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
10199
10200 return super.GetTemperatureThawTime();
10201 }
10202
10204 void AffectLiquidContainerOnFill(int liquid_type, float amount);
10206 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
10207
10208 bool IsCargoException4x3(EntityAI item)
10209 {
10210 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10211 }
10212
10214 {
10215 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10216 }
10217
10219 void AddLightSourceItem(ItemBase lightsource)
10220 {
10221 m_LightSourceItem = lightsource;
10222 }
10223
10225 {
10226 m_LightSourceItem = null;
10227 }
10228
10230 {
10231 return m_LightSourceItem;
10232 }
10233
10235 array<int> GetValidFinishers()
10236 {
10237 return null;
10238 }
10239
10241 bool GetActionWidgetOverride(out typename name)
10242 {
10243 return false;
10244 }
10245
10246 bool PairWithDevice(notnull ItemBase otherDevice)
10247 {
10248 if (GetGame().IsServer())
10249 {
10250 ItemBase explosive = otherDevice;
10252 if (!trg)
10253 {
10254 trg = RemoteDetonatorTrigger.Cast(otherDevice);
10255 explosive = this;
10256 }
10257
10258 explosive.PairRemote(trg);
10259 trg.SetControlledDevice(explosive);
10260
10261 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10262 trg.SetPersistentPairID(persistentID);
10263 explosive.SetPersistentPairID(persistentID);
10264
10265 return true;
10266 }
10267 return false;
10268 }
10269
10271 float GetBaitEffectivity()
10272 {
10273 float ret = 1.0;
10274 if (HasQuantity())
10275 ret *= GetQuantityNormalized();
10276 ret *= GetHealth01();
10277
10278 return ret;
10279 }
10280
10281 #ifdef DEVELOPER
10282 override void SetDebugItem()
10283 {
10284 super.SetDebugItem();
10285 _itemBase = this;
10286 }
10287
10288 override string GetDebugText()
10289 {
10290 string text = super.GetDebugText();
10291
10292 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
10293 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
10294
10295 return text;
10296 }
10297 #endif
10298
10299 bool CanBeUsedForSuicide()
10300 {
10301 return true;
10302 }
10303
10305 //DEPRECATED BELOW
10307 // Backwards compatibility
10308 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10309 {
10310 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
10311 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
10312 }
10313
10314 // replaced by ItemSoundHandler
10315 protected EffectSound m_SoundDeployFinish;
10316 protected EffectSound m_SoundPlace;
10317 protected EffectSound m_DeployLoopSoundEx;
10318 protected EffectSound m_SoundDeploy;
10319 bool m_IsPlaceSound;
10320 bool m_IsDeploySound;
10322
10323 string GetDeployFinishSoundset();
10324 void PlayDeploySound();
10325 void PlayDeployFinishSound();
10326 void PlayPlaceSound();
10327 void PlayDeployLoopSoundEx();
10328 void StopDeployLoopSoundEx();
10329 void SoundSynchRemoteReset();
10330 void SoundSynchRemote();
10331 bool UsesGlobalDeploy(){return false;}
10332 bool CanPlayDeployLoopSound(){return false;}
10334 bool IsPlaceSound(){return m_IsPlaceSound;}
10335 bool IsDeploySound(){return m_IsDeploySound;}
10336 void SetIsPlaceSound(bool is_place_sound);
10337 void SetIsDeploySound(bool is_deploy_sound);
10338}
10339
10340EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
10341{
10342 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
10343 if (entity)
10344 {
10345 bool is_item = entity.IsInherited(ItemBase);
10346 if (is_item && full_quantity)
10347 {
10348 ItemBase item = ItemBase.Cast(entity);
10349 item.SetQuantity(item.GetQuantityInit());
10350 }
10351 }
10352 else
10353 {
10354 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
10355 return NULL;
10356 }
10357 return entity;
10358}
10359
10360void SetupSpawnedItem(ItemBase item, float health, float quantity)
10361{
10362 if (item)
10363 {
10364 if (health > 0)
10365 item.SetHealth("", "", health);
10366
10367 if (item.CanHaveTemperature())
10368 {
10369 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
10370 if (item.CanFreeze())
10371 item.SetFrozen(false);
10372 }
10373
10374 if (item.HasEnergyManager())
10375 {
10376 if (quantity >= 0)
10377 {
10378 item.GetCompEM().SetEnergy0To1(quantity);
10379 }
10380 else
10381 {
10382 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
10383 }
10384 }
10385 else if (item.IsMagazine())
10386 {
10387 Magazine mag = Magazine.Cast(item);
10388 if (quantity >= 0)
10389 {
10390 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10391 }
10392 else
10393 {
10394 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
10395 }
10396
10397 }
10398 else
10399 {
10400 if (quantity >= 0)
10401 {
10402 item.SetQuantityNormalized(quantity, false);
10403 }
10404 else
10405 {
10406 item.SetQuantity(Math.AbsFloat(quantity));
10407 }
10408
10409 }
10410 }
10411}
10412
10413#ifdef DEVELOPER
10414ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
10415#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
class LogManager EntityAI
eBleedingSourceType GetType()
Определения BleedingSource.c:63
ItemSuppressor SuppressorBase
Определения InventoryItem.c:7
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6308
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5548
bool HidesSelectionBySlot()
Определения ItemBase.c:9203
float m_VarWetMin
Определения ItemBase.c:4809
void SplitItem(PlayerBase player)
Определения ItemBase.c:6739
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9424
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8653
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8087
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5553
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8796
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6706
override bool IsHeavyBehaviour()
Определения ItemBase.c:8998
override void SetWetMax()
Определения ItemBase.c:8369
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9241
void ClearStartItemSoundServer()
Определения ItemBase.c:9139
float m_VarWet
Определения ItemBase.c:4806
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9271
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8648
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4869
bool CanBeMovedOverride()
Определения ItemBase.c:7380
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8345
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4855
override void ProcessVariables()
Определения ItemBase.c:9338
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4883
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8179
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8714
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8559
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5139
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4881
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9374
bool m_IsSoundSynchRemote
Определения ItemBase.c:9532
float m_OverheatingShots
Определения ItemBase.c:4876
void StopItemSoundServer(int id)
Определения ItemBase.c:9127
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5568
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5292
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9398
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4893
bool CanBeCooked()
Определения ItemBase.c:7336
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5635
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4905
bool m_RecipesInitialized
Определения ItemBase.c:4791
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6382
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9382
override void OnEnergyConsumed()
Определения ItemBase.c:8289
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8078
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8218
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8409
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8174
ref TIntArray m_InteractActions
Определения ItemBase.c:4857
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7400
float m_VarQuantity
Определения ItemBase.c:4797
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9543
override float GetWetMax()
Определения ItemBase.c:8379
bool CanBeUsedForSuicide()
Определения ItemBase.c:9510
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7011
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5773
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7554
void StartItemSoundServer(int id)
Определения ItemBase.c:9114
void DoAmmoExplosion()
Определения ItemBase.c:6243
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4868
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6557
int GetItemSize()
Определения ItemBase.c:7365
bool m_CanBeMovedOverride
Определения ItemBase.c:4834
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6167
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5360
bool CanDecay()
Определения ItemBase.c:9313
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8060
void SetQuantityMax()
Определения ItemBase.c:8065
override float GetQuantity()
Определения ItemBase.c:8154
int m_ColorComponentR
Определения ItemBase.c:4846
int m_ShotsToStartOverheating
Определения ItemBase.c:4878
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8394
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5367
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8897
void OnOverheatingDecay()
Определения ItemBase.c:5330
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8327
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4812
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5468
bool UsesGlobalDeploy()
Определения ItemBase.c:9542
int m_ItemBehaviour
Определения ItemBase.c:4827
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:8869
float m_HeatIsolation
Определения ItemBase.c:4822
float m_VarWetInit
Определения ItemBase.c:4808
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5813
void SetCEBasedQuantity()
Определения ItemBase.c:5581
bool m_CanPlayImpactSound
Определения ItemBase.c:4818
override string GetAttachmentSoundType()
Определения ItemBase.c:9072
float GetOverheatingCoef()
Определения ItemBase.c:5387
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9198
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9150
override bool IsStoreLoad()
Определения ItemBase.c:8421
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6987
bool IsLightSource()
Определения ItemBase.c:5709
bool m_HasQuantityBar
Определения ItemBase.c:4840
void SetResultOfSplit(bool value)
Определения ItemBase.c:6982
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6624
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6797
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5395
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8336
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8977
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8431
int m_LockType
Определения ItemBase.c:4894
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4899
bool m_CanBeDigged
Определения ItemBase.c:4841
float m_ItemAttachOffset
Определения ItemBase.c:4824
float GetItemModelLength()
Определения ItemBase.c:8438
bool m_ThrowItemOnDrop
Определения ItemBase.c:4832
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8729
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8322
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7016
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9369
bool CanHaveWetness()
Определения ItemBase.c:9326
int m_CleannessMin
Определения ItemBase.c:4814
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8662
string IDToName(int id)
Определения ItemBase.c:7547
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9333
float GetHeatIsolationInit()
Определения ItemBase.c:8317
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7387
override bool HasQuantity()
Определения ItemBase.c:8149
float m_VarWetPrev
Определения ItemBase.c:4807
int m_SoundSyncStop
Определения ItemBase.c:4901
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9419
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4856
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5477
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5162
int m_VarLiquidType
Определения ItemBase.c:4826
int m_QuickBarBonus
Определения ItemBase.c:4828
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9060
override float GetWetInit()
Определения ItemBase.c:8389
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4820
int m_SoundSyncPlay
Определения ItemBase.c:4900
int m_MaxOverheatingValue
Определения ItemBase.c:4879
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
bool m_IsTakeable
Определения ItemBase.c:4831
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4871
string GetLockSoundSet()
Определения ItemBase.c:8487
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8518
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9446
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6803
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4783
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
override int GetQuantityMin()
Определения ItemBase.c:8138
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6533
override int GetQuickBarBonus()
Определения ItemBase.c:5047
override void SetTakeable(bool pState)
Определения ItemBase.c:9042
float m_OverheatingDecayInterval
Определения ItemBase.c:4880
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6356
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9291
bool CanProcessDecay()
Определения ItemBase.c:9319
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5558
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9435
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7351
bool can_this_be_combined
Определения ItemBase.c:4836
EffectSound m_SoundDeploy
Определения ItemBase.c:9529
int m_Count
Определения ItemBase.c:4802
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9482
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9034
override bool IsSplitable()
Определения ItemBase.c:6343
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6327
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7663
void ConvertEnergyToQuantity()
Определения ItemBase.c:8304
override void RemoveAllAgents()
Определения ItemBase.c:8643
override void SetQuantityToMinimum()
Определения ItemBase.c:8071
bool m_WantPlayImpactSound
Определения ItemBase.c:4817
override float GetTemperatureThawTime()
Определения ItemBase.c:9406
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4870
int m_ColorComponentG
Определения ItemBase.c:4847
float m_StoreLoadedQuantity
Определения ItemBase.c:4804
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7418
int m_ColorComponentA
Определения ItemBase.c:4849
int m_VarQuantityInit
Определения ItemBase.c:4799
float GetFilterDamageRatio()
Определения ItemBase.c:5462
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8531
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6773
void OnApply(PlayerBase player)
bool m_HideSelectionsBySlot
Определения ItemBase.c:4884
bool IsOverheatingEffectActive()
Определения ItemBase.c:5325
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5742
int GetLiquidContainerMask()
Определения ItemBase.c:5679
ref Timer m_CheckOverheating
Определения ItemBase.c:4877
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5373
float GetEnergy()
Определения ItemBase.c:8278
bool CanBeDigged()
Определения ItemBase.c:5758
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9452
bool IsNVG()
Определения ItemBase.c:5690
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8238
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9228
bool m_IsDeploySound
Определения ItemBase.c:9531
bool CanEat()
Определения ItemBase.c:7311
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8937
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9008
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9430
bool IsLiquidContainer()
Определения ItemBase.c:5674
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7331
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8721
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8119
int m_CleannessInit
Определения ItemBase.c:4813
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5457
override int GetAgents()
Определения ItemBase.c:8668
int m_VarQuantityMax
Определения ItemBase.c:4801
override bool IsHologram()
Определения ItemBase.c:5753
float GetItemAttachOffset()
Определения ItemBase.c:8447
bool IsPlaceSound()
Определения ItemBase.c:9545
static int GetDebugActionsMask()
Определения ItemBase.c:5543
override int GetLiquidType()
Определения ItemBase.c:8547
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9308
override bool IsItemBase()
Определения ItemBase.c:7464
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9018
void ExplodeAmmo()
Определения ItemBase.c:6230
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:6972
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8742
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8917
override void OnEnergyAdded()
Определения ItemBase.c:8296
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5702
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9528
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7604
void StopItemDynamicPhysics()
Определения ItemBase.c:9210
bool HasFoodStage()
Определения ItemBase.c:7324
override void SetStoreLoad(bool value)
Определения ItemBase.c:8416
float GetOverheatingValue()
Определения ItemBase.c:5287
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8621
override void AddWet(float value)
Определения ItemBase.c:8364
bool IsLiquidPresent()
Определения ItemBase.c:5669
bool IsFullQuantity()
Определения ItemBase.c:8159
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:5943
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6678
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6651
int m_CleannessMax
Определения ItemBase.c:4815
float m_VarStackMax
Определения ItemBase.c:4803
ref Timer m_PhysDropTimer
Определения ItemBase.c:4890
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7436
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8426
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4844
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5308
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5623
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7358
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8552
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5354
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8474
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4875
int m_LiquidContainerMask
Определения ItemBase.c:4825
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9246
override int GetCleanness()
Определения ItemBase.c:8469
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9457
bool IsDeploySound()
Определения ItemBase.c:9546
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5563
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8957
int m_VarQuantityMin
Определения ItemBase.c:4800
void PerformDamageSystemReinit()
Определения ItemBase.c:9216
override void ClearInventory()
Определения ItemBase.c:8257
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4872
ItemBase GetLightSourceItem()
Определения ItemBase.c:9440
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7454
override float GetItemOverheatThreshold()
Определения ItemBase.c:9390
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4837
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7568
void Open()
Implementations only.
Определения CannedFood.c:100
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6590
float m_ItemModelLength
Определения ItemBase.c:4823
bool m_IsHologram
Определения ItemBase.c:4830
static int m_DebugActionsMask
Определения ItemBase.c:4790
void KillAllOverheatingParticles()
Определения ItemBase.c:5423
bool CanBeCookedOnStick()
Определения ItemBase.c:7341
override int GetQuantityMax()
Определения ItemBase.c:8106
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7050
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8512
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8634
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4833
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8824
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9186
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4784
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9519
override bool IsBeingPlaced()
Определения ItemBase.c:5737
int GetQuantityInit()
Определения ItemBase.c:8143
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6992
bool IsResultOfSplit()
Определения ItemBase.c:6977
bool m_FixDamageSystemInit
Определения ItemBase.c:4835
float m_ImpactSpeed
Определения ItemBase.c:4819
bool m_IsStoreLoad
Определения ItemBase.c:4838
int GetLiquidTypeInit()
Определения ItemBase.c:8542
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4853
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5610
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6462
int m_AttachedAgents
Определения ItemBase.c:4861
string m_LockSoundSet
Определения ItemBase.c:4896
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5231
float m_VarQuantityPrev
Определения ItemBase.c:4798
bool IsSoundSynchRemote()
Определения ItemBase.c:9544
bool m_CanShowQuantity
Определения ItemBase.c:4839
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения ItemBase.c:8781
override void OnRightClick()
Определения ItemBase.c:6846
int m_ColorComponentB
Определения ItemBase.c:4848
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4786
bool IsActionTargetVisible()
Определения ItemBase.c:9054
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:5978
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6267
bool m_IsBeingPlaced
Определения ItemBase.c:4829
int NameToID(string name)
Определения ItemBase.c:7541
void ~ItemBase()
Определения ItemBase.c:5508
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8404
void ClearStopItemSoundServer()
Определения ItemBase.c:9144
override string ChangeIntoOnDetach()
Определения ItemBase.c:6191
float m_VarWetMax
Определения ItemBase.c:4810
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6585
int GetLockType()
Определения ItemBase.c:8482
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9526
override float GetWet()
Определения ItemBase.c:8374
EffectSound m_SoundPlace
Определения ItemBase.c:9527
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8092
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8456
bool m_IsPlaceSound
Определения ItemBase.c:9530
override float GetWetMin()
Определения ItemBase.c:8384
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4902
override bool KindOf(string tag)
Определения ItemBase.c:7470
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения Man.c:44
Определения Building.c:6
Определения constants.c:659
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:149
override void OnWasDetached(EntityAI parent, int slot_id)
Определения InventoryItem.c:920
override void EEOnAfterLoad()
Определения GardenBase.c:187
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
Определения InventoryItem.c:732
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1218
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:465
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:472
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:206
override void AfterStoreLoad()
Определения GardenBase.c:182
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1017
override void OnVariablesSynchronized()
Определения GardenBase.c:68
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
Определения InventoryItem.c:912
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:962
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:269
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:988
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1150
override void InitItemSounds()
Определения TentBase.c:810
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1012
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
Определения InventoryItem.c:840
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:341
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения InventoryItem.c:731
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения constants.c:510
const int DEF_CHEMICAL
Определения constants.c:511
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:685
array< int > TIntArray
Определения EnScript.c:687
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
const int VARIABLE_LIQUIDTYPE
Определения constants.c:630
const int VARIABLE_CLEANNESS
Определения constants.c:633
const int VARIABLE_COLOR
Определения constants.c:632
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const int VARIABLE_QUANTITY
Определения constants.c:626
const int VARIABLE_WET
Определения constants.c:629
const int LIQUID_NONE
Определения constants.c:527
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения constants.c:451
const int SAT_DEBUG_ACTION
Определения constants.c:452
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native int GetColor()

Используется в InventoryItem::ToggleDebugActionsMask().