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

◆ GetHeatIsolationInit()

float SpawnItemOnLocation::GetHeatIsolationInit ( )
protected

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

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

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