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

◆ IsLiquidPresent()

bool SpawnItemOnLocation::IsLiquidPresent ( )
private

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

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