mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-10-06 06:20:01 +00:00
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:
+35
-3
@@ -794,16 +794,48 @@ function MTH_CelebrateAmmoFallback(previousAmmo, newAmmo)
|
||||
})
|
||||
end
|
||||
|
||||
function MTH_CelebrateLowAmmo(ammoType, total, threshold)
|
||||
function MTH_CelebrateLowAmmo(ammoType, total)
|
||||
if not MTH_FX_IsEnabled("combat.lowammo") or not Sauce or not MTH_FX_EnsureFrames() then return end
|
||||
MTH_Celebrate("Low " .. tostring(ammoType or "ammo") .. "!", tostring(total or 0) .. " left.", "fanfare", 5)
|
||||
MTH_FX_TitleFS:SetTextColor(1, 0.55, 0.10)
|
||||
MTH_FX_TitleFS:SetText("Running low on " .. tostring(ammoType or "ammo") .. "!")
|
||||
MTH_FX_SubFS:SetText(tostring(total or 0) .. " left before you're reduced to harsh language.")
|
||||
|
||||
Sauce:Stop(MTH_FX_MsgFrame)
|
||||
MTH_FX_MsgFrame:SetAlpha(0)
|
||||
MTH_FX_MsgFrame:Show()
|
||||
Sauce:Sequence({
|
||||
Sauce:FadeTo(MTH_FX_MsgFrame, 1, 0.18),
|
||||
Sauce:Tween(MTH_FX_MsgFrame, {
|
||||
type = "mth_shake",
|
||||
duration = 0.55,
|
||||
easing = "linear",
|
||||
magnitude = 11,
|
||||
freq = 42,
|
||||
}),
|
||||
Sauce:FadeOut(MTH_FX_MsgFrame, 0.7, "inQuad", { delay = 5 }),
|
||||
})
|
||||
end
|
||||
|
||||
function MTH_CelebrateAmmoZero(ammoType)
|
||||
if not MTH_FX_IsEnabled("combat.ammozero") or not Sauce or not MTH_FX_EnsureFrames() then return end
|
||||
MTH_Celebrate("No " .. tostring(ammoType or "ammo") .. " left!", "Excellent planning. Your ranged weapon is now decorative.", "victory", 5)
|
||||
MTH_FX_TitleFS:SetTextColor(1, 0.15, 0.15)
|
||||
MTH_FX_TitleFS:SetText("Out of " .. tostring(ammoType or "ammo") .. "!")
|
||||
MTH_FX_SubFS:SetText("Your ranged weapon is now a very expensive club. Well done.")
|
||||
|
||||
Sauce:Stop(MTH_FX_MsgFrame)
|
||||
MTH_FX_MsgFrame:SetAlpha(0)
|
||||
MTH_FX_MsgFrame:Show()
|
||||
Sauce:Sequence({
|
||||
Sauce:FadeTo(MTH_FX_MsgFrame, 1, 0.18),
|
||||
Sauce:Tween(MTH_FX_MsgFrame, {
|
||||
type = "mth_shake",
|
||||
duration = 0.55,
|
||||
easing = "linear",
|
||||
magnitude = 11,
|
||||
freq = 42,
|
||||
}),
|
||||
Sauce:FadeOut(MTH_FX_MsgFrame, 0.7, "inQuad", { delay = 5 }),
|
||||
})
|
||||
end
|
||||
|
||||
-- DEBUG: mark that the whole file finished loading and record which globals it
|
||||
|
||||
+14
-14
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user