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

◆ GetSoakingIncrement()

float SpawnItemOnLocation::GetSoakingIncrement ( string pIncrementName)
protected

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

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