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

◆ SetIsBeingPlaced()

void SpawnItemOnLocation::SetIsBeingPlaced ( bool is_being_placed)
private

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

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