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

◆ OnEndPlacement()

void SpawnItemOnLocation::OnEndPlacement ( )
private

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

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