This documentation is super not-finished but it does have every function available in Liquid listed at the very least.
Liquid reads some extra keys in modInfo.json
to make the mod menu work.
name
(string) - Determines the display name of the mod in the mod menu. If unspecified, Liquid will try to retrieve the mod from the Steam Workshop, but will fail if it doesn't exist or if the player isn't connected to the internet, and will default to the mod's ID instead.
description
(string) - The description to display after opening the mod in the mod menu.
author
(string) - The author(s) to display in the mod menu.
version
(string or number) - The version the mod is on to display in the mod menu.
documentation
(string) - The URL or relative file path for the mod's documentation, if it has any. This will add a "Documentation" button (the one you clicked to get here!) that will open the URL or file with the default program for it.
All of these keys are optional, but it is recommended to fill out a name and description at the very least so liquid can reliably display the correct information in the mod menu.
Mod settings are defined through a series of functions that register callbacks for when the settings are changed. Currently there are 3 different types of settings: checkbox settings, slider settings, and menu settings.
Liquid.addCheckboxSetting(name, defaultValue, onChange, id=name)
Liquid.addSliderSetting(name, defaultValue, min, max, step, onChange, id=name, isPercent=false)
Liquid.addSliderSetting(name, defaultValue, min, max, step, onChange, id=name, displayValues=[])
Liquid.addMenuSetting(name, defaultValue, options, onChange, id=name)
I'll add descriptions to what each of these functions do later, the parameters themselves should be explanation enough right now. If you need a better explanation on something, just ask me in the official discord @DTmg
These functions add a button somewhere to the ingame UI.
Liquid.addMainMenuButton(text, onClick(game), showOnRight?, font?, onHover(game)?)
Liquid.addGeneralStatsButton(onClick(city), text(city), spriteName, position, isActive(city)?, onHover(city)?, keybind?)
Liquid.addQuickActionButton(onClick(city), spriteName, position, isActive(city)?, onHover(city)?, keybind?)
I'll add descriptions to what each of these functions do later, the parameters themselves should be explanation enough right now. If you need a better explanation on something, just ask me in the official discord @DTmg
These functions add a way to access files stored in mods.
Liquid.getModResource(filepath)
Gets a resource loaded in your mod by the relative file path to the mod's base folder
Liquid.onInfoFilesLoaded(file, callback(info))
Gets an array of entries from info files in all mods matching that name, similar to how buildinginfo.json
works. This can be used to define custom data files for your mod.
Miscellaneous functions and properties that don't really fit into any other category.
Liquid.openModsMenu(gui, options)
Open the Liquid mods menu.
gui
- The gui context to open the window in.options
- A set of options to use while opening the window:
showWorkshopMods
- Whether or not to show mods gotten from the steam workshop. Defaults to true.showLocalMods
- Whether or not to show mods created in the local mod directory (your mods). Defaults to true.title
- The title of the window. Defaults to "Mods".showRestart
- Whether or not to show the restart game button and restart notification. Defaults to true.onSelect
- A callback to run when a mod is selected from the list. Gets passed the mod's path. Defaults to opening the mod menu for that mod.description
- The description to display at the top of the window. Defaults to "Select a mod below for more info and configuration. If a mod shows up in red, Liquid was unable to figure out the mod name."bottomButtons
- An array of objects for buttons that appear at the bottom of the window. If not provided, defaults to the "Mod Files" and "Game Files" buttons.
text
- The text to display on the button.action
- A callback to run when the button is pressed.Liquid.getModID()
Returns the mod ID (folder when local, workshop id when published) of your mod.
Liquid.getModVersion()
Returns the mod version of your mod specified in modInfo.json
.
Liquid.version
Has the current Liquid version as shown in the mods menu.
The mod menu will now try to automatically use an icon.png
file if it shows up in your mod folder as the mod icon.
Liquid allows for almost all text in-game to have a custom color attached to it by prefixing it with a hex code in the format of [i#123456]
.