Add SmartAmmo low-ammo alerts

This commit is contained in:
DuvelCorp
2026-09-12 10:57:27 +02:00
parent af31acdb3e
commit 22232364b1
4 changed files with 189 additions and 17 deletions
+26
View File
@@ -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", {