Created
February 23, 2026 01:49
-
-
Save hclivess/0cd4d391488548c00814a2fdfdeb039f to your computer and use it in GitHub Desktop.
Beyond All Reason widget - Mutes all chat messages, map pings (including sound and visuals), and map drawings. Toggle with /harmony
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function widget:GetInfo() | |
| return { | |
| name = "Harmony", | |
| desc = "Mutes all chat messages, map pings (including sound and visuals), and map drawings. Toggle with /harmony", | |
| author = "Custom", | |
| date = "2026-02-23", | |
| license = "GNU GPL v2", | |
| layer = 9999, | |
| enabled = true, | |
| } | |
| end | |
| local myPlayerID | |
| local muted = true | |
| local originalMapVolume | |
| local initDone = false | |
| -- BAR widgets to disable via engine command | |
| local widgetsToDisable = { | |
| "Chat", | |
| "Point Tracker", | |
| "Mapmark Ping", | |
| "Mapmarks FX", | |
| } | |
| local function disableWidgets() | |
| for _, name in ipairs(widgetsToDisable) do | |
| Spring.SendCommands("luaui disablewidget " .. name) | |
| end | |
| end | |
| local function enableWidgets() | |
| for _, name in ipairs(widgetsToDisable) do | |
| Spring.SendCommands("luaui enablewidget " .. name) | |
| end | |
| end | |
| function widget:Initialize() | |
| myPlayerID = Spring.GetMyPlayerID() | |
| originalMapVolume = Spring.GetConfigFloat("snd_volmap", 1.0) | |
| Spring.SetConfigFloat("snd_volmap", 0) | |
| disableWidgets() | |
| Spring.Echo("[Harmony] Widget enabled - all chat, pings, drawings, and sounds are muted.") | |
| Spring.Echo("[Harmony] Type /harmony to toggle on/off.") | |
| end | |
| -- Retry on first game frame in case widgets loaded after us | |
| function widget:GameFrame(frame) | |
| if not initDone then | |
| initDone = true | |
| if muted then | |
| disableWidgets() | |
| end | |
| end | |
| end | |
| function widget:Shutdown() | |
| if originalMapVolume then | |
| Spring.SetConfigFloat("snd_volmap", originalMapVolume) | |
| end | |
| enableWidgets() | |
| Spring.Echo("[Harmony] Widget disabled - chat, pings, and drawings restored.") | |
| end | |
| function widget:TextCommand(command) | |
| if command == "harmony" then | |
| muted = not muted | |
| if muted then | |
| originalMapVolume = Spring.GetConfigFloat("snd_volmap", 1.0) | |
| Spring.SetConfigFloat("snd_volmap", 0) | |
| disableWidgets() | |
| Spring.Echo("[Harmony] Mute ON - blocking all chat, pings, drawings, and sounds.") | |
| else | |
| if originalMapVolume then | |
| Spring.SetConfigFloat("snd_volmap", originalMapVolume) | |
| end | |
| enableWidgets() | |
| Spring.Echo("[Harmony] Mute OFF - allowing chat, pings, and drawings through.") | |
| end | |
| return true | |
| end | |
| end | |
| -- Block all map drawings and pings from other players | |
| function widget:MapDrawCmd(playerID, cmdType, px, py, pz, label) | |
| if muted and playerID ~= myPlayerID then | |
| return true | |
| end | |
| end | |
| -- Block chat messages (backup) | |
| function widget:GotChatMsg(msg, playerID) | |
| if muted then | |
| return true | |
| end | |
| end | |
| -- Block console lines (backup) | |
| function widget:AddConsoleLine(msg, priority) | |
| if muted then | |
| return true | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment