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

◆ GetExplosiveTriggerSlotName()

string SpawnItemOnLocation::GetExplosiveTriggerSlotName ( )
private

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

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