Skip to content

atl/sm/gui

import "atl/sm/gui"

GUI helpers (sm.gui): chat, alerts, interaction text, the game's built-in GUIs, and HUD, text and fade helpers. GUIs themselves are sm.Gui.

func Chat(message string)

Posts a chat message.

func Alert(text string, seconds float64, queued bool)

Shows centered alert text for seconds, optionally after any queued alerts.

func KeyBinding(action string, colored bool) string

The key bound to an input action (e.g. "Use"), formatted for interaction text.

func Interaction(action, label string)

Sets the interaction text: "[key] label", e.g. gui.Interaction("Use", "Toggle").

func SetInteractionText(text1, binding1, text2, binding2, text3 string)

Sets the interaction text from raw parts (sm.gui.setInteractionText).

func CreateAmmunitionContainerGui(destroyOnClose bool) sm.Gui
func CreateBatteryContainerGui(destroyOnClose bool) sm.Gui
func CreateChallengeHUDGui(destroyOnClose bool) sm.Gui
func CreateChallengeMessageGui(destroyOnClose bool) sm.Gui
func CreateCharacterCustomizationGui(destroyOnClose bool) sm.Gui
func CreateChemicalContainerGui(destroyOnClose bool) sm.Gui
func CreateCompassHudGui(destroyOnClose bool) sm.Gui
func CreateContainerGui(destroyOnClose bool) sm.Gui
func CreateCraftBotGui(destroyOnClose bool) sm.Gui
func CreateDressBotGui(destroyOnClose bool) sm.Gui
func CreateEngineGui(destroyOnClose bool) sm.Gui
func CreateFertilizerContainerGui(destroyOnClose bool) sm.Gui
func CreateGasContainerGui(destroyOnClose bool) sm.Gui
func CreateGlowstickContainerGui(destroyOnClose bool) sm.Gui
func CreateHideoutGui(destroyOnClose bool) sm.Gui
func CreateLogbookGui(destroyOnClose bool) sm.Gui
func CreateMechanicStationGui(destroyOnClose bool) sm.Gui
func CreateMininghubDispenserGui(destroyOnClose bool) sm.Gui
func CreateNameTagGui(destroyOnClose bool) sm.Gui
func CreateOreCrusherContainerGui(destroyOnClose bool) sm.Gui
func CreatePortableCrafterGui(destroyOnClose bool) sm.Gui
func CreateProspectorContainerGui(destroyOnClose bool) sm.Gui
func CreateQuestTrackerGui(destroyOnClose bool) sm.Gui
func CreateRefineryContainerGui(destroyOnClose bool) sm.Gui
func CreateSawbotGui(destroyOnClose bool) sm.Gui
func CreateSeatGui(destroyOnClose bool) sm.Gui
func CreateSeatUpgradeGui(destroyOnClose bool) sm.Gui
func CreateSeedContainerGui(destroyOnClose bool) sm.Gui
func CreateSteeringBearingGui(destroyOnClose bool) sm.Gui
func CreateSurvivalHudGui(destroyOnClose bool) sm.Gui
func CreateWaterContainerGui(destroyOnClose bool) sm.Gui
func CreateWorkbenchGui(destroyOnClose bool) sm.Gui

The game's built-in GUIs, e.g. gui.CreateContainerGui(). All [client]. Each creates the GUI its name says, tracked like sm.GuiFromLayout.

func CurrentLanguage() string

[client] The game's language.

func Translate(text string) string

[client] Replaces "#{TAG}" localization tags with the current language's text.

func TicksToTimeString(ticks int) string

Formats ticks as "HH:MM:SS".

func HasActiveGui() bool

[client] True while any GUI is open.

func HideGui(hide bool)
func HideHotbar(hide bool)

[client] Hides or shows the whole HUD / the hotbar.

func BlockInGameMenu(block bool)

[client] Blocks the in-game menu.

func SetProgressFraction(fraction float64)

[client] Fills the circle around the crosshair, 0..1.

func SetCharacterDebugText(c sm.Character, text string, clear bool)

[client] Dev mode: shows text above a character's head.

func OnDisplayMessage(fn func(args atl.Value))

[client] Called for generic notification popups (engine-defined arguments).

func StartFadeToBlack(duration, timeout float64)

[client] Fades the screen to black.

func StartFadeToBlackWaitForWorld(duration, timeout float64)

[client] Fades out, waits for the world to load, fades back in.

func EndFadeToBlack(duration float64, force bool)

[client] Fades back in from black.

func ExitToMenu()

[client] Leaves to the main menu.

func OpenGarageImportGui()

[client] Opens the garage creation import GUI.

func SetGarageImportGuiStorage(c sm.Container)

[client] Sets the container the garage import GUI uses.

func OnGarageButton(fn func(args atl.Value))

[client] Called when a garage import button is pressed (engine-defined arguments).

func OnGarageError(fn func(args atl.Value))

[client] Called when a garage import fails (engine-defined arguments).

type Size struct {
Width, Height float64
}

[client] A size in pixels or 720p GUI units.

func ScreenSize() Size

[client] The screen size in pixels.

func ComputeTextSize(text, font, align string, maxWidth *float64, replaceTags bool) Size

[client] The size (in 720p GUI units) needed to show text in font.

type ItemIcon struct {
Resource, Group, Name string
}

What sm.Gui.SetItemIcon needs to show an item.

func ItemIconOf(item sm.Uuid) ItemIcon

Looks up an item's icon.