Coming soon toSteam
Modding docsAPI 1

Example mod · theonaris.examples.menu-tweaks 1.0.0

Menu Tweaks

Changes the game's own menus: edits text and styles, adds a news panel and a pause-menu button, and removes the About button. Everything is put back when the mod is turned off.

Download Menu Tweaks (22 KB)
Install: put the .zip (or the unpacked folder) in your mods folder: in the game, Mods → Open folder. Then start the game and allow the permissions.
Runs on client
Multiplayer local
Size 27 KB
Permissions ui ui.game audio

Changes the game's own interface: the three operations every UI mod is made of.

OperationExample hereAPI
EditMain menu subtitle text, Play button border and tooltipui.find, UiElement:setText, :style, :set("tooltip", …)
AddA news panel built from .uxml + JSON; a Tip button on the pause menuui.screen, ui.load, ui.element, UiElement:add
RemoveThe About buttonUiElement:remove

Everything is undone when the mod stops. Switch it off in Mods, press Apply changes, and the menus are exactly as they were.

Try it

  1. Install, start the game and allow Change the game's interface (ui.game).
  2. The main menu subtitle reads Now with mods, the Play button has an orange edge, a news panel sits in the corner, and the About button is gone.
  3. In a game, press Escape. The pause menu has a 💡 Tip button.
  4. Switch the mod off in Mods and press Apply changes. Everything goes back.

How it works

Finding the game's elements

Game screens have ids (main-menu, pause-menu, building, vehicle-hud, interaction-prompt, planet-hud, hangar). ui.screens() lists them and whether each is open. Inside a screen, use the selectors you would use in a .uss file:

ui.find("main-menu", "#btn-about")          -- by name
ui.find("main-menu", ".brand-subtitle")     -- by class
ui.findAll("main-menu", "Button")           -- by type

To explore a screen's element names, list them while it is open. In the script editor's Console, on this mod's client copy:

for _, e in ipairs(ui.findAll("main-menu", "Button")) do log.info(e.name, e:text()) end

Screens come and go

A screen's elements are created when it opens and discarded when it closes, so a mod applies its changes on ui.screen.opened, and once at start for screens that are already open. Check before adding (screen:find("#mt-news")) so reopening does not add a second copy.

Undo is built in

With ui.game, every change to a game element (text, style, class, tooltip, enabled state, removal, children added) is recorded against your mod. When the mod stops for any reason, the game replays the record backwards. Elements you create are destroyed at the same time.

Styling your own elements

ui.load("ui/news.uxml") applies <Style src="news.uss" /> to the elements in that file only. Game elements keep their own styles, so prefix your class names (mt-… here) to keep them distinct. To restyle a game element, use :style{ … }.

Files

mod.json
scripts/client.lua
ui/news.uxml, ui/news.uss, ui/banner.png
data/news.json               the panel's text
data/tips.json               the pause-menu tips

All files

FileSize
data/news.json444 B
data/tips.json442 B
mod.json1023 B
README.md3 KB
scripts/client.lua4 KB
ui/banner.png17 KB
ui/news.uss1 KB
ui/news.uxml525 B