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

◆ CanBeRepairedByCrafting()

bool SpawnItemOnLocation::CanBeRepairedByCrafting ( )
private

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

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