mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-10-05 22:10:01 +00:00
Add SmartAmmo low-ammo alerts
This commit is contained in:
@@ -1333,6 +1333,32 @@ function MTH_SetupGeneralOptions()
|
||||
if not smartModuleEnabled and weaponSwapToggle and weaponSwapToggle.Disable then weaponSwapToggle:Disable() end
|
||||
smartBox:Note("MetaHuntGeneralSmartAmmoWeaponSwapHelp", "When you swap between gun and bow/crossbow, instantly equips the best matching ammo from your bags.")
|
||||
|
||||
local lowAmmoWarningEnabled = type(MTHSmartAmmo_GetLowAmmoWarningEnabled) == "function" and MTHSmartAmmo_GetLowAmmoWarningEnabled() and true or false
|
||||
local lowAmmoWarningToggle = smartBox:Checkbox("MetaHuntGeneralSmartAmmoLowWarningToggle", "Enable low-ammo warnings", {
|
||||
checked = lowAmmoWarningEnabled,
|
||||
onClick = function()
|
||||
if type(MTHSmartAmmo_SetLowAmmoWarningEnabled) == "function" then
|
||||
MTHSmartAmmo_SetLowAmmoWarningEnabled(this:GetChecked() == 1 and 1 or nil)
|
||||
end
|
||||
end,
|
||||
})
|
||||
if not smartModuleEnabled and lowAmmoWarningToggle and lowAmmoWarningToggle.Disable then lowAmmoWarningToggle:Disable() end
|
||||
|
||||
local lowAmmoThreshold = type(MTHSmartAmmo_GetLowAmmoThreshold) == "function" and MTHSmartAmmo_GetLowAmmoThreshold() or 200
|
||||
local lowAmmoInput = smartBox:EditRow("MetaHuntGeneralSmartAmmoLowThresholdLabel", "Low-ammo threshold:", "MetaHuntGeneralSmartAmmoLowThreshold", 48, {
|
||||
numeric = true,
|
||||
onChange = function()
|
||||
if this:HasFocus() and type(MTHSmartAmmo_SetLowAmmoThreshold) == "function" then
|
||||
MTHSmartAmmo_SetLowAmmoThreshold(this:GetText())
|
||||
end
|
||||
end,
|
||||
})
|
||||
if lowAmmoInput then
|
||||
lowAmmoInput:SetText(tostring(lowAmmoThreshold))
|
||||
if not smartModuleEnabled and lowAmmoInput.Disable then lowAmmoInput:Disable() end
|
||||
end
|
||||
smartBox:Note("MetaHuntGeneralSmartAmmoLowThresholdHelp", "Warns once when your total arrows or bullets reach this amount. Default: 200.")
|
||||
|
||||
-- ===== LEFT: Auto-Strip =====
|
||||
local stripBox = panel:Box("left", "MetaHuntGeneralAutoStripBox", "Auto-Strip")
|
||||
stripBox:Checkbox("MetaHuntGeneralAutoStripToggle", "Enable Auto-Strip on Combat Exit", {
|
||||
|
||||
Reference in New Issue
Block a user