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

◆ SetIsHologram()

void SpawnItemOnLocation::SetIsHologram ( bool is_hologram)
private

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

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