mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-10-15 04:40:49 +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
|
||||
|
||||
Reference in New Issue
Block a user