Fix SmartAmmo low-ammo warnings

- Remove infinite tail-recursion threshold getter that hard-froze the client on /rl
- Fix double-count (equipped ammo was added to the bag total)
- Make it true crossing-only: warn only when the total drops across the threshold, never on cold baseline or restock
- Use the shaking warning banner instead of a celebration, with sarcastic chat/banner copy
- Options: fix legacy EditBox HasFocus error on the threshold input; move Pet Auto-Teach to the right column
This commit is contained in:
DuvelCorp
2026-09-12 12:08:54 +02:00
parent 22232364b1
commit f3af63926e
4 changed files with 69 additions and 25 deletions
+14 -14
View File
@@ -1348,7 +1348,7 @@ function MTH_SetupGeneralOptions()
local lowAmmoInput = smartBox:EditRow("MetaHuntGeneralSmartAmmoLowThresholdLabel", "Low-ammo threshold:", "MetaHuntGeneralSmartAmmoLowThreshold", 48, {
numeric = true,
onChange = function()
if this:HasFocus() and type(MTHSmartAmmo_SetLowAmmoThreshold) == "function" then
if type(MTHSmartAmmo_SetLowAmmoThreshold) == "function" then
MTHSmartAmmo_SetLowAmmoThreshold(this:GetText())
end
end,
@@ -1398,19 +1398,6 @@ function MTH_SetupGeneralOptions()
})
antiBox:Note("MetaHuntGeneralAntiDazeHelp", "Cancels Cheetah/Pack when dazed.")
-- ===== LEFT: Pet Auto-Teach =====
local petTeachBox = panel:Box("left", "MetaHuntGeneralPetTeachBox", "Pet Auto-Teach")
local growlEnabled = (type(MTH_Growl_IsEnabled) == "function" and MTH_Growl_IsEnabled()) or false
petTeachBox:Checkbox("MetaHuntGeneralPetTeachGrowlToggle", "Activate Auto-Teach of Growl (Max rank)", {
checked = growlEnabled,
onClick = function()
if type(MTH_Growl_SetEnabled) == "function" then
MTH_Growl_SetEnabled(this:GetChecked() == 1)
end
end,
})
petTeachBox:Note("MetaHuntGeneralPetTeachGrowlHelp", "When you tame a beast, offers to teach it the best Growl rank for its level.")
-- ===== RIGHT: Tooltips =====
local tooltipsBox = panel:Box("right", "MetaHuntGeneralTooltipsBox", "Tooltips")
local tooltipsStore = MTH and MTH.GetModuleCharSavedVariables and MTH:GetModuleCharSavedVariables("tooltips")
@@ -1546,5 +1533,18 @@ function MTH_SetupGeneralOptions()
})
bagsBox:Note("MetaHuntGeneralBagDmgHelp", "Damage is heat-coloured from red (7.5) to green (20.5).")
-- ===== RIGHT: Pet Auto-Teach =====
local petTeachBox = panel:Box("right", "MetaHuntGeneralPetTeachBox", "Pet Auto-Teach")
local growlEnabled = (type(MTH_Growl_IsEnabled) == "function" and MTH_Growl_IsEnabled()) or false
petTeachBox:Checkbox("MetaHuntGeneralPetTeachGrowlToggle", "Activate Auto-Teach of Growl (Max rank)", {
checked = growlEnabled,
onClick = function()
if type(MTH_Growl_SetEnabled) == "function" then
MTH_Growl_SetEnabled(this:GetChecked() == 1)
end
end,
})
petTeachBox:Note("MetaHuntGeneralPetTeachGrowlHelp", "When you tame a beast, offers to teach it the best Growl rank for its level.")
panel:Finish()
end