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

◆ IsExplosive()

bool SpawnItemOnLocation::IsExplosive ( )
private

explosive

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

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