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

◆ CombineItemsClient()

override void SpawnItemOnLocation::CombineItemsClient ( EntityAI entity2,
bool use_stack_max = true )
private

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

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