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

◆ GetWeightSpecialized()

float SpawnItemOnLocation::GetWeightSpecialized ( bool forceRecalc = false)
protected

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

8183{
8184 override bool CanPutAsAttachment(EntityAI parent)
8185 {
8186 return true;
8187 }
8188};
8189
8190//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8191
8192class ItemBase extends InventoryItem
8193{
8197
8199
8200 static int m_DebugActionsMask;
8202 // ============================================
8203 // Variable Manipulation System
8204 // ============================================
8205 // Quantity
8206
8207 float m_VarQuantity;
8208 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8210 int m_VarQuantityMin;
8211 int m_VarQuantityMax;
8212 int m_Count;
8213 float m_VarStackMax;
8214 float m_StoreLoadedQuantity = float.LOWEST;
8215 // Wet
8216 float m_VarWet;
8217 float m_VarWetPrev;//for client to know wetness changed during synchronization
8218 float m_VarWetInit;
8219 float m_VarWetMin;
8220 float m_VarWetMax;
8221 // Cleanness
8222 int m_Cleanness;
8223 int m_CleannessInit;
8224 int m_CleannessMin;
8225 int m_CleannessMax;
8226 // impact sounds
8228 bool m_CanPlayImpactSound = true;
8229 float m_ImpactSpeed;
8231 //
8232 float m_HeatIsolation;
8233 float m_ItemModelLength;
8234 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8236 int m_VarLiquidType;
8237 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8238 int m_QuickBarBonus;
8239 bool m_IsBeingPlaced;
8240 bool m_IsHologram;
8241 bool m_IsTakeable;
8242 bool m_ThrowItemOnDrop;
8245 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8246 bool can_this_be_combined; //Check if item can be combined
8247 bool m_CanThisBeSplit; //Check if item can be split
8248 bool m_IsStoreLoad = false;
8249 bool m_CanShowQuantity;
8250 bool m_HasQuantityBar;
8251 protected bool m_CanBeDigged;
8252 protected bool m_IsResultOfSplit
8253
8254 string m_SoundAttType;
8255 // items color variables
8260 //-------------------------------------------------------
8261
8262 // light source managing
8264
8268
8269 //==============================================
8270 // agent system
8271 private int m_AttachedAgents;
8272
8274 void TransferModifiers(PlayerBase reciever);
8275
8276
8277 // Weapons & suppressors particle effects
8282 static int m_LastRegisteredWeaponID = 0;
8283
8284 // Overheating effects
8286 float m_OverheatingShots;
8287 ref Timer m_CheckOverheating;
8288 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8289 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8290 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8291 ref array <ref OverheatingParticle> m_OverheatingParticles;
8292
8294 protected bool m_HideSelectionsBySlot;
8295
8296 // Admin Log
8297 PluginAdminLog m_AdminLog;
8298
8299 // misc
8300 ref Timer m_PhysDropTimer;
8301
8302 // Attachment Locking variables
8303 ref array<int> m_CompatibleLocks;
8304 protected int m_LockType;
8305 protected ref EffectSound m_LockingSound;
8306 protected string m_LockSoundSet;
8307
8308 // ItemSoundHandler
8309 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8310 protected int m_SoundSyncPlay; // id for sound to play
8311 protected int m_SoundSyncStop; // id for sound to stop
8313
8314 //temperature
8315 private float m_TemperaturePerQuantityWeight;
8316
8317 // -------------------------------------------------------------------------
8318 void ItemBase()
8319 {
8320 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8324
8325 if (!GetGame().IsDedicatedServer())
8326 {
8327 if (HasMuzzle())
8328 {
8330
8332 {
8334 }
8335 }
8336
8338 m_ActionsInitialize = false;
8339 }
8340
8341 m_OldLocation = null;
8342
8343 if (GetGame().IsServer())
8344 {
8345 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8346 }
8347
8348 if (ConfigIsExisting("headSelectionsToHide"))
8349 {
8351 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8352 }
8353
8354 m_HideSelectionsBySlot = false;
8355 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8356 {
8357 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8358 }
8359
8360 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8361
8362 m_IsResultOfSplit = false;
8363
8365 }
8366
8367 override void InitItemVariables()
8368 {
8369 super.InitItemVariables();
8370
8371 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8372 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8373 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8374 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8375 m_VarStackMax = ConfigGetFloat("varStackMax");
8376 m_Count = ConfigGetInt("count");
8377
8378 m_CanShowQuantity = ConfigGetBool("quantityShow");
8379 m_HasQuantityBar = ConfigGetBool("quantityBar");
8380
8381 m_CleannessInit = ConfigGetInt("varCleannessInit");
8383 m_CleannessMin = ConfigGetInt("varCleannessMin");
8384 m_CleannessMax = ConfigGetInt("varCleannessMax");
8385
8386 m_WantPlayImpactSound = false;
8387 m_ImpactSpeed = 0.0;
8388
8389 m_VarWetInit = ConfigGetFloat("varWetInit");
8391 m_VarWetMin = ConfigGetFloat("varWetMin");
8392 m_VarWetMax = ConfigGetFloat("varWetMax");
8393
8394 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8395 if (IsLiquidContainer() && GetQuantity() != 0)
8397 m_IsBeingPlaced = false;
8398 m_IsHologram = false;
8399 m_IsTakeable = true;
8400 m_CanBeMovedOverride = false;
8404 m_CanBeDigged = ConfigGetBool("canBeDigged");
8405
8406 m_CompatibleLocks = new array<int>();
8407 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8408 m_LockType = ConfigGetInt("lockType");
8409
8410 //Define if item can be split and set ability to be combined accordingly
8411 m_CanThisBeSplit = false;
8412 can_this_be_combined = false;
8413 if (ConfigIsExisting("canBeSplit"))
8414 {
8415 can_this_be_combined = ConfigGetBool("canBeSplit");
8417 }
8418
8419 m_ItemBehaviour = -1;
8420 if (ConfigIsExisting("itemBehaviour"))
8421 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8422
8423 //RegisterNetSyncVariableInt("m_VariablesMask");
8424 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8425 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8426 RegisterNetSyncVariableInt("m_VarLiquidType");
8427 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8428
8429 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8430 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8431 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8432
8433 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8434 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8435 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8436 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8437
8438 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8439 RegisterNetSyncVariableBool("m_IsTakeable");
8440 RegisterNetSyncVariableBool("m_IsHologram");
8441
8442 InitItemSounds();
8444 {
8445 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8446 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8447 }
8448
8449 m_LockSoundSet = ConfigGetString("lockSoundSet");
8450
8452 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8453 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8454
8455 }
8456
8457 override int GetQuickBarBonus()
8458 {
8459 return m_QuickBarBonus;
8460 }
8461
8462 void InitializeActions()
8463 {
8465 if (!m_InputActionMap)
8466 {
8468 m_InputActionMap = iam;
8469 SetActions();
8471 }
8472 }
8473
8474 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
8475 {
8477 {
8478 m_ActionsInitialize = true;
8480 }
8481
8482 actions = m_InputActionMap.Get(action_input_type);
8483 }
8484
8485 void SetActions()
8486 {
8487 AddAction(ActionTakeItem);
8488 AddAction(ActionTakeItemToHands);
8489 AddAction(ActionWorldCraft);
8491 AddAction(ActionAttachWithSwitch);
8492 }
8493
8494 void SetActionAnimOverrides(); // Override action animation for specific item
8495
8496 void AddAction(typename actionName)
8497 {
8498 ActionBase action = ActionManagerBase.GetAction(actionName);
8499
8500 if (!action)
8501 {
8502 Debug.LogError("Action " + actionName + " dosn't exist!");
8503 return;
8504 }
8505
8506 typename ai = action.GetInputType();
8507 if (!ai)
8508 {
8509 m_ActionsInitialize = false;
8510 return;
8511 }
8512
8513 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8514 if (!action_array)
8515 {
8516 action_array = new array<ActionBase_Basic>;
8517 m_InputActionMap.Insert(ai, action_array);
8518 }
8519 if (LogManager.IsActionLogEnable())
8520 {
8521 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
8522 }
8523
8524 if (action_array.Find(action) != -1)
8525 {
8526 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
8527 }
8528 else
8529 {
8530 action_array.Insert(action);
8531 }
8532 }
8533
8534 void RemoveAction(typename actionName)
8535 {
8536 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8537 ActionBase action = player.GetActionManager().GetAction(actionName);
8538 typename ai = action.GetInputType();
8539 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8540
8541 if (action_array)
8542 {
8543 action_array.RemoveItem(action);
8544 }
8545 }
8546
8547 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
8548 // Set -1 for params which should stay in default state
8549 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
8550 {
8551 ActionOverrideData overrideData = new ActionOverrideData();
8552 overrideData.m_CommandUID = commandUID;
8553 overrideData.m_CommandUIDProne = commandUIDProne;
8554 overrideData.m_StanceMask = stanceMask;
8555
8556 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
8557 if (!actionMap) // create new map of action > overidables map
8558 {
8559 actionMap = new TActionAnimOverrideMap();
8560 m_ItemActionOverrides.Insert(action, actionMap);
8561 }
8562
8563 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
8564
8565 }
8566
8567 void OnItemInHandsPlayerSwimStart(PlayerBase player);
8568
8569 ScriptedLightBase GetLight();
8570
8571 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8572 void LoadParticleConfigOnFire(int id)
8573 {
8574 if (!m_OnFireEffect)
8576
8579
8580 string config_to_search = "CfgVehicles";
8581 string muzzle_owner_config;
8582
8583 if (!m_OnFireEffect.Contains(id))
8584 {
8585 if (IsInherited(Weapon))
8586 config_to_search = "CfgWeapons";
8587
8588 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8589
8590 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8591
8592 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
8593
8594 if (config_OnFire_subclass_count > 0)
8595 {
8596 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8597
8598 for (int i = 0; i < config_OnFire_subclass_count; i++)
8599 {
8600 string particle_class = "";
8601 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
8602 string config_OnFire_entry = config_OnFire_class + particle_class;
8603 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8604 WPOF_array.Insert(WPOF);
8605 }
8606
8607
8608 m_OnFireEffect.Insert(id, WPOF_array);
8609 }
8610 }
8611
8612 if (!m_OnBulletCasingEjectEffect.Contains(id))
8613 {
8614 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
8615 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8616
8617 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8618
8619 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8620
8621 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8622 {
8623 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8624
8625 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8626 {
8627 string particle_class2 = "";
8628 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8629 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8630 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8631 WPOBE_array.Insert(WPOBE);
8632 }
8633
8634
8635 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
8636 }
8637 }
8638 }
8639
8640 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8642 {
8645
8646 if (!m_OnOverheatingEffect.Contains(id))
8647 {
8648 string config_to_search = "CfgVehicles";
8649
8650 if (IsInherited(Weapon))
8651 config_to_search = "CfgWeapons";
8652
8653 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
8654 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8655
8656 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
8657 {
8658
8659 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
8660
8662 {
8663 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
8664 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8665 Error(error);
8666 return;
8667 }
8668
8669 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
8670 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
8671
8672
8673
8674 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
8675 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8676
8677 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8678 {
8679 string particle_class = "";
8680 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8681 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8682 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
8683
8684 if (entry_type == CT_CLASS)
8685 {
8686 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8687 WPOOH_array.Insert(WPOF);
8688 }
8689 }
8690
8691
8692 m_OnOverheatingEffect.Insert(id, WPOOH_array);
8693 }
8694 }
8695 }
8696
8697 float GetOverheatingValue()
8698 {
8699 return m_OverheatingShots;
8700 }
8701
8702 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
8703 {
8704 if (m_MaxOverheatingValue > 0)
8705 {
8707
8708 if (!m_CheckOverheating)
8710
8712 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8713
8714 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8715 }
8716 }
8717
8718 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8719 {
8721 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8722
8724 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8725
8727 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8728
8730 {
8732 }
8733 }
8734
8736 {
8738 }
8739
8740 void OnOverheatingDecay()
8741 {
8742 if (m_MaxOverheatingValue > 0)
8743 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8744 else
8746
8747 if (m_OverheatingShots <= 0)
8748 {
8751 }
8752 else
8753 {
8754 if (!m_CheckOverheating)
8756
8758 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8759 }
8760
8761 CheckOverheating(this, "", this);
8762 }
8763
8764 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8765 {
8767 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8768 }
8769
8770 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8771 {
8773 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8775 }
8776
8777 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8778 {
8780 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8781 }
8782
8783 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8784 {
8786 m_OverheatingParticles = new array<ref OverheatingParticle>;
8787
8788 OverheatingParticle OP = new OverheatingParticle();
8789 OP.RegisterParticle(p);
8790 OP.SetOverheatingLimitMin(min_heat_coef);
8791 OP.SetOverheatingLimitMax(max_heat_coef);
8792 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8793
8794 m_OverheatingParticles.Insert(OP);
8795 }
8796
8797 float GetOverheatingCoef()
8798 {
8799 if (m_MaxOverheatingValue > 0)
8801
8802 return -1;
8803 }
8804
8806 {
8808 {
8809 float overheat_coef = GetOverheatingCoef();
8810 int count = m_OverheatingParticles.Count();
8811
8812 for (int i = count; i > 0; --i)
8813 {
8814 int id = i - 1;
8815 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8816 Particle p = OP.GetParticle();
8817
8818 float overheat_min = OP.GetOverheatingLimitMin();
8819 float overheat_max = OP.GetOverheatingLimitMax();
8820
8821 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8822 {
8823 if (p)
8824 {
8825 p.Stop();
8826 OP.RegisterParticle(null);
8827 }
8828 }
8829 }
8830 }
8831 }
8832
8834 {
8836 {
8837 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
8838 {
8839 int id = i - 1;
8840 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8841
8842 if (OP)
8843 {
8844 Particle p = OP.GetParticle();
8845
8846 if (p)
8847 {
8848 p.Stop();
8849 }
8850
8851 delete OP;
8852 }
8853 }
8854
8855 m_OverheatingParticles.Clear();
8857 }
8858 }
8859
8861 float GetInfectionChance(int system = 0, Param param = null)
8862 {
8863 return 0.0;
8864 }
8865
8866
8867 float GetDisinfectQuantity(int system = 0, Param param1 = null)
8868 {
8869 return 250;//default value
8870 }
8871
8872 float GetFilterDamageRatio()
8873 {
8874 return 0;
8875 }
8876
8878 bool HasMuzzle()
8879 {
8880 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
8881 return true;
8882
8883 return false;
8884 }
8885
8887 int GetMuzzleID()
8888 {
8889 if (!m_WeaponTypeToID)
8891
8892 if (m_WeaponTypeToID.Contains(GetType()))
8893 {
8894 return m_WeaponTypeToID.Get(GetType());
8895 }
8896 else
8897 {
8898 // Register new weapon ID
8900 }
8901
8903 }
8904
8911 {
8912 return -1;
8913 }
8914
8915
8916
8917 // -------------------------------------------------------------------------
8918 void ~ItemBase()
8919 {
8920 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
8921 {
8922 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8923 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8924
8925 if (r_index >= 0)
8926 {
8927 InventoryLocation r_il = new InventoryLocation;
8928 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8929
8930 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8931 int r_type = r_il.GetType();
8932 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8933 {
8934 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8935 }
8936 else if (r_type == InventoryLocationType.ATTACHMENT)
8937 {
8938 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8939 }
8940
8941 }
8942
8943 player.GetHumanInventory().ClearUserReservedLocation(this);
8944 }
8945
8946 if (m_LockingSound)
8947 SEffectManager.DestroyEffect(m_LockingSound);
8948 }
8949
8950
8951
8952 // -------------------------------------------------------------------------
8953 static int GetDebugActionsMask()
8954 {
8955 return ItemBase.m_DebugActionsMask;
8956 }
8957
8958 static bool HasDebugActionsMask(int mask)
8959 {
8960 return ItemBase.m_DebugActionsMask & mask;
8961 }
8962
8963 static void SetDebugActionsMask(int mask)
8964 {
8965 ItemBase.m_DebugActionsMask = mask;
8966 }
8967
8968 static void AddDebugActionsMask(int mask)
8969 {
8970 ItemBase.m_DebugActionsMask |= mask;
8971 }
8972
8973 static void RemoveDebugActionsMask(int mask)
8974 {
8975 ItemBase.m_DebugActionsMask &= ~mask;
8976 }
8977
8978 static void ToggleDebugActionsMask(int mask)
8979 {
8980 if (HasDebugActionsMask(mask))
8981 {
8983 }
8984 else
8985 {
8986 AddDebugActionsMask(mask);
8987 }
8988 }
8989
8990 // -------------------------------------------------------------------------
8991 void SetCEBasedQuantity()
8992 {
8993 if (GetEconomyProfile())
8994 {
8995 float q_max = GetEconomyProfile().GetQuantityMax();
8996 if (q_max > 0)
8997 {
8998 float q_min = GetEconomyProfile().GetQuantityMin();
8999 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9000
9001 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9002 {
9003 ComponentEnergyManager comp = GetCompEM();
9004 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
9005 {
9006 comp.SetEnergy0To1(quantity_randomized);
9007 }
9008 }
9009 else if (HasQuantity())
9010 {
9011 SetQuantityNormalized(quantity_randomized, false);
9012 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9013 }
9014
9015 }
9016 }
9017 }
9018
9020 void LockToParent()
9021 {
9022 EntityAI parent = GetHierarchyParent();
9023
9024 if (parent)
9025 {
9026 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9027 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9028 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9029 }
9030 }
9031
9033 void UnlockFromParent()
9034 {
9035 EntityAI parent = GetHierarchyParent();
9036
9037 if (parent)
9038 {
9039 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9040 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9041 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9042 }
9043 }
9044
9045 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9046 {
9047 /*
9048 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9049 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9050 */
9051 ItemBase item2 = ItemBase.Cast(entity2);
9052
9053 if (GetGame().IsClient())
9054 {
9055 if (ScriptInputUserData.CanStoreInputUserData())
9056 {
9057 ScriptInputUserData ctx = new ScriptInputUserData;
9059 ctx.Write(-1);
9060 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9061 ctx.Write(i1);
9062 ctx.Write(item2);
9063 ctx.Write(use_stack_max);
9064 ctx.Write(-1);
9065 ctx.Send();
9066
9067 if (IsCombineAll(item2, use_stack_max))
9068 {
9069 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9070 }
9071 }
9072 }
9073 else if (!GetGame().IsMultiplayer())
9074 {
9075 CombineItems(item2, use_stack_max);
9076 }
9077 }
9078
9079 bool IsLiquidPresent()
9080 {
9081 return (GetLiquidType() != 0 && HasQuantity());
9082 }
9083
9084 bool IsLiquidContainer()
9085 {
9086 return m_LiquidContainerMask != 0;
9087 }
9088
9090 {
9091 return m_LiquidContainerMask;
9092 }
9093
9094 bool IsBloodContainer()
9095 {
9096 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9097 return false;
9098 }
9099
9100 bool IsNVG()
9101 {
9102 return false;
9103 }
9104
9107 bool IsExplosive()
9108 {
9109 return false;
9110 }
9111
9113 {
9114 return "";
9115 }
9116
9118
9119 bool IsLightSource()
9120 {
9121 return false;
9122 }
9123
9125 {
9126 return true;
9127 }
9128
9129 //--- ACTION CONDITIONS
9130 //direction
9131 bool IsFacingPlayer(PlayerBase player, string selection)
9132 {
9133 return true;
9134 }
9135
9136 bool IsPlayerInside(PlayerBase player, string selection)
9137 {
9138 return true;
9139 }
9140
9141 override bool CanObstruct()
9142 {
9143 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9144 return !player || !IsPlayerInside(player, "");
9145 }
9146
9147 override bool IsBeingPlaced()
9148 {
9149 return m_IsBeingPlaced;
9150 }
9151
9152 void SetIsBeingPlaced(bool is_being_placed)
9153 {
9154 m_IsBeingPlaced = is_being_placed;
9155 if (!is_being_placed)
9157 SetSynchDirty();
9158 }
9159
9160 //server-side
9161 void OnEndPlacement() {}
9162
9163 override bool IsHologram()
9164 {
9165 return m_IsHologram;
9166 }
9167
9168 bool CanBeDigged()
9169 {
9170 return m_CanBeDigged;
9171 }
9172
9174 {
9175 return 1;
9176 }
9177
9178 bool CanMakeGardenplot()
9179 {
9180 return false;
9181 }
9182
9183 void SetIsHologram(bool is_hologram)
9184 {
9185 m_IsHologram = is_hologram;
9186 SetSynchDirty();
9187 }
9188 /*
9189 protected float GetNutritionalEnergy()
9190 {
9191 Edible_Base edible = Edible_Base.Cast(this);
9192 return edible.GetFoodEnergy();
9193 }
9194
9195 protected float GetNutritionalWaterContent()
9196 {
9197 Edible_Base edible = Edible_Base.Cast(this);
9198 return edible.GetFoodWater();
9199 }
9200
9201 protected float GetNutritionalIndex()
9202 {
9203 Edible_Base edible = Edible_Base.Cast(this);
9204 return edible.GetFoodNutritionalIndex();
9205 }
9206
9207 protected float GetNutritionalFullnessIndex()
9208 {
9209 Edible_Base edible = Edible_Base.Cast(this);
9210 return edible.GetFoodTotalVolume();
9211 }
9212
9213 protected float GetNutritionalToxicity()
9214 {
9215 Edible_Base edible = Edible_Base.Cast(this);
9216 return edible.GetFoodToxicity();
9217
9218 }
9219 */
9220
9221
9222 // -------------------------------------------------------------------------
9223 override void OnMovedInsideCargo(EntityAI container)
9224 {
9225 super.OnMovedInsideCargo(container);
9226
9227 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9228 }
9229
9230 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9231 {
9232 super.EEItemLocationChanged(oldLoc,newLoc);
9233
9234 PlayerBase new_player = null;
9235 PlayerBase old_player = null;
9236
9237 if (newLoc.GetParent())
9238 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9239
9240 if (oldLoc.GetParent())
9241 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9242
9243 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9244 {
9245 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9246
9247 if (r_index >= 0)
9248 {
9249 InventoryLocation r_il = new InventoryLocation;
9250 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9251
9252 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9253 int r_type = r_il.GetType();
9254 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9255 {
9256 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9257 }
9258 else if (r_type == InventoryLocationType.ATTACHMENT)
9259 {
9260 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9261 }
9262
9263 }
9264 }
9265
9266 if (newLoc.GetType() == InventoryLocationType.HANDS)
9267 {
9268 if (new_player)
9269 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9270
9271 if (new_player == old_player)
9272 {
9273
9274 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9275 {
9276 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9277 {
9278 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9279 {
9280 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9281 }
9282 }
9283 else
9284 {
9285 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9286 }
9287 }
9288
9289 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9290 {
9291 int type = oldLoc.GetType();
9292 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9293 {
9294 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9295 }
9296 else if (type == InventoryLocationType.ATTACHMENT)
9297 {
9298 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9299 }
9300 }
9301 if (!m_OldLocation)
9302 {
9303 m_OldLocation = new InventoryLocation;
9304 }
9305 m_OldLocation.Copy(oldLoc);
9306 }
9307 else
9308 {
9309 if (m_OldLocation)
9310 {
9311 m_OldLocation.Reset();
9312 }
9313 }
9314
9316 }
9317 else
9318 {
9319 if (new_player)
9320 {
9321 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9322 if (res_index >= 0)
9323 {
9324 InventoryLocation il = new InventoryLocation;
9325 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9326 ItemBase it = ItemBase.Cast(il.GetItem());
9327 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9328 int rel_type = il.GetType();
9329 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9330 {
9331 il.GetParent().GetOnReleaseLock().Invoke(it);
9332 }
9333 else if (rel_type == InventoryLocationType.ATTACHMENT)
9334 {
9335 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9336 }
9337 //it.GetOnReleaseLock().Invoke(it);
9338 }
9339 }
9340 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9341 {
9342 //ThrowPhysically(old_player, vector.Zero);
9343 m_ThrowItemOnDrop = false;
9344 }
9345
9346 if (m_OldLocation)
9347 {
9348 m_OldLocation.Reset();
9349 }
9350 }
9351 }
9352
9353 override void EOnContact(IEntity other, Contact extra)
9354 {
9356 {
9357 int liquidType = -1;
9358 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9359 if (impactSpeed > 0.0)
9360 {
9361 m_ImpactSpeed = impactSpeed;
9362 #ifndef SERVER
9363 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9364 #else
9365 m_WantPlayImpactSound = true;
9366 SetSynchDirty();
9367 #endif
9368 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9369 }
9370 }
9371
9372 #ifdef SERVER
9373 if (GetCompEM() && GetCompEM().IsPlugged())
9374 {
9375 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9376 GetCompEM().UnplugThis();
9377 }
9378 #endif
9379 }
9380
9381 void RefreshPhysics();
9382
9383 override void OnCreatePhysics()
9384 {
9386 }
9387
9388 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9389 {
9390
9391 }
9392 // -------------------------------------------------------------------------
9393 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9394 {
9395 super.OnItemLocationChanged(old_owner, new_owner);
9396
9397 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9398 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9399
9400 if (!relatedPlayer && playerNew)
9401 relatedPlayer = playerNew;
9402
9403 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9404 {
9405 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9406 if (actionMgr)
9407 {
9408 ActionBase currentAction = actionMgr.GetRunningAction();
9409 if (currentAction)
9410 currentAction.OnItemLocationChanged(this);
9411 }
9412 }
9413
9414 Man ownerPlayerOld = null;
9415 Man ownerPlayerNew = null;
9416
9417 if (old_owner)
9418 {
9419 if (old_owner.IsMan())
9420 {
9421 ownerPlayerOld = Man.Cast(old_owner);
9422 }
9423 else
9424 {
9425 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9426 }
9427 }
9428 else
9429 {
9430 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9431 {
9432 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9433
9434 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9435 {
9436 GetCompEM().UnplugThis();
9437 }
9438 }
9439 }
9440
9441 if (new_owner)
9442 {
9443 if (new_owner.IsMan())
9444 {
9445 ownerPlayerNew = Man.Cast(new_owner);
9446 }
9447 else
9448 {
9449 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9450 }
9451 }
9452
9453 if (ownerPlayerOld != ownerPlayerNew)
9454 {
9455 if (ownerPlayerOld)
9456 {
9457 array<EntityAI> subItemsExit = new array<EntityAI>;
9458 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
9459 for (int i = 0; i < subItemsExit.Count(); i++)
9460 {
9461 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
9462 itemExit.OnInventoryExit(ownerPlayerOld);
9463 }
9464 }
9465
9466 if (ownerPlayerNew)
9467 {
9468 array<EntityAI> subItemsEnter = new array<EntityAI>;
9469 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
9470 for (int j = 0; j < subItemsEnter.Count(); j++)
9471 {
9472 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
9473 itemEnter.OnInventoryEnter(ownerPlayerNew);
9474 }
9475 }
9476 }
9477 else if (ownerPlayerNew != null)
9478 {
9479 PlayerBase nplayer;
9480 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9481 {
9482 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9483 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
9484 for (int k = 0; k < subItemsUpdate.Count(); k++)
9485 {
9486 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
9487 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9488 }
9489 }
9490 }
9491
9492 if (old_owner)
9493 old_owner.OnChildItemRemoved(this);
9494 if (new_owner)
9495 new_owner.OnChildItemReceived(this);
9496 }
9497
9498 // -------------------------------------------------------------------------------
9499 override void EEDelete(EntityAI parent)
9500 {
9501 super.EEDelete(parent);
9502 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9503 if (player)
9504 {
9505 OnInventoryExit(player);
9506
9507 if (player.IsAlive())
9508 {
9509 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9510 if (r_index >= 0)
9511 {
9512 InventoryLocation r_il = new InventoryLocation;
9513 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9514
9515 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9516 int r_type = r_il.GetType();
9517 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9518 {
9519 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9520 }
9521 else if (r_type == InventoryLocationType.ATTACHMENT)
9522 {
9523 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9524 }
9525
9526 }
9527
9528 player.RemoveQuickBarEntityShortcut(this);
9529 }
9530 }
9531 }
9532 // -------------------------------------------------------------------------------
9533 override void EEKilled(Object killer)
9534 {
9535 super.EEKilled(killer);
9536
9538 if (killer && killer.IsFireplace() && CanExplodeInFire())
9539 {
9540 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9541 {
9542 if (IsMagazine())
9543 {
9544 if (Magazine.Cast(this).GetAmmoCount() > 0)
9545 {
9546 ExplodeAmmo();
9547 }
9548 }
9549 else
9550 {
9551 Explode(DamageType.EXPLOSION);
9552 }
9553 }
9554 }
9555 }
9556
9557 override void OnWasAttached(EntityAI parent, int slot_id)
9558 {
9559 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9560
9561 super.OnWasAttached(parent, slot_id);
9562
9563 if (HasQuantity())
9564 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9565
9566 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
9567 }
9568
9569 override void OnWasDetached(EntityAI parent, int slot_id)
9570 {
9571 super.OnWasDetached(parent, slot_id);
9572
9573 if (HasQuantity())
9574 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9575 }
9576
9577 override string ChangeIntoOnAttach(string slot)
9578 {
9579 int idx;
9580 TStringArray inventory_slots = new TStringArray;
9581 TStringArray attach_types = new TStringArray;
9582
9583 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9584 if (inventory_slots.Count() < 1) //is string
9585 {
9586 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9587 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9588 }
9589 else //is array
9590 {
9591 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9592 }
9593
9594 idx = inventory_slots.Find(slot);
9595 if (idx < 0)
9596 return "";
9597
9598 return attach_types.Get(idx);
9599 }
9600
9601 override string ChangeIntoOnDetach()
9602 {
9603 int idx = -1;
9604 string slot;
9605
9606 TStringArray inventory_slots = new TStringArray;
9607 TStringArray detach_types = new TStringArray;
9608
9609 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9610 if (inventory_slots.Count() < 1) //is string
9611 {
9612 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9613 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9614 }
9615 else //is array
9616 {
9617 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9618 if (detach_types.Count() < 1)
9619 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9620 }
9621
9622 for (int i = 0; i < inventory_slots.Count(); i++)
9623 {
9624 slot = inventory_slots.Get(i);
9625 }
9626
9627 if (slot != "")
9628 {
9629 if (detach_types.Count() == 1)
9630 idx = 0;
9631 else
9632 idx = inventory_slots.Find(slot);
9633 }
9634 if (idx < 0)
9635 return "";
9636
9637 return detach_types.Get(idx);
9638 }
9639
9640 void ExplodeAmmo()
9641 {
9642 //timer
9643 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
9644
9645 //min/max time
9646 float min_time = 1;
9647 float max_time = 3;
9648 float delay = Math.RandomFloat(min_time, max_time);
9649
9650 explode_timer.Run(delay, this, "DoAmmoExplosion");
9651 }
9652
9653 void DoAmmoExplosion()
9654 {
9655 Magazine magazine = Magazine.Cast(this);
9656 int pop_sounds_count = 6;
9657 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9658
9659 //play sound
9660 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9661 string sound_name = pop_sounds[ sound_idx ];
9662 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
9663
9664 //remove ammo count
9665 magazine.ServerAddAmmoCount(-1);
9666
9667 //if condition then repeat -> ExplodeAmmo
9668 float min_temp_to_explode = 100; //min temperature for item to explode
9669
9670 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
9671 {
9672 ExplodeAmmo();
9673 }
9674 }
9675
9676 // -------------------------------------------------------------------------------
9677 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
9678 {
9679 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
9680
9681 const int CHANCE_DAMAGE_CARGO = 4;
9682 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9683 const int CHANCE_DAMAGE_NOTHING = 2;
9684
9685 if (IsClothing() || IsContainer() || IsItemTent())
9686 {
9687 float dmg = damageResult.GetDamage("","Health") * -0.5;
9688 int chances;
9689 int rnd;
9690
9691 if (GetInventory().GetCargo())
9692 {
9693 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9694 rnd = Math.RandomInt(0,chances);
9695
9696 if (rnd < CHANCE_DAMAGE_CARGO)
9697 {
9698 DamageItemInCargo(dmg);
9699 }
9700 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9701 {
9703 }
9704 }
9705 else
9706 {
9707 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9708 rnd = Math.RandomInt(0,chances);
9709
9710 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9711 {
9713 }
9714 }
9715 }
9716 }
9717
9718 bool DamageItemInCargo(float damage)
9719 {
9720 if (GetInventory().GetCargo())
9721 {
9722 int item_count = GetInventory().GetCargo().GetItemCount();
9723 if (item_count > 0)
9724 {
9725 int random_pick = Math.RandomInt(0, item_count);
9726 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9727 if (!item.IsExplosive())
9728 {
9729 item.AddHealth("","",damage);
9730 return true;
9731 }
9732 }
9733 }
9734 return false;
9735 }
9736
9737 bool DamageItemAttachments(float damage)
9738 {
9739 int attachment_count = GetInventory().AttachmentCount();
9740 if (attachment_count > 0)
9741 {
9742 int random_pick = Math.RandomInt(0, attachment_count);
9743 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9744 if (!attachment.IsExplosive())
9745 {
9746 attachment.AddHealth("","",damage);
9747 return true;
9748 }
9749 }
9750 return false;
9751 }
9752
9753 override bool IsSplitable()
9754 {
9755 return m_CanThisBeSplit;
9756 }
9757 //----------------
9758 override bool CanBeSplit()
9759 {
9760 if (IsSplitable() && (GetQuantity() > 1))
9761 return GetInventory().CanRemoveEntity();
9762
9763 return false;
9764 }
9765
9766 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9767 {
9768 if (!CanBeSplit())
9769 return;
9770
9771 if (GetGame().IsClient())
9772 {
9773 if (ScriptInputUserData.CanStoreInputUserData())
9774 {
9775 ScriptInputUserData ctx = new ScriptInputUserData;
9777 ctx.Write(1);
9778 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9779 ctx.Write(i1);
9780 ctx.Write(destination_entity);
9781 ctx.Write(true);
9782 ctx.Write(slot_id);
9783 ctx.Send();
9784 }
9785 }
9786 else if (!GetGame().IsMultiplayer())
9787 {
9788 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9789 }
9790 }
9791
9792 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9793 {
9794 if (!CanBeSplit())
9795 return;
9796
9797 float split_quantity_new;
9798 ref ItemBase new_item;
9799 float quantity = GetQuantity();
9800 float stack_max = GetTargetQuantityMax(slot_id);
9801 InventoryLocation loc = new InventoryLocation;
9802
9803 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9804 {
9805 if (stack_max <= GetQuantity())
9806 split_quantity_new = stack_max;
9807 else
9808 split_quantity_new = GetQuantity();
9809
9810 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9811 if (new_item)
9812 {
9813 new_item.SetResultOfSplit(true);
9814 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9815 AddQuantity(-split_quantity_new);
9816 new_item.SetQuantity(split_quantity_new);
9817 }
9818 }
9819 else if (destination_entity && slot_id == -1)
9820 {
9821 if (quantity > stack_max)
9822 split_quantity_new = stack_max;
9823 else
9824 split_quantity_new = quantity;
9825
9826 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9827 {
9828 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9829 new_item = ItemBase.Cast(o);
9830 }
9831
9832 if (new_item)
9833 {
9834 new_item.SetResultOfSplit(true);
9835 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9836 AddQuantity(-split_quantity_new);
9837 new_item.SetQuantity(split_quantity_new);
9838 }
9839 }
9840 else
9841 {
9842 if (stack_max != 0)
9843 {
9844 if (stack_max < GetQuantity())
9845 {
9846 split_quantity_new = GetQuantity() - stack_max;
9847 }
9848
9849 if (split_quantity_new == 0)
9850 {
9851 if (!GetGame().IsMultiplayer())
9852 player.PhysicalPredictiveDropItem(this);
9853 else
9854 player.ServerDropEntity(this);
9855 return;
9856 }
9857
9858 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9859
9860 if (new_item)
9861 {
9862 new_item.SetResultOfSplit(true);
9863 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9864 SetQuantity(split_quantity_new);
9865 new_item.SetQuantity(stack_max);
9866 new_item.PlaceOnSurface();
9867 }
9868 }
9869 }
9870 }
9871
9872 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
9873 {
9874 if (!CanBeSplit())
9875 return;
9876
9877 float split_quantity_new;
9878 ref ItemBase new_item;
9879 float quantity = GetQuantity();
9880 float stack_max = GetTargetQuantityMax(slot_id);
9881 InventoryLocation loc = new InventoryLocation;
9882
9883 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9884 {
9885 if (stack_max <= GetQuantity())
9886 split_quantity_new = stack_max;
9887 else
9888 split_quantity_new = GetQuantity();
9889
9890 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9891 if (new_item)
9892 {
9893 new_item.SetResultOfSplit(true);
9894 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9895 AddQuantity(-split_quantity_new);
9896 new_item.SetQuantity(split_quantity_new);
9897 }
9898 }
9899 else if (destination_entity && slot_id == -1)
9900 {
9901 if (quantity > stack_max)
9902 split_quantity_new = stack_max;
9903 else
9904 split_quantity_new = quantity;
9905
9906 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9907 {
9908 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9909 new_item = ItemBase.Cast(o);
9910 }
9911
9912 if (new_item)
9913 {
9914 new_item.SetResultOfSplit(true);
9915 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9916 AddQuantity(-split_quantity_new);
9917 new_item.SetQuantity(split_quantity_new);
9918 }
9919 }
9920 else
9921 {
9922 if (stack_max != 0)
9923 {
9924 if (stack_max < GetQuantity())
9925 {
9926 split_quantity_new = GetQuantity() - stack_max;
9927 }
9928
9929 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9930
9931 if (new_item)
9932 {
9933 new_item.SetResultOfSplit(true);
9934 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9935 SetQuantity(split_quantity_new);
9936 new_item.SetQuantity(stack_max);
9937 new_item.PlaceOnSurface();
9938 }
9939 }
9940 }
9941 }
9942
9943 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
9944 {
9945 if (!CanBeSplit())
9946 return;
9947
9948 if (GetGame().IsClient())
9949 {
9950 if (ScriptInputUserData.CanStoreInputUserData())
9951 {
9952 ScriptInputUserData ctx = new ScriptInputUserData;
9954 ctx.Write(4);
9955 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9956 ctx.Write(thiz);
9957 dst.WriteToContext(ctx);
9958 ctx.Send();
9959 }
9960 }
9961 else if (!GetGame().IsMultiplayer())
9962 {
9964 }
9965 }
9966
9967 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
9968 {
9969 if (!CanBeSplit())
9970 return;
9971
9972 if (GetGame().IsClient())
9973 {
9974 if (ScriptInputUserData.CanStoreInputUserData())
9975 {
9976 ScriptInputUserData ctx = new ScriptInputUserData;
9978 ctx.Write(2);
9979 ItemBase dummy = this; // @NOTE: workaround for correct serialization
9980 ctx.Write(dummy);
9981 ctx.Write(destination_entity);
9982 ctx.Write(true);
9983 ctx.Write(idx);
9984 ctx.Write(row);
9985 ctx.Write(col);
9986 ctx.Send();
9987 }
9988 }
9989 else if (!GetGame().IsMultiplayer())
9990 {
9991 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
9992 }
9993 }
9994
9995 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
9996 {
9998 }
9999
10000 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10001 {
10002 if (!CanBeSplit())
10003 return this;
10004
10005 float quantity = GetQuantity();
10006 float split_quantity_new;
10007 ItemBase new_item;
10008 if (dst.IsValid())
10009 {
10010 int slot_id = dst.GetSlot();
10011 float stack_max = GetTargetQuantityMax(slot_id);
10012
10013 if (quantity > stack_max)
10014 split_quantity_new = stack_max;
10015 else
10016 split_quantity_new = quantity;
10017
10018 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10019
10020 if (new_item)
10021 {
10022 new_item.SetResultOfSplit(true);
10023 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10024 AddQuantity(-split_quantity_new);
10025 new_item.SetQuantity(split_quantity_new);
10026 }
10027
10028 return new_item;
10029 }
10030
10031 return null;
10032 }
10033
10034 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10035 {
10036 if (!CanBeSplit())
10037 return;
10038
10039 float quantity = GetQuantity();
10040 float split_quantity_new;
10041 ref ItemBase new_item;
10042 if (destination_entity)
10043 {
10044 float stackable = GetTargetQuantityMax();
10045 if (quantity > stackable)
10046 split_quantity_new = stackable;
10047 else
10048 split_quantity_new = quantity;
10049
10050 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10051 if (new_item)
10052 {
10053 new_item.SetResultOfSplit(true);
10054 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10055 AddQuantity(-split_quantity_new);
10056 new_item.SetQuantity(split_quantity_new);
10057 }
10058 }
10059 }
10060
10061 void SplitIntoStackMaxHandsClient(PlayerBase player)
10062 {
10063 if (!CanBeSplit())
10064 return;
10065
10066 if (GetGame().IsClient())
10067 {
10068 if (ScriptInputUserData.CanStoreInputUserData())
10069 {
10070 ScriptInputUserData ctx = new ScriptInputUserData;
10072 ctx.Write(3);
10073 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10074 ctx.Write(i1);
10075 ItemBase destination_entity = this;
10076 ctx.Write(destination_entity);
10077 ctx.Write(true);
10078 ctx.Write(0);
10079 ctx.Send();
10080 }
10081 }
10082 else if (!GetGame().IsMultiplayer())
10083 {
10084 SplitIntoStackMaxHands(player);
10085 }
10086 }
10087
10088 void SplitIntoStackMaxHands(PlayerBase player)
10089 {
10090 if (!CanBeSplit())
10091 return;
10092
10093 float quantity = GetQuantity();
10094 float split_quantity_new;
10095 ref ItemBase new_item;
10096 if (player)
10097 {
10098 float stackable = GetTargetQuantityMax();
10099 if (quantity > stackable)
10100 split_quantity_new = stackable;
10101 else
10102 split_quantity_new = quantity;
10103
10104 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10105 new_item = ItemBase.Cast(in_hands);
10106 if (new_item)
10107 {
10108 new_item.SetResultOfSplit(true);
10109 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10110 AddQuantity(-split_quantity_new);
10111 new_item.SetQuantity(split_quantity_new);
10112 }
10113 }
10114 }
10115
10116 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10117 {
10118 if (!CanBeSplit())
10119 return;
10120
10121 float quantity = GetQuantity();
10122 float split_quantity_new = Math.Floor(quantity * 0.5);
10123
10124 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10125
10126 if (new_item)
10127 {
10128 if (new_item.GetQuantityMax() < split_quantity_new)
10129 {
10130 split_quantity_new = new_item.GetQuantityMax();
10131 }
10132
10133 new_item.SetResultOfSplit(true);
10134 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10135
10136 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10137 {
10138 AddQuantity(-1);
10139 new_item.SetQuantity(1);
10140 }
10141 else
10142 {
10143 AddQuantity(-split_quantity_new);
10144 new_item.SetQuantity(split_quantity_new);
10145 }
10146 }
10147 }
10148
10149 void SplitItem(PlayerBase player)
10150 {
10151 if (!CanBeSplit())
10152 return;
10153
10154 float quantity = GetQuantity();
10155 float split_quantity_new = Math.Floor(quantity / 2);
10156
10157 InventoryLocation invloc = new InventoryLocation;
10158 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10159
10160 ItemBase new_item;
10161 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10162
10163 if (new_item)
10164 {
10165 if (new_item.GetQuantityMax() < split_quantity_new)
10166 {
10167 split_quantity_new = new_item.GetQuantityMax();
10168 }
10169 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10170 {
10171 AddQuantity(-1);
10172 new_item.SetQuantity(1);
10173 }
10174 else
10175 {
10176 AddQuantity(-split_quantity_new);
10177 new_item.SetQuantity(split_quantity_new);
10178 }
10179 }
10180 }
10181
10183 void OnQuantityChanged(float delta)
10184 {
10185 SetWeightDirty();
10186 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10187
10188 if (parent)
10189 parent.OnAttachmentQuantityChangedEx(this, delta);
10190
10191 if (IsLiquidContainer())
10192 {
10193 if (GetQuantityNormalized() <= 0.0)
10194 {
10196 }
10197 else if (GetLiquidType() == LIQUID_NONE)
10198 {
10199 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10201 }
10202 }
10203
10204 }
10205
10208 {
10209 // insert code here
10210 }
10211
10213 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10214 {
10216 }
10217
10218 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10219 {
10220 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10221
10222 if (GetGame().IsServer())
10223 {
10224 if (newLevel == GameConstants.STATE_RUINED)
10225 {
10227 EntityAI parent = GetHierarchyParent();
10228 if (parent && parent.IsFireplace())
10229 {
10230 CargoBase cargo = GetInventory().GetCargo();
10231 if (cargo)
10232 {
10233 for (int i = 0; i < cargo.GetItemCount(); ++i)
10234 {
10235 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10236 }
10237 }
10238 }
10239 }
10240
10241 if (IsResultOfSplit())
10242 {
10243 // reset the splitting result flag, return to normal item behavior
10244 SetResultOfSplit(false);
10245 return;
10246 }
10247
10248 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10249 {
10250 SetCleanness(0);//unclean the item upon damage dealt
10251 }
10252 }
10253 }
10254
10255 // just the split? TODO: verify
10256 override void OnRightClick()
10257 {
10258 super.OnRightClick();
10259
10260 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10261 {
10262 if (GetGame().IsClient())
10263 {
10264 if (ScriptInputUserData.CanStoreInputUserData())
10265 {
10266 vector m4[4];
10267 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10268
10269 EntityAI root = GetHierarchyRoot();
10270
10271 InventoryLocation dst = new InventoryLocation;
10272 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
10273 {
10274 if (root)
10275 {
10276 root.GetTransform(m4);
10277 dst.SetGround(this, m4);
10278 }
10279 else
10280 GetInventory().GetCurrentInventoryLocation(dst);
10281 }
10282 else
10283 {
10284 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10285 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10286 this shouldnt cause issues within this scope*/
10287 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10288 {
10289 if (root)
10290 {
10291 root.GetTransform(m4);
10292 dst.SetGround(this, m4);
10293 }
10294 else
10295 GetInventory().GetCurrentInventoryLocation(dst);
10296 }
10297 else
10298 {
10299 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10300 }
10301 }
10302
10303 ScriptInputUserData ctx = new ScriptInputUserData;
10305 ctx.Write(4);
10306 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10307 ctx.Write(thiz);
10308 dst.WriteToContext(ctx);
10309 ctx.Write(true); // dummy
10310 ctx.Send();
10311 }
10312 }
10313 else if (!GetGame().IsMultiplayer())
10314 {
10315 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10316 }
10317 }
10318 }
10319
10320 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10321 {
10322 //TODO: delete check zero quantity check after fix double posts hands fsm events
10323 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10324 return false;
10325
10326 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10327 return false;
10328
10329 //can_this_be_combined = ConfigGetBool("canBeSplit");
10331 return false;
10332
10333
10334 Magazine mag = Magazine.Cast(this);
10335 if (mag)
10336 {
10337 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10338 return false;
10339
10340 if (stack_max_limit)
10341 {
10342 Magazine other_mag = Magazine.Cast(other_item);
10343 if (other_item)
10344 {
10345 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10346 return false;
10347 }
10348
10349 }
10350 }
10351 else
10352 {
10353 //TODO: delete check zero quantity check after fix double posts hands fsm events
10354 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10355 return false;
10356
10357 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10358 return false;
10359 }
10360
10361 PlayerBase player = null;
10362 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10363 {
10364 if (player.GetInventory().HasAttachment(this))
10365 return false;
10366
10367 if (player.IsItemsToDelete())
10368 return false;
10369 }
10370
10371 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10372 return false;
10373
10374 int slotID;
10375 string slotName;
10376 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10377 return false;
10378
10379 return true;
10380 }
10381
10382 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
10383 {
10384 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
10385 }
10386
10387 bool IsResultOfSplit()
10388 {
10389 return m_IsResultOfSplit;
10390 }
10391
10392 void SetResultOfSplit(bool value)
10393 {
10394 m_IsResultOfSplit = value;
10395 }
10396
10397 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10398 {
10399 return ComputeQuantityUsedEx(other_item, use_stack_max);
10400 }
10401
10402 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10403 {
10404 float other_item_quantity = other_item.GetQuantity();
10405 float this_free_space;
10406
10407 float stack_max = GetQuantityMax();
10408
10409 this_free_space = stack_max - GetQuantity();
10410
10411 if (other_item_quantity > this_free_space)
10412 {
10413 return this_free_space;
10414 }
10415 else
10416 {
10417 return other_item_quantity;
10418 }
10419 }
10420
10421 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10422 {
10423 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10424 }
10425
10426 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10427 {
10428 if (!CanBeCombined(other_item, false))
10429 return;
10430
10431 if (!IsMagazine() && other_item)
10432 {
10433 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10434 if (quantity_used != 0)
10435 {
10436 float hp1 = GetHealth01("","");
10437 float hp2 = other_item.GetHealth01("","");
10438 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10439 hpResult = hpResult / (GetQuantity() + quantity_used);
10440
10441 hpResult *= GetMaxHealth();
10442 Math.Round(hpResult);
10443 SetHealth("", "Health", hpResult);
10444
10445 AddQuantity(quantity_used);
10446 other_item.AddQuantity(-quantity_used);
10447 }
10448 }
10449 OnCombine(other_item);
10450 }
10451
10452 void OnCombine(ItemBase other_item)
10453 {
10454 #ifdef SERVER
10455 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10456 GetHierarchyParent().IncreaseLifetimeUp();
10457 #endif
10458 };
10459
10460 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
10461 {
10462 PlayerBase p = PlayerBase.Cast(player);
10463
10464 array<int> recipesIds = p.m_Recipes;
10465 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10466 if (moduleRecipesManager)
10467 {
10468 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10469 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
10470 }
10471
10472 for (int i = 0;i < recipesIds.Count(); i++)
10473 {
10474 int key = recipesIds.Get(i);
10475 string recipeName = moduleRecipesManager.GetRecipeName(key);
10476 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
10477 }
10478 }
10479
10480 // -------------------------------------------------------------------------
10481 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10482 {
10483 super.GetDebugActions(outputList);
10484
10485 //quantity
10486 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
10487 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
10488 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
10489 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
10490
10491 //health
10492 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
10493 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
10494 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
10495 //temperature
10496 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
10497 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
10498 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
10499
10500 //wet
10501 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
10502 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
10503
10504 //liquidtype
10505 if (IsLiquidContainer())
10506 {
10507 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
10508 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
10509 }
10510
10511 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
10512 // watch
10513 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
10514 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
10515
10516 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10517 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
10518 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10519 }
10520
10521 // -------------------------------------------------------------------------
10522 // -------------------------------------------------------------------------
10523 // -------------------------------------------------------------------------
10524 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
10525 {
10526 super.OnAction(action_id, player, ctx);
10527 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
10528 {
10529 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10530 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
10531 PlayerBase p = PlayerBase.Cast(player);
10532 if (EActions.RECIPES_RANGE_START < 1000)
10533 {
10534 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10535 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10536 }
10537 }
10538 #ifndef SERVER
10539 else if (action_id == EActions.WATCH_PLAYER)
10540 {
10541 PluginDeveloper.SetDeveloperItemClientEx(player);
10542 }
10543 #endif
10544 if (GetGame().IsServer())
10545 {
10546 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10547 {
10548 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10549 OnDebugButtonPressServer(id + 1);
10550 }
10551
10552 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10553 {
10554 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10555 InsertAgent(agent_id,100);
10556 }
10557
10558 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10559 {
10560 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10561 RemoveAgent(agent_id2);
10562 }
10563
10564 else if (action_id == EActions.ADD_QUANTITY)
10565 {
10566 if (IsMagazine())
10567 {
10568 Magazine mag = Magazine.Cast(this);
10569 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10570 }
10571 else
10572 {
10573 AddQuantity(GetQuantityMax() * 0.2);
10574 }
10575
10576 if (m_EM)
10577 {
10578 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10579 }
10580 //PrintVariables();
10581 }
10582
10583 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
10584 {
10585 if (IsMagazine())
10586 {
10587 Magazine mag2 = Magazine.Cast(this);
10588 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10589 }
10590 else
10591 {
10592 AddQuantity(- GetQuantityMax() * 0.2);
10593 }
10594 if (m_EM)
10595 {
10596 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10597 }
10598 //PrintVariables();
10599 }
10600
10601 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
10602 {
10603 SetQuantity(0);
10604
10605 if (m_EM)
10606 {
10607 m_EM.SetEnergy(0);
10608 }
10609 }
10610
10611 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
10612 {
10614
10615 if (m_EM)
10616 {
10617 m_EM.SetEnergy(m_EM.GetEnergyMax());
10618 }
10619 }
10620
10621 else if (action_id == EActions.ADD_HEALTH)
10622 {
10623 AddHealth("","",GetMaxHealth("","Health")/5);
10624 }
10625 else if (action_id == EActions.REMOVE_HEALTH)
10626 {
10627 AddHealth("","",-GetMaxHealth("","Health")/5);
10628 }
10629 else if (action_id == EActions.DESTROY_HEALTH)
10630 {
10631 SetHealth01("","",0);
10632 }
10633 else if (action_id == EActions.WATCH_ITEM)
10634 {
10636 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
10637 #ifdef DEVELOPER
10638 SetDebugDeveloper_item(this);
10639 #endif
10640 }
10641
10642 else if (action_id == EActions.ADD_TEMPERATURE)
10643 {
10644 AddTemperature(20);
10645 //PrintVariables();
10646 }
10647
10648 else if (action_id == EActions.REMOVE_TEMPERATURE)
10649 {
10650 AddTemperature(-20);
10651 //PrintVariables();
10652 }
10653
10654 else if (action_id == EActions.FLIP_FROZEN)
10655 {
10656 SetFrozen(!GetIsFrozen());
10657 //PrintVariables();
10658 }
10659
10660 else if (action_id == EActions.ADD_WETNESS)
10661 {
10662 AddWet(GetWetMax()/5);
10663 //PrintVariables();
10664 }
10665
10666 else if (action_id == EActions.REMOVE_WETNESS)
10667 {
10668 AddWet(-GetWetMax()/5);
10669 //PrintVariables();
10670 }
10671
10672 else if (action_id == EActions.LIQUIDTYPE_UP)
10673 {
10674 int curr_type = GetLiquidType();
10675 SetLiquidType(curr_type * 2);
10676 //AddWet(1);
10677 //PrintVariables();
10678 }
10679
10680 else if (action_id == EActions.LIQUIDTYPE_DOWN)
10681 {
10682 int curr_type2 = GetLiquidType();
10683 SetLiquidType(curr_type2 / 2);
10684 }
10685
10686 else if (action_id == EActions.MAKE_SPECIAL)
10687 {
10688 auto debugParams = DebugSpawnParams.WithPlayer(player);
10689 OnDebugSpawnEx(debugParams);
10690 }
10691
10692 else if (action_id == EActions.DELETE)
10693 {
10694 Delete();
10695 }
10696
10697 }
10698
10699
10700 return false;
10701 }
10702
10703 // -------------------------------------------------------------------------
10704
10705
10708 void OnActivatedByTripWire();
10709
10711 void OnActivatedByItem(notnull ItemBase item);
10712
10713 //----------------------------------------------------------------
10714 //returns true if item is able to explode when put in fire
10715 bool CanExplodeInFire()
10716 {
10717 return false;
10718 }
10719
10720 //----------------------------------------------------------------
10721 bool CanEat()
10722 {
10723 return true;
10724 }
10725
10726 //----------------------------------------------------------------
10727 override bool IsIgnoredByConstruction()
10728 {
10729 return true;
10730 }
10731
10732 //----------------------------------------------------------------
10733 //has FoodStages in config?
10734 bool HasFoodStage()
10735 {
10736 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10737 return GetGame().ConfigIsExisting(config_path);
10738 }
10739
10741 FoodStage GetFoodStage()
10742 {
10743 return null;
10744 }
10745
10746 bool CanBeCooked()
10747 {
10748 return false;
10749 }
10750
10751 bool CanBeCookedOnStick()
10752 {
10753 return false;
10754 }
10755
10757 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10759
10760 //----------------------------------------------------------------
10761 bool CanRepair(ItemBase item_repair_kit)
10762 {
10763 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10764 return module_repairing.CanRepair(this, item_repair_kit);
10765 }
10766
10767 //----------------------------------------------------------------
10768 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10769 {
10770 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10771 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10772 }
10773
10774 //----------------------------------------------------------------
10775 int GetItemSize()
10776 {
10777 /*
10778 vector v_size = this.ConfigGetVector("itemSize");
10779 int v_size_x = v_size[0];
10780 int v_size_y = v_size[1];
10781 int size = v_size_x * v_size_y;
10782 return size;
10783 */
10784
10785 return 1;
10786 }
10787
10788 //----------------------------------------------------------------
10789 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10790 bool CanBeMovedOverride()
10791 {
10792 return m_CanBeMovedOverride;
10793 }
10794
10795 //----------------------------------------------------------------
10796 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10797 void SetCanBeMovedOverride(bool setting)
10798 {
10799 m_CanBeMovedOverride = setting;
10800 }
10801
10802 //----------------------------------------------------------------
10810 void MessageToOwnerStatus(string text)
10811 {
10812 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10813
10814 if (player)
10815 {
10816 player.MessageStatus(text);
10817 }
10818 }
10819
10820 //----------------------------------------------------------------
10828 void MessageToOwnerAction(string text)
10829 {
10830 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10831
10832 if (player)
10833 {
10834 player.MessageAction(text);
10835 }
10836 }
10837
10838 //----------------------------------------------------------------
10846 void MessageToOwnerFriendly(string text)
10847 {
10848 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10849
10850 if (player)
10851 {
10852 player.MessageFriendly(text);
10853 }
10854 }
10855
10856 //----------------------------------------------------------------
10864 void MessageToOwnerImportant(string text)
10865 {
10866 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10867
10868 if (player)
10869 {
10870 player.MessageImportant(text);
10871 }
10872 }
10873
10874 override bool IsItemBase()
10875 {
10876 return true;
10877 }
10878
10879 // Checks if item is of questioned kind
10880 override bool KindOf(string tag)
10881 {
10882 bool found = false;
10883 string item_name = this.GetType();
10884 ref TStringArray item_tag_array = new TStringArray;
10885 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
10886
10887 int array_size = item_tag_array.Count();
10888 for (int i = 0; i < array_size; i++)
10889 {
10890 if (item_tag_array.Get(i) == tag)
10891 {
10892 found = true;
10893 break;
10894 }
10895 }
10896 return found;
10897 }
10898
10899
10900 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
10901 {
10902 //Debug.Log("OnRPC called");
10903 super.OnRPC(sender, rpc_type,ctx);
10904
10905 //Play soundset for attachment locking (ActionLockAttachment.c)
10906 switch (rpc_type)
10907 {
10908 #ifndef SERVER
10909 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10910 Param2<bool, string> p = new Param2<bool, string>(false, "");
10911
10912 if (!ctx.Read(p))
10913 return;
10914
10915 bool play = p.param1;
10916 string soundSet = p.param2;
10917
10918 if (play)
10919 {
10920 if (m_LockingSound)
10921 {
10923 {
10924 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10925 }
10926 }
10927 else
10928 {
10929 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10930 }
10931 }
10932 else
10933 {
10934 SEffectManager.DestroyEffect(m_LockingSound);
10935 }
10936
10937 break;
10938 #endif
10939
10940 }
10941
10942 if (GetWrittenNoteData())
10943 {
10944 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
10945 }
10946 }
10947
10948 //-----------------------------
10949 // VARIABLE MANIPULATION SYSTEM
10950 //-----------------------------
10951 int NameToID(string name)
10952 {
10953 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10954 return plugin.GetID(name);
10955 }
10956
10957 string IDToName(int id)
10958 {
10959 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10960 return plugin.GetName(id);
10961 }
10962
10964 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
10965 {
10966 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
10967 //read the flags
10968 int varFlags;
10969 if (!ctx.Read(varFlags))
10970 return;
10971
10972 if (varFlags & ItemVariableFlags.FLOAT)
10973 {
10974 ReadVarsFromCTX(ctx);
10975 }
10976 }
10977
10978 override void SerializeNumericalVars(array<float> floats_out)
10979 {
10980 //some variables handled on EntityAI level already!
10981 super.SerializeNumericalVars(floats_out);
10982
10983 // the order of serialization must be the same as the order of de-serialization
10984 //--------------------------------------------
10985 if (IsVariableSet(VARIABLE_QUANTITY))
10986 {
10987 floats_out.Insert(m_VarQuantity);
10988 }
10989 //--------------------------------------------
10990 if (IsVariableSet(VARIABLE_WET))
10991 {
10992 floats_out.Insert(m_VarWet);
10993 }
10994 //--------------------------------------------
10995 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10996 {
10997 floats_out.Insert(m_VarLiquidType);
10998 }
10999 //--------------------------------------------
11000 if (IsVariableSet(VARIABLE_COLOR))
11001 {
11002 floats_out.Insert(m_ColorComponentR);
11003 floats_out.Insert(m_ColorComponentG);
11004 floats_out.Insert(m_ColorComponentB);
11005 floats_out.Insert(m_ColorComponentA);
11006 }
11007 //--------------------------------------------
11008 if (IsVariableSet(VARIABLE_CLEANNESS))
11009 {
11010 floats_out.Insert(m_Cleanness);
11011 }
11012 }
11013
11014 override void DeSerializeNumericalVars(array<float> floats)
11015 {
11016 //some variables handled on EntityAI level already!
11017 super.DeSerializeNumericalVars(floats);
11018
11019 // the order of serialization must be the same as the order of de-serialization
11020 int index = 0;
11021 int mask = Math.Round(floats.Get(index));
11022
11023 index++;
11024 //--------------------------------------------
11025 if (mask & VARIABLE_QUANTITY)
11026 {
11027 if (m_IsStoreLoad)
11028 {
11029 SetStoreLoadedQuantity(floats.Get(index));
11030 }
11031 else
11032 {
11033 float quantity = floats.Get(index);
11034 SetQuantity(quantity, true, false, false, false);
11035 }
11036 index++;
11037 }
11038 //--------------------------------------------
11039 if (mask & VARIABLE_WET)
11040 {
11041 float wet = floats.Get(index);
11042 SetWet(wet);
11043 index++;
11044 }
11045 //--------------------------------------------
11046 if (mask & VARIABLE_LIQUIDTYPE)
11047 {
11048 int liquidtype = Math.Round(floats.Get(index));
11049 SetLiquidType(liquidtype);
11050 index++;
11051 }
11052 //--------------------------------------------
11053 if (mask & VARIABLE_COLOR)
11054 {
11055 m_ColorComponentR = Math.Round(floats.Get(index));
11056 index++;
11057 m_ColorComponentG = Math.Round(floats.Get(index));
11058 index++;
11059 m_ColorComponentB = Math.Round(floats.Get(index));
11060 index++;
11061 m_ColorComponentA = Math.Round(floats.Get(index));
11062 index++;
11063 }
11064 //--------------------------------------------
11065 if (mask & VARIABLE_CLEANNESS)
11066 {
11067 int cleanness = Math.Round(floats.Get(index));
11068 SetCleanness(cleanness);
11069 index++;
11070 }
11071 }
11072
11073 override void WriteVarsToCTX(ParamsWriteContext ctx)
11074 {
11075 super.WriteVarsToCTX(ctx);
11076
11077 //--------------------------------------------
11078 if (IsVariableSet(VARIABLE_QUANTITY))
11079 {
11080 ctx.Write(GetQuantity());
11081 }
11082 //--------------------------------------------
11083 if (IsVariableSet(VARIABLE_WET))
11084 {
11085 ctx.Write(GetWet());
11086 }
11087 //--------------------------------------------
11088 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11089 {
11090 ctx.Write(GetLiquidType());
11091 }
11092 //--------------------------------------------
11093 if (IsVariableSet(VARIABLE_COLOR))
11094 {
11095 int r,g,b,a;
11096 GetColor(r,g,b,a);
11097 ctx.Write(r);
11098 ctx.Write(g);
11099 ctx.Write(b);
11100 ctx.Write(a);
11101 }
11102 //--------------------------------------------
11103 if (IsVariableSet(VARIABLE_CLEANNESS))
11104 {
11105 ctx.Write(GetCleanness());
11106 }
11107 }
11108
11109 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11110 {
11111 if (!super.ReadVarsFromCTX(ctx,version))
11112 return false;
11113
11114 int intValue;
11115 float value;
11116
11117 if (version < 140)
11118 {
11119 if (!ctx.Read(intValue))
11120 return false;
11121
11122 m_VariablesMask = intValue;
11123 }
11124
11125 if (m_VariablesMask & VARIABLE_QUANTITY)
11126 {
11127 if (!ctx.Read(value))
11128 return false;
11129
11130 if (IsStoreLoad())
11131 {
11133 }
11134 else
11135 {
11136 SetQuantity(value, true, false, false, false);
11137 }
11138 }
11139 //--------------------------------------------
11140 if (version < 140)
11141 {
11142 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11143 {
11144 if (!ctx.Read(value))
11145 return false;
11146 SetTemperatureDirect(value);
11147 }
11148 }
11149 //--------------------------------------------
11150 if (m_VariablesMask & VARIABLE_WET)
11151 {
11152 if (!ctx.Read(value))
11153 return false;
11154 SetWet(value);
11155 }
11156 //--------------------------------------------
11157 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11158 {
11159 if (!ctx.Read(intValue))
11160 return false;
11161 SetLiquidType(intValue);
11162 }
11163 //--------------------------------------------
11164 if (m_VariablesMask & VARIABLE_COLOR)
11165 {
11166 int r,g,b,a;
11167 if (!ctx.Read(r))
11168 return false;
11169 if (!ctx.Read(g))
11170 return false;
11171 if (!ctx.Read(b))
11172 return false;
11173 if (!ctx.Read(a))
11174 return false;
11175
11176 SetColor(r,g,b,a);
11177 }
11178 //--------------------------------------------
11179 if (m_VariablesMask & VARIABLE_CLEANNESS)
11180 {
11181 if (!ctx.Read(intValue))
11182 return false;
11183 SetCleanness(intValue);
11184 }
11185 //--------------------------------------------
11186 if (version >= 138 && version < 140)
11187 {
11188 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11189 {
11190 if (!ctx.Read(intValue))
11191 return false;
11192 SetFrozen(intValue);
11193 }
11194 }
11195
11196 return true;
11197 }
11198
11199 //----------------------------------------------------------------
11200 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11201 {
11202 m_IsStoreLoad = true;
11204 {
11205 m_FixDamageSystemInit = true;
11206 }
11207
11208 if (!super.OnStoreLoad(ctx, version))
11209 {
11210 m_IsStoreLoad = false;
11211 return false;
11212 }
11213
11214 if (version >= 114)
11215 {
11216 bool hasQuickBarIndexSaved;
11217
11218 if (!ctx.Read(hasQuickBarIndexSaved))
11219 {
11220 m_IsStoreLoad = false;
11221 return false;
11222 }
11223
11224 if (hasQuickBarIndexSaved)
11225 {
11226 int itmQBIndex;
11227
11228 //Load quickbar item bind
11229 if (!ctx.Read(itmQBIndex))
11230 {
11231 m_IsStoreLoad = false;
11232 return false;
11233 }
11234
11235 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11236 if (itmQBIndex != -1 && parentPlayer)
11237 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11238 }
11239 }
11240 else
11241 {
11242 // Backup of how it used to be
11243 PlayerBase player;
11244 int itemQBIndex;
11245 if (version == int.MAX)
11246 {
11247 if (!ctx.Read(itemQBIndex))
11248 {
11249 m_IsStoreLoad = false;
11250 return false;
11251 }
11252 }
11253 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11254 {
11255 //Load quickbar item bind
11256 if (!ctx.Read(itemQBIndex))
11257 {
11258 m_IsStoreLoad = false;
11259 return false;
11260 }
11261 if (itemQBIndex != -1 && player)
11262 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11263 }
11264 }
11265
11266 if (version < 140)
11267 {
11268 // variable management system
11269 if (!LoadVariables(ctx, version))
11270 {
11271 m_IsStoreLoad = false;
11272 return false;
11273 }
11274 }
11275
11276 //agent trasmission system
11277 if (!LoadAgents(ctx, version))
11278 {
11279 m_IsStoreLoad = false;
11280 return false;
11281 }
11282 if (version >= 132)
11283 {
11284 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11285 if (raib)
11286 {
11287 if (!raib.OnStoreLoad(ctx,version))
11288 {
11289 m_IsStoreLoad = false;
11290 return false;
11291 }
11292 }
11293 }
11294
11295 m_IsStoreLoad = false;
11296 return true;
11297 }
11298
11299 //----------------------------------------------------------------
11300
11301 override void OnStoreSave(ParamsWriteContext ctx)
11302 {
11303 super.OnStoreSave(ctx);
11304
11305 PlayerBase player;
11306 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11307 {
11308 ctx.Write(true); // Keep track of if we should actually read this in or not
11309 //Save quickbar item bind
11310 int itemQBIndex = -1;
11311 itemQBIndex = player.FindQuickBarEntityIndex(this);
11312 ctx.Write(itemQBIndex);
11313 }
11314 else
11315 {
11316 ctx.Write(false); // Keep track of if we should actually read this in or not
11317 }
11318
11319 SaveAgents(ctx);//agent trasmission system
11320
11321 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11322 if (raib)
11323 {
11324 raib.OnStoreSave(ctx);
11325 }
11326 }
11327 //----------------------------------------------------------------
11328
11329 override void AfterStoreLoad()
11330 {
11331 super.AfterStoreLoad();
11332
11334 {
11336 }
11337
11338 if (GetStoreLoadedQuantity() != float.LOWEST)
11339 {
11341 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
11342 }
11343 }
11344
11345 override void EEOnAfterLoad()
11346 {
11347 super.EEOnAfterLoad();
11348
11350 {
11351 m_FixDamageSystemInit = false;
11352 }
11353
11356 }
11357
11358 bool CanBeDisinfected()
11359 {
11360 return false;
11361 }
11362
11363
11364 //----------------------------------------------------------------
11365 override void OnVariablesSynchronized()
11366 {
11367 if (m_Initialized)
11368 {
11369 #ifdef PLATFORM_CONSOLE
11370 //bruteforce it is
11371 if (IsSplitable())
11372 {
11373 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
11374 if (menu)
11375 {
11376 menu.Refresh();
11377 }
11378 }
11379 #endif
11380 }
11381
11383 {
11384 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
11385 m_WantPlayImpactSound = false;
11386 }
11387
11389 {
11390 SetWeightDirty();
11392 }
11393 if (m_VarWet != m_VarWetPrev)
11394 {
11397 }
11398
11399 if (m_SoundSyncPlay != 0)
11400 {
11401 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11402 m_SoundSyncPlay = 0;
11403 }
11404 if (m_SoundSyncStop != 0)
11405 {
11406 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11407 m_SoundSyncStop = 0;
11408 }
11409
11410 super.OnVariablesSynchronized();
11411 }
11412
11413 //------------------------- Quantity
11414 //----------------------------------------------------------------
11416 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11417 {
11418 if (!IsServerCheck(allow_client))
11419 return false;
11420
11421 if (!HasQuantity())
11422 return false;
11423
11424 float min = GetQuantityMin();
11425 float max = GetQuantityMax();
11426
11427 if (value <= (min + 0.001))
11428 value = min;
11429
11430 if (value == min)
11431 {
11432 if (destroy_config)
11433 {
11434 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11435 if (dstr)
11436 {
11437 m_VarQuantity = Math.Clamp(value, min, max);
11438 this.Delete();
11439 return true;
11440 }
11441 }
11442 else if (destroy_forced)
11443 {
11444 m_VarQuantity = Math.Clamp(value, min, max);
11445 this.Delete();
11446 return true;
11447 }
11448 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11449 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11450 }
11451
11452 float delta = m_VarQuantity;
11453 m_VarQuantity = Math.Clamp(value, min, max);
11454
11455 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11456 {
11457 delta = m_VarQuantity - delta;
11458
11459 if (delta)
11460 OnQuantityChanged(delta);
11461 }
11462
11463 SetVariableMask(VARIABLE_QUANTITY);
11464
11465 return false;
11466 }
11467
11468 //----------------------------------------------------------------
11470 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
11471 {
11472 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
11473 }
11474 //----------------------------------------------------------------
11475 void SetQuantityMax()
11476 {
11477 float max = GetQuantityMax();
11478 SetQuantity(max);
11479 }
11480
11481 override void SetQuantityToMinimum()
11482 {
11483 float min = GetQuantityMin();
11484 SetQuantity(min);
11485 }
11486 //----------------------------------------------------------------
11488 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
11489 {
11490 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
11491 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
11492 SetQuantity(result, destroy_config, destroy_forced);
11493 }
11494
11495 //----------------------------------------------------------------
11497 override float GetQuantityNormalized()
11498 {
11499 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
11500 }
11501
11503 {
11504 return GetQuantityNormalized();
11505 }
11506
11507 /*void SetAmmoNormalized(float value)
11508 {
11509 float value_clamped = Math.Clamp(value, 0, 1);
11510 Magazine this_mag = Magazine.Cast(this);
11511 int max_rounds = this_mag.GetAmmoMax();
11512 int result = value * max_rounds;//can the rounded if higher precision is required
11513 this_mag.SetAmmoCount(result);
11514 }*/
11515 //----------------------------------------------------------------
11516 override int GetQuantityMax()
11517 {
11518 int slot = -1;
11519 if (GetInventory())
11520 {
11521 InventoryLocation il = new InventoryLocation;
11522 GetInventory().GetCurrentInventoryLocation(il);
11523 slot = il.GetSlot();
11524 }
11525
11526 return GetTargetQuantityMax(slot);
11527 }
11528
11529 override int GetTargetQuantityMax(int attSlotID = -1)
11530 {
11531 float quantity_max = 0;
11532
11533 if (IsSplitable()) //only stackable/splitable items can check for stack size
11534 {
11535 if (attSlotID != -1)
11536 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11537
11538 if (quantity_max <= 0)
11539 quantity_max = m_VarStackMax;
11540 }
11541
11542 if (quantity_max <= 0)
11543 quantity_max = m_VarQuantityMax;
11544
11545 return quantity_max;
11546 }
11547 //----------------------------------------------------------------
11548 override int GetQuantityMin()
11549 {
11550 return m_VarQuantityMin;
11551 }
11552 //----------------------------------------------------------------
11553 int GetQuantityInit()
11554 {
11555 return m_VarQuantityInit;
11556 }
11557
11558 //----------------------------------------------------------------
11559 override bool HasQuantity()
11560 {
11561 return !(GetQuantityMax() - GetQuantityMin() == 0);
11562 }
11563
11564 override float GetQuantity()
11565 {
11566 return m_VarQuantity;
11567 }
11568
11569 bool IsFullQuantity()
11570 {
11571 return GetQuantity() >= GetQuantityMax();
11572 }
11573
11574 //Calculates weight of single item without attachments and cargo
11575 override float GetSingleInventoryItemWeightEx()
11576 {
11577 //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
11578 float weightEx = GetWeightEx();//overall weight of the item
11579 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
11580 return weightEx - special;
11581 }
11582
11583 // Obsolete, use GetSingleInventoryItemWeightEx() instead
11585 {
11587 }
11588
11589 override protected float GetWeightSpecialized(bool forceRecalc = false)
11590 {
11591 if (IsSplitable()) //quantity determines size of the stack
11592 {
11593 #ifdef DEVELOPER
11594 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11595 {
11596 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11597 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
11598 }
11599 #endif
11600
11601 return GetQuantity() * GetConfigWeightModified();
11602 }
11603 else if (HasEnergyManager())// items with energy manager
11604 {
11605 #ifdef DEVELOPER
11606 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11607 {
11608 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11609 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
11610 }
11611 #endif
11612 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11613 }
11614 else//everything else
11615 {
11616 #ifdef DEVELOPER
11617 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11618 {
11619 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11620 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
11621 }
11622 #endif
11623 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11624 }
11625 }
11626
11628 int GetNumberOfItems()
11629 {
11630 int item_count = 0;
11631 ItemBase item;
11632
11633 if (GetInventory().GetCargo() != NULL)
11634 {
11635 item_count = GetInventory().GetCargo().GetItemCount();
11636 }
11637
11638 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11639 {
11640 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11641 if (item)
11642 item_count += item.GetNumberOfItems();
11643 }
11644 return item_count;
11645 }
11646
11648 float GetUnitWeight(bool include_wetness = true)
11649 {
11650 float weight = 0;
11651 float wetness = 1;
11652 if (include_wetness)
11653 wetness += GetWet();
11654 if (IsSplitable()) //quantity determines size of the stack
11655 {
11656 weight = wetness * m_ConfigWeight;
11657 }
11658 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
11659 {
11660 weight = 1;
11661 }
11662 return weight;
11663 }
11664
11665 //-----------------------------------------------------------------
11666
11667 override void ClearInventory()
11668 {
11669 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
11670 {
11671 GameInventory inv = GetInventory();
11672 array<EntityAI> items = new array<EntityAI>;
11673 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
11674 for (int i = 0; i < items.Count(); i++)
11675 {
11676 ItemBase item = ItemBase.Cast(items.Get(i));
11677 if (item)
11678 {
11679 GetGame().ObjectDelete(item);
11680 }
11681 }
11682 }
11683 }
11684
11685 //------------------------- Energy
11686
11687 //----------------------------------------------------------------
11688 float GetEnergy()
11689 {
11690 float energy = 0;
11691 if (HasEnergyManager())
11692 {
11693 energy = GetCompEM().GetEnergy();
11694 }
11695 return energy;
11696 }
11697
11698
11699 override void OnEnergyConsumed()
11700 {
11701 super.OnEnergyConsumed();
11702
11704 }
11705
11706 override void OnEnergyAdded()
11707 {
11708 super.OnEnergyAdded();
11709
11711 }
11712
11713 // Converts energy (from Energy Manager) to quantity, if enabled.
11715 {
11716 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11717 {
11718 if (HasQuantity())
11719 {
11720 float energy_0to1 = GetCompEM().GetEnergy0To1();
11721 SetQuantityNormalized(energy_0to1);
11722 }
11723 }
11724 }
11725
11726 //----------------------------------------------------------------
11727 float GetHeatIsolationInit()
11728 {
11729 return ConfigGetFloat("heatIsolation");
11730 }
11731
11732 float GetHeatIsolation()
11733 {
11734 return m_HeatIsolation;
11735 }
11736
11737 float GetDryingIncrement(string pIncrementName)
11738 {
11739 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11740 if (GetGame().ConfigIsExisting(paramPath))
11741 return GetGame().ConfigGetFloat(paramPath);
11742
11743 return 0.0;
11744 }
11745
11746 float GetSoakingIncrement(string pIncrementName)
11747 {
11748 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11749 if (GetGame().ConfigIsExisting(paramPath))
11750 return GetGame().ConfigGetFloat(paramPath);
11751
11752 return 0.0;
11753 }
11754 //----------------------------------------------------------------
11755 override void SetWet(float value, bool allow_client = false)
11756 {
11757 if (!IsServerCheck(allow_client))
11758 return;
11759
11760 float min = GetWetMin();
11761 float max = GetWetMax();
11762
11763 float previousValue = m_VarWet;
11764
11765 m_VarWet = Math.Clamp(value, min, max);
11766
11767 if (previousValue != m_VarWet)
11768 {
11769 SetVariableMask(VARIABLE_WET);
11770 OnWetChanged(m_VarWet, previousValue);
11771 }
11772 }
11773 //----------------------------------------------------------------
11774 override void AddWet(float value)
11775 {
11776 SetWet(GetWet() + value);
11777 }
11778 //----------------------------------------------------------------
11779 override void SetWetMax()
11780 {
11782 }
11783 //----------------------------------------------------------------
11784 override float GetWet()
11785 {
11786 return m_VarWet;
11787 }
11788 //----------------------------------------------------------------
11789 override float GetWetMax()
11790 {
11791 return m_VarWetMax;
11792 }
11793 //----------------------------------------------------------------
11794 override float GetWetMin()
11795 {
11796 return m_VarWetMin;
11797 }
11798 //----------------------------------------------------------------
11799 override float GetWetInit()
11800 {
11801 return m_VarWetInit;
11802 }
11803 //----------------------------------------------------------------
11804 override void OnWetChanged(float newVal, float oldVal)
11805 {
11806 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11807 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11808 if (newLevel != oldLevel)
11809 {
11810 OnWetLevelChanged(newLevel,oldLevel);
11811 }
11812 }
11813
11814 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
11815 {
11816 SetWeightDirty();
11817 }
11818
11819 override EWetnessLevel GetWetLevel()
11820 {
11821 return GetWetLevelInternal(m_VarWet);
11822 }
11823
11824 //----------------------------------------------------------------
11825
11826 override void SetStoreLoad(bool value)
11827 {
11828 m_IsStoreLoad = value;
11829 }
11830
11831 override bool IsStoreLoad()
11832 {
11833 return m_IsStoreLoad;
11834 }
11835
11836 override void SetStoreLoadedQuantity(float value)
11837 {
11838 m_StoreLoadedQuantity = value;
11839 }
11840
11841 override float GetStoreLoadedQuantity()
11842 {
11843 return m_StoreLoadedQuantity;
11844 }
11845
11846 //----------------------------------------------------------------
11847
11848 float GetItemModelLength()
11849 {
11850 if (ConfigIsExisting("itemModelLength"))
11851 {
11852 return ConfigGetFloat("itemModelLength");
11853 }
11854 return 0;
11855 }
11856
11857 float GetItemAttachOffset()
11858 {
11859 if (ConfigIsExisting("itemAttachOffset"))
11860 {
11861 return ConfigGetFloat("itemAttachOffset");
11862 }
11863 return 0;
11864 }
11865
11866 override void SetCleanness(int value, bool allow_client = false)
11867 {
11868 if (!IsServerCheck(allow_client))
11869 return;
11870
11871 int previousValue = m_Cleanness;
11872
11873 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
11874
11875 if (previousValue != m_Cleanness)
11876 SetVariableMask(VARIABLE_CLEANNESS);
11877 }
11878
11879 override int GetCleanness()
11880 {
11881 return m_Cleanness;
11882 }
11883
11885 {
11886 return true;
11887 }
11888
11889 //----------------------------------------------------------------
11890 // ATTACHMENT LOCKING
11891 // Getters relevant to generic ActionLockAttachment
11892 int GetLockType()
11893 {
11894 return m_LockType;
11895 }
11896
11897 string GetLockSoundSet()
11898 {
11899 return m_LockSoundSet;
11900 }
11901
11902 //----------------------------------------------------------------
11903 //------------------------- Color
11904 // sets items color variable given color components
11905 override void SetColor(int r, int g, int b, int a)
11906 {
11911 SetVariableMask(VARIABLE_COLOR);
11912 }
11914 override void GetColor(out int r,out int g,out int b,out int a)
11915 {
11920 }
11921
11922 bool IsColorSet()
11923 {
11924 return IsVariableSet(VARIABLE_COLOR);
11925 }
11926
11928 string GetColorString()
11929 {
11930 int r,g,b,a;
11931 GetColor(r,g,b,a);
11932 r = r/255;
11933 g = g/255;
11934 b = b/255;
11935 a = a/255;
11936 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11937 }
11938 //----------------------------------------------------------------
11939 //------------------------- LiquidType
11940
11941 override void SetLiquidType(int value, bool allow_client = false)
11942 {
11943 if (!IsServerCheck(allow_client))
11944 return;
11945
11946 int old = m_VarLiquidType;
11947 m_VarLiquidType = value;
11948 OnLiquidTypeChanged(old,value);
11949 SetVariableMask(VARIABLE_LIQUIDTYPE);
11950 }
11951
11952 int GetLiquidTypeInit()
11953 {
11954 return ConfigGetInt("varLiquidTypeInit");
11955 }
11956
11957 override int GetLiquidType()
11958 {
11959 return m_VarLiquidType;
11960 }
11961
11962 protected void OnLiquidTypeChanged(int oldType, int newType)
11963 {
11964 if (newType == LIQUID_NONE && GetIsFrozen())
11965 SetFrozen(false);
11966 }
11967
11969 void UpdateQuickbarShortcutVisibility(PlayerBase player)
11970 {
11971 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11972 }
11973
11974 // -------------------------------------------------------------------------
11976 void OnInventoryEnter(Man player)
11977 {
11978 PlayerBase nplayer;
11979 if (PlayerBase.CastTo(nplayer, player))
11980 {
11981 m_CanPlayImpactSound = true;
11982 //nplayer.OnItemInventoryEnter(this);
11983 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11984 }
11985 }
11986
11987 // -------------------------------------------------------------------------
11989 void OnInventoryExit(Man player)
11990 {
11991 PlayerBase nplayer;
11992 if (PlayerBase.CastTo(nplayer,player))
11993 {
11994 //nplayer.OnItemInventoryExit(this);
11995 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11996
11997 }
11998
11999 //if (!GetGame().IsDedicatedServer())
12000 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12001
12002
12003 if (HasEnergyManager())
12004 {
12005 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12006 }
12007 }
12008
12009 // ADVANCED PLACEMENT EVENTS
12010 override void OnPlacementStarted(Man player)
12011 {
12012 super.OnPlacementStarted(player);
12013
12014 SetTakeable(false);
12015 }
12016
12017 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12018 {
12019 if (m_AdminLog)
12020 {
12021 m_AdminLog.OnPlacementComplete(player, this);
12022 }
12023
12024 super.OnPlacementComplete(player, position, orientation);
12025 }
12026
12027 //-----------------------------
12028 // AGENT SYSTEM
12029 //-----------------------------
12030 //--------------------------------------------------------------------------
12031 bool ContainsAgent(int agent_id)
12032 {
12033 if (agent_id & m_AttachedAgents)
12034 {
12035 return true;
12036 }
12037 else
12038 {
12039 return false;
12040 }
12041 }
12042
12043 //--------------------------------------------------------------------------
12044 override void RemoveAgent(int agent_id)
12045 {
12046 if (ContainsAgent(agent_id))
12047 {
12048 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12049 }
12050 }
12051
12052 //--------------------------------------------------------------------------
12053 override void RemoveAllAgents()
12054 {
12055 m_AttachedAgents = 0;
12056 }
12057 //--------------------------------------------------------------------------
12058 override void RemoveAllAgentsExcept(int agent_to_keep)
12059 {
12060 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12061 }
12062 // -------------------------------------------------------------------------
12063 override void InsertAgent(int agent, float count = 1)
12064 {
12065 if (count < 1)
12066 return;
12067 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12069 }
12070
12072 void TransferAgents(int agents)
12073 {
12075 }
12076
12077 // -------------------------------------------------------------------------
12078 override int GetAgents()
12079 {
12080 return m_AttachedAgents;
12081 }
12082 //----------------------------------------------------------------------
12083
12084 /*int GetContaminationType()
12085 {
12086 int contamination_type;
12087
12088 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12089 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12090 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12091 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12092
12093 Edible_Base edible = Edible_Base.Cast(this);
12094 int agents = GetAgents();
12095 if (edible)
12096 {
12097 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12098 if (profile)
12099 {
12100 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12101 }
12102 }
12103 if (agents & CONTAMINATED_MASK)
12104 {
12105 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12106 }
12107 if (agents & POISONED_MASK)
12108 {
12109 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12110 }
12111 if (agents & NERVE_GAS_MASK)
12112 {
12113 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12114 }
12115 if (agents & DIRTY_MASK)
12116 {
12117 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12118 }
12119
12120 return agents;
12121 }*/
12122
12123 // -------------------------------------------------------------------------
12124 bool LoadAgents(ParamsReadContext ctx, int version)
12125 {
12126 if (!ctx.Read(m_AttachedAgents))
12127 return false;
12128 return true;
12129 }
12130 // -------------------------------------------------------------------------
12132 {
12133
12135 }
12136 // -------------------------------------------------------------------------
12137
12139 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12140 {
12141 super.CheckForRoofLimited(timeTresholdMS);
12142
12143 float time = GetGame().GetTime();
12144 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12145 {
12146 m_PreviousRoofTestTime = time;
12147 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12148 }
12149 }
12150
12151 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12152 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12153 {
12154 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12155 {
12156 return 0;
12157 }
12158
12159 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12160 {
12161 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12162 if (filter)
12163 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12164 else
12165 return 0;//otherwise return 0 when no filter attached
12166 }
12167
12168 string subclassPath, entryName;
12169
12170 switch (type)
12171 {
12172 case DEF_BIOLOGICAL:
12173 entryName = "biological";
12174 break;
12175 case DEF_CHEMICAL:
12176 entryName = "chemical";
12177 break;
12178 default:
12179 entryName = "biological";
12180 break;
12181 }
12182
12183 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12184
12185 return GetGame().ConfigGetFloat(subclassPath + entryName);
12186 }
12187
12188
12189
12191 override void EEOnCECreate()
12192 {
12193 if (!IsMagazine())
12195
12197 }
12198
12199
12200 //-------------------------
12201 // OPEN/CLOSE USER ACTIONS
12202 //-------------------------
12204 void Open();
12205 void Close();
12206 bool IsOpen()
12207 {
12208 return true;
12209 }
12210
12211 override bool CanDisplayCargo()
12212 {
12213 return IsOpen();
12214 }
12215
12216
12217 // ------------------------------------------------------------
12218 // CONDITIONS
12219 // ------------------------------------------------------------
12220 override bool CanPutInCargo(EntityAI parent)
12221 {
12222 if (parent)
12223 {
12224 if (parent.IsInherited(DayZInfected))
12225 return true;
12226
12227 if (!parent.IsRuined())
12228 return true;
12229 }
12230
12231 return true;
12232 }
12233
12234 override bool CanPutAsAttachment(EntityAI parent)
12235 {
12236 if (!super.CanPutAsAttachment(parent))
12237 {
12238 return false;
12239 }
12240
12241 if (!IsRuined() && !parent.IsRuined())
12242 {
12243 return true;
12244 }
12245
12246 return false;
12247 }
12248
12249 override bool CanReceiveItemIntoCargo(EntityAI item)
12250 {
12251 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12252 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12253 // return false;
12254
12255 return super.CanReceiveItemIntoCargo(item);
12256 }
12257
12258 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12259 {
12260 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12261 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12262 // return false;
12263
12264 GameInventory attachmentInv = attachment.GetInventory();
12265 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12266 {
12267 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12268 return false;
12269 }
12270
12271 InventoryLocation loc = new InventoryLocation();
12272 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12273 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12274 return false;
12275
12276 return super.CanReceiveAttachment(attachment, slotId);
12277 }
12278
12279 override bool CanReleaseAttachment(EntityAI attachment)
12280 {
12281 if (!super.CanReleaseAttachment(attachment))
12282 return false;
12283
12284 return GetInventory().AreChildrenAccessible();
12285 }
12286
12287 /*override bool CanLoadAttachment(EntityAI attachment)
12288 {
12289 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12290 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12291 // return false;
12292
12293 GameInventory attachmentInv = attachment.GetInventory();
12294 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12295 {
12296 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12297 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12298
12299 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12300 return false;
12301 }
12302
12303 return super.CanLoadAttachment(attachment);
12304 }*/
12305
12306 // Plays muzzle flash particle effects
12307 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12308 {
12309 int id = muzzle_owner.GetMuzzleID();
12310 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12311
12312 if (WPOF_array)
12313 {
12314 for (int i = 0; i < WPOF_array.Count(); i++)
12315 {
12316 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12317
12318 if (WPOF)
12319 {
12320 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12321 }
12322 }
12323 }
12324 }
12325
12326 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12327 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12328 {
12329 int id = muzzle_owner.GetMuzzleID();
12330 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12331
12332 if (WPOBE_array)
12333 {
12334 for (int i = 0; i < WPOBE_array.Count(); i++)
12335 {
12336 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12337
12338 if (WPOBE)
12339 {
12340 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12341 }
12342 }
12343 }
12344 }
12345
12346 // Plays all weapon overheating particles
12347 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12348 {
12349 int id = muzzle_owner.GetMuzzleID();
12350 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12351
12352 if (WPOOH_array)
12353 {
12354 for (int i = 0; i < WPOOH_array.Count(); i++)
12355 {
12356 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12357
12358 if (WPOOH)
12359 {
12360 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12361 }
12362 }
12363 }
12364 }
12365
12366 // Updates all weapon overheating particles
12367 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12368 {
12369 int id = muzzle_owner.GetMuzzleID();
12370 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12371
12372 if (WPOOH_array)
12373 {
12374 for (int i = 0; i < WPOOH_array.Count(); i++)
12375 {
12376 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12377
12378 if (WPOOH)
12379 {
12380 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12381 }
12382 }
12383 }
12384 }
12385
12386 // Stops overheating particles
12387 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12388 {
12389 int id = muzzle_owner.GetMuzzleID();
12390 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12391
12392 if (WPOOH_array)
12393 {
12394 for (int i = 0; i < WPOOH_array.Count(); i++)
12395 {
12396 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12397
12398 if (WPOOH)
12399 {
12400 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12401 }
12402 }
12403 }
12404 }
12405
12406 //----------------------------------------------------------------
12407 //Item Behaviour - unified approach
12408 override bool IsHeavyBehaviour()
12409 {
12410 if (m_ItemBehaviour == 0)
12411 {
12412 return true;
12413 }
12414
12415 return false;
12416 }
12417
12418 override bool IsOneHandedBehaviour()
12419 {
12420 if (m_ItemBehaviour == 1)
12421 {
12422 return true;
12423 }
12424
12425 return false;
12426 }
12427
12428 override bool IsTwoHandedBehaviour()
12429 {
12430 if (m_ItemBehaviour == 2)
12431 {
12432 return true;
12433 }
12434
12435 return false;
12436 }
12437
12438 bool IsDeployable()
12439 {
12440 return false;
12441 }
12442
12444 float GetDeployTime()
12445 {
12446 return UATimeSpent.DEFAULT_DEPLOY;
12447 }
12448
12449
12450 //----------------------------------------------------------------
12451 // Item Targeting (User Actions)
12452 override void SetTakeable(bool pState)
12453 {
12454 m_IsTakeable = pState;
12455 SetSynchDirty();
12456 }
12457
12458 override bool IsTakeable()
12459 {
12460 return m_IsTakeable;
12461 }
12462
12463 // For cases where we want to show object widget which cant be taken to hands
12465 {
12466 return false;
12467 }
12468
12470 protected void PreLoadSoundAttachmentType()
12471 {
12472 string att_type = "None";
12473
12474 if (ConfigIsExisting("soundAttType"))
12475 {
12476 att_type = ConfigGetString("soundAttType");
12477 }
12478
12479 m_SoundAttType = att_type;
12480 }
12481
12482 override string GetAttachmentSoundType()
12483 {
12484 return m_SoundAttType;
12485 }
12486
12487 //----------------------------------------------------------------
12488 //SOUNDS - ItemSoundHandler
12489 //----------------------------------------------------------------
12490
12491 string GetPlaceSoundset(); // played when deploy starts
12492 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
12493 string GetDeploySoundset(); // played when deploy sucessfully finishes
12494
12496 {
12497 if (!m_ItemSoundHandler)
12499
12500 return m_ItemSoundHandler;
12501 }
12502
12503 // override to initialize sounds
12504 protected void InitItemSounds()
12505 {
12506 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
12507 return;
12508
12510
12511 if (GetPlaceSoundset() != string.Empty)
12512 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
12513
12514 if (GetDeploySoundset() != string.Empty)
12515 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
12516
12517 SoundParameters params = new SoundParameters();
12518 params.m_Loop = true;
12519 if (GetLoopDeploySoundset() != string.Empty)
12520 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
12521 }
12522
12523 // Start sound using ItemSoundHandler
12524 void StartItemSoundServer(int id)
12525 {
12526 if (!GetGame().IsServer())
12527 return;
12528
12529 m_SoundSyncPlay = id;
12530 SetSynchDirty();
12531
12532 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
12534 }
12535
12536 // Stop sound using ItemSoundHandler
12537 void StopItemSoundServer(int id)
12538 {
12539 if (!GetGame().IsServer())
12540 return;
12541
12542 m_SoundSyncStop = id;
12543 SetSynchDirty();
12544
12545 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
12547 }
12548
12549 protected void ClearStartItemSoundServer()
12550 {
12551 m_SoundSyncPlay = 0;
12552 }
12553
12554 protected void ClearStopItemSoundServer()
12555 {
12556 m_SoundSyncStop = 0;
12557 }
12558
12560 void PlayAttachSound(string slot_type)
12561 {
12562 if (!GetGame().IsDedicatedServer())
12563 {
12564 if (ConfigIsExisting("attachSoundSet"))
12565 {
12566 string cfg_path = "";
12567 string soundset = "";
12568 string type_name = GetType();
12569
12570 TStringArray cfg_soundset_array = new TStringArray;
12571 TStringArray cfg_slot_array = new TStringArray;
12572 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12573 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12574
12575 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12576 {
12577 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12578 {
12579 if (cfg_slot_array[i] == slot_type)
12580 {
12581 soundset = cfg_soundset_array[i];
12582 break;
12583 }
12584 }
12585 }
12586
12587 if (soundset != "")
12588 {
12589 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
12590 sound.SetAutodestroy(true);
12591 }
12592 }
12593 }
12594 }
12595
12596 void PlayDetachSound(string slot_type)
12597 {
12598 //TODO - evaluate if needed and devise universal config structure if so
12599 }
12600
12601 void OnApply(PlayerBase player);
12602
12604 {
12605 return 1.0;
12606 };
12607 //returns applicable selection
12608 array<string> GetHeadHidingSelection()
12609 {
12611 }
12612
12614 {
12616 }
12617
12618 WrittenNoteData GetWrittenNoteData() {};
12619
12621 {
12622 SetDynamicPhysicsLifeTime(0.01);
12623 m_ItemBeingDroppedPhys = false;
12624 }
12625
12627 {
12628 array<string> zone_names = new array<string>;
12629 GetDamageZones(zone_names);
12630 for (int i = 0; i < zone_names.Count(); i++)
12631 {
12632 SetHealthMax(zone_names.Get(i),"Health");
12633 }
12634 SetHealthMax("","Health");
12635 }
12636
12638 void SetZoneDamageCEInit()
12639 {
12640 float global_health = GetHealth01("","Health");
12641 array<string> zones = new array<string>;
12642 GetDamageZones(zones);
12643 //set damage of all zones to match global health level
12644 for (int i = 0; i < zones.Count(); i++)
12645 {
12646 SetHealth01(zones.Get(i),"Health",global_health);
12647 }
12648 }
12649
12651 bool IsCoverFaceForShave(string slot_name)
12652 {
12653 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12654 }
12655
12656 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12657 {
12658 if (!hasRootAsPlayer)
12659 {
12660 if (refParentIB)
12661 {
12662 // parent is wet
12663 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
12664 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12665 // parent has liquid inside
12666 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
12667 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12668 // drying
12669 else if (m_VarWet > m_VarWetMin)
12670 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
12671 }
12672 else
12673 {
12674 // drying on ground or inside non-itembase (car, ...)
12675 if (m_VarWet > m_VarWetMin)
12676 AddWet(-1 * delta * GetDryingIncrement("ground"));
12677 }
12678 }
12679 }
12680
12681 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12682 {
12684 {
12685 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
12686 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12687 {
12688 float heatPermCoef = 1.0;
12689 EntityAI ent = this;
12690 while (ent)
12691 {
12692 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12693 ent = ent.GetHierarchyParent();
12694 }
12695
12696 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12697 }
12698 }
12699 }
12700
12701 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
12702 {
12703 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
12704 EntityAI parent = GetHierarchyParent();
12705 if (!parent)
12706 {
12707 hasParent = false;
12708 hasRootAsPlayer = false;
12709 }
12710 else
12711 {
12712 hasParent = true;
12713 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12714 refParentIB = ItemBase.Cast(parent);
12715 }
12716 }
12717
12718 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12719 {
12720 // this is stub, implemented on Edible_Base
12721 }
12722
12723 bool CanDecay()
12724 {
12725 // return true used on selected food clases so they can decay
12726 return false;
12727 }
12728
12729 protected bool CanProcessDecay()
12730 {
12731 // this is stub, implemented on Edible_Base class
12732 // used to determine whether it is still necessary for the food to decay
12733 return false;
12734 }
12735
12736 protected bool CanHaveWetness()
12737 {
12738 // return true used on selected items that have a wetness effect
12739 return false;
12740 }
12741
12743 bool CanBeConsumed(ConsumeConditionData data = null)
12744 {
12745 return !GetIsFrozen() && IsOpen();
12746 }
12747
12748 override void ProcessVariables()
12749 {
12750 bool hasParent = false, hasRootAsPlayer = false;
12751 ItemBase refParentIB;
12752
12753 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12754 bool foodDecay = g_Game.IsFoodDecayEnabled();
12755
12756 if (wwtu || foodDecay)
12757 {
12758 bool processWetness = wwtu && CanHaveWetness();
12759 bool processTemperature = wwtu && CanHaveTemperature();
12760 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12761
12762 if (processWetness || processTemperature || processDecay)
12763 {
12764 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12765
12766 if (processWetness)
12767 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12768
12769 if (processTemperature)
12770 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12771
12772 if (processDecay)
12773 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12774 }
12775 }
12776 }
12777
12780 {
12781 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12782 }
12783
12784 override float GetTemperatureFreezeThreshold()
12785 {
12787 return Liquid.GetFreezeThreshold(GetLiquidType());
12788
12789 return super.GetTemperatureFreezeThreshold();
12790 }
12791
12792 override float GetTemperatureThawThreshold()
12793 {
12795 return Liquid.GetThawThreshold(GetLiquidType());
12796
12797 return super.GetTemperatureThawThreshold();
12798 }
12799
12800 override float GetItemOverheatThreshold()
12801 {
12803 return Liquid.GetBoilThreshold(GetLiquidType());
12804
12805 return super.GetItemOverheatThreshold();
12806 }
12807
12808 override float GetTemperatureFreezeTime()
12809 {
12810 if (HasQuantity())
12811 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12812
12813 return super.GetTemperatureFreezeTime();
12814 }
12815
12816 override float GetTemperatureThawTime()
12817 {
12818 if (HasQuantity())
12819 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
12820
12821 return super.GetTemperatureThawTime();
12822 }
12823
12825 void AffectLiquidContainerOnFill(int liquid_type, float amount);
12827 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
12828
12829 bool IsCargoException4x3(EntityAI item)
12830 {
12831 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12832 }
12833
12835 {
12836 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12837 }
12838
12840 void AddLightSourceItem(ItemBase lightsource)
12841 {
12842 m_LightSourceItem = lightsource;
12843 }
12844
12846 {
12847 m_LightSourceItem = null;
12848 }
12849
12851 {
12852 return m_LightSourceItem;
12853 }
12854
12856 array<int> GetValidFinishers()
12857 {
12858 return null;
12859 }
12860
12862 bool GetActionWidgetOverride(out typename name)
12863 {
12864 return false;
12865 }
12866
12867 bool PairWithDevice(notnull ItemBase otherDevice)
12868 {
12869 if (GetGame().IsServer())
12870 {
12871 ItemBase explosive = otherDevice;
12873 if (!trg)
12874 {
12875 trg = RemoteDetonatorTrigger.Cast(otherDevice);
12876 explosive = this;
12877 }
12878
12879 explosive.PairRemote(trg);
12880 trg.SetControlledDevice(explosive);
12881
12882 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12883 trg.SetPersistentPairID(persistentID);
12884 explosive.SetPersistentPairID(persistentID);
12885
12886 return true;
12887 }
12888 return false;
12889 }
12890
12892 float GetBaitEffectivity()
12893 {
12894 float ret = 1.0;
12895 if (HasQuantity())
12896 ret *= GetQuantityNormalized();
12897 ret *= GetHealth01();
12898
12899 return ret;
12900 }
12901
12902 #ifdef DEVELOPER
12903 override void SetDebugItem()
12904 {
12905 super.SetDebugItem();
12906 _itemBase = this;
12907 }
12908
12909 override string GetDebugText()
12910 {
12911 string text = super.GetDebugText();
12912
12913 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
12914 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
12915
12916 return text;
12917 }
12918 #endif
12919
12920 bool CanBeUsedForSuicide()
12921 {
12922 return true;
12923 }
12924
12926 //DEPRECATED BELOW
12928 // Backwards compatibility
12929 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12930 {
12931 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
12932 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
12933 }
12934
12935 // replaced by ItemSoundHandler
12936 protected EffectSound m_SoundDeployFinish;
12937 protected EffectSound m_SoundPlace;
12938 protected EffectSound m_DeployLoopSoundEx;
12939 protected EffectSound m_SoundDeploy;
12940 bool m_IsPlaceSound;
12941 bool m_IsDeploySound;
12943
12944 string GetDeployFinishSoundset();
12945 void PlayDeploySound();
12946 void PlayDeployFinishSound();
12947 void PlayPlaceSound();
12948 void PlayDeployLoopSoundEx();
12949 void StopDeployLoopSoundEx();
12950 void SoundSynchRemoteReset();
12951 void SoundSynchRemote();
12952 bool UsesGlobalDeploy(){return false;}
12953 bool CanPlayDeployLoopSound(){return false;}
12955 bool IsPlaceSound(){return m_IsPlaceSound;}
12956 bool IsDeploySound(){return m_IsDeploySound;}
12957 void SetIsPlaceSound(bool is_place_sound);
12958 void SetIsDeploySound(bool is_deploy_sound);
12959}
12960
12961EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
12962{
12963 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
12964 if (entity)
12965 {
12966 bool is_item = entity.IsInherited(ItemBase);
12967 if (is_item && full_quantity)
12968 {
12969 ItemBase item = ItemBase.Cast(entity);
12970 item.SetQuantity(item.GetQuantityInit());
12971 }
12972 }
12973 else
12974 {
12975 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
12976 return NULL;
12977 }
12978 return entity;
12979}
12980
12981void SetupSpawnedItem(ItemBase item, float health, float quantity)
12982{
12983 if (item)
12984 {
12985 if (health > 0)
12986 item.SetHealth("", "", health);
12987
12988 if (item.CanHaveTemperature())
12989 {
12990 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
12991 if (item.CanFreeze())
12992 item.SetFrozen(false);
12993 }
12994
12995 if (item.HasEnergyManager())
12996 {
12997 if (quantity >= 0)
12998 {
12999 item.GetCompEM().SetEnergy0To1(quantity);
13000 }
13001 else
13002 {
13003 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13004 }
13005 }
13006 else if (item.IsMagazine())
13007 {
13008 Magazine mag = Magazine.Cast(item);
13009 if (quantity >= 0)
13010 {
13011 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13012 }
13013 else
13014 {
13015 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13016 }
13017
13018 }
13019 else
13020 {
13021 if (quantity >= 0)
13022 {
13023 item.SetQuantityNormalized(quantity, false);
13024 }
13025 else
13026 {
13027 item.SetQuantity(Math.AbsFloat(quantity));
13028 }
13029
13030 }
13031 }
13032}
13033
13034#ifdef DEVELOPER
13035ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13036#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()

Используется в Entity::GetWeightEx().