zAmmo: total ammo meter (centered % + side gauge) with options

This commit is contained in:
DuvelCorp
2026-10-04 20:37:54 +02:00
parent bb5c875835
commit f6b495d68d
3 changed files with 208 additions and 0 deletions
+30
View File
@@ -301,6 +301,14 @@ local function MTH_ZB_EnsureButtonOptionDefaults(buttonName)
saved["showammoname"] = true
end
saved["showammoname"] = saved["showammoname"] and true or false
if saved["showtotalperc"] == nil then
saved["showtotalperc"] = true
end
saved["showtotalperc"] = saved["showtotalperc"] and true or false
if saved["showtotalgauge"] == nil then
saved["showtotalgauge"] = false
end
saved["showtotalgauge"] = saved["showtotalgauge"] and true or false
end
if buttonName == "zButtonTrap" then
@@ -596,6 +604,28 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
end
end,
})
parentBox:Checkbox(containerName.."ShowTotalPercent", MTH_ZB_L("ZB_LABEL_SHOW_TOTAL_PERCENT", "Show total % (center)"), {
checked = saved["showtotalperc"],
onClick = function()
if not this then return end
local checked = this:GetChecked() == 1
ZHunterMod_Saved[buttonName]["showtotalperc"] = checked
if buttonObj and buttonObj.ammoname and not buttonObj.isspell then
zButtonAmmo_UpdateButton(buttonObj)
end
end,
})
parentBox:Checkbox(containerName.."ShowTotalGauge", MTH_ZB_L("ZB_LABEL_SHOW_TOTAL_GAUGE", "Show total gauge (side)"), {
checked = saved["showtotalgauge"],
onClick = function()
if not this then return end
local checked = this:GetChecked() == 1
ZHunterMod_Saved[buttonName]["showtotalgauge"] = checked
if buttonObj and buttonObj.ammoname and not buttonObj.isspell then
zButtonAmmo_UpdateButton(buttonObj)
end
end,
})
end
MTH_SetButtonEnabledState(buttonName, buttonObj, saved["enabled"] and true or false)