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

◆ IsBloodContainer()

bool SpawnItemOnLocation::IsBloodContainer ( )
private

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

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