Skip to content

atl/gui.hpp

GUIs (sm.gui): layouts, the game's built-in GUIs, and HUD, text and fade helpers.

Options for Gui::fromLayout. Unset fields keep the layout's own settings.

struct GuiOptions
bool destroyOnClose = false;
Optional<bool> isHud;
Optional<bool> isInteractive;
Optional<bool> needsCursor;
Optional<bool> hidesHotbar;
Optional<bool> isOverlapped;
Optional<double> backgroundAlpha;

A GUI (GuiInterface). Callbacks take lambdas, and GUIs created through this class are destroyed with the script that created them, along with their callbacks.

class Gui : public atl::Object
Gui() = default;

A null GUI.

explicit Gui(atl::Value v);

Wraps an existing Lua GuiInterface without tracking it.

Parameters

  • v (atl::Value)
static Gui fromLayout(StringView layout, const GuiOptions &o = {});

[client] Creates a GUI from a .layout file.

Parameters

  • layout (StringView)
  • o (const GuiOptions &)

Returns Gui

Lua: sm.gui.createGuiFromLayout

static Gui builtin(StringView factory, bool destroyOnClose = false);

[client] Creates a built-in GUI by its sm.gui factory name, e.g. "createContainerGui".

Parameters

  • factory (StringView)
  • destroyOnClose (bool)

Returns Gui

Lua: sm.gui

static Gui worldIcon(int width, int height, Optional<String> layout = atl::none, bool destroyOnClose = false);

[client] Creates a GUI shown in the world (a marker or icon), optionally from a layout.

Parameters

  • width (int): The width.
  • height (int): The height.
  • layout (Optional<String>): Path to the layout file (Defaults to "$GAME_DATA/Gui/Layouts/Hud/Hud_WorldIcon.layout")
  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createWorldIconGui

static Gui adopt(Value gui, bool destroyOnClose = false);

Takes over a GuiInterface created elsewhere, so its callbacks are cleaned up with this script.

Parameters

  • gui (Value)
  • destroyOnClose (bool)

Returns Gui

void open() const;

Opens / closes the GUI.

Lua: GuiInterface:open

void close() const;

Opens / closes the GUI.

Lua: GuiInterface:close

bool isActive() const;

True while open.

Returns bool

Lua: GuiInterface:isActive

void destroy();

Destroys the GUI and frees its callbacks.

Lua: GuiInterface:destroy

void setText(StringView widget, StringView text) const;

Sets a widget's text, visibility, image or color.

Parameters

  • widget (StringView): The name of the textbox widget
  • text (StringView): The text

Lua: GuiInterface:setText

void setVisible(StringView widget, bool visible) const;

Sets a widget's text, visibility, image or color.

Parameters

  • widget (StringView): The name of the widget
  • visible (bool): True if visible

Lua: GuiInterface:setVisible

void setImage(StringView widget, StringView imagePath) const;

Sets a widget's text, visibility, image or color.

Parameters

  • widget (StringView): The name of the imagebox widget
  • imagePath (StringView): The name or path of the image

Lua: GuiInterface:setImage

void setColor(StringView widget, Color c) const;

Sets a widget's text, visibility, image or color.

Parameters

  • widget (StringView): The name of the widget
  • c (Color): The color

Lua: GuiInterface:setColor

void setIconImage(StringView widget, const Uuid &item) const;

Shows an item's icon / 3D preview in a widget.

Parameters

  • widget (StringView): The name of the itembox
  • item (const Uuid &): The item uuid

Lua: GuiInterface:setIconImage

void setMeshPreview(StringView widget, const Uuid &item) const;

Shows an item's icon / 3D preview in a widget.

Parameters

  • widget (StringView): The name of the widget
  • item (const Uuid &): The item uuid to display

Lua: GuiInterface:setMeshPreview

void setButtonState(StringView widget, bool pressed) const;

Sets a button's pressed or enabled state.

Parameters

  • widget (StringView): The name of the button
  • pressed (bool): The state of the button

Lua: GuiInterface:setButtonState

void setButtonEnabled(StringView widget, bool enabled) const;

Sets a button's pressed or enabled state.

Parameters

  • widget (StringView): The name of the widget
  • enabled (bool): True if the widget should be enabled

Lua: GuiInterface:setButtonEnabled

void setWidgetState(StringView widget, int state) const;

Sets a widget's state.

Parameters

  • widget (StringView): The name of the widget
  • state (int): The widget state sm.gui.widgetStates

Lua: GuiInterface:setWidgetState

void setFocus(StringView widget) const;

Gives a widget keyboard focus.

Parameters

  • widget (StringView): The name of the widget that needs focus

Lua: GuiInterface:setFocus

void setData(StringView widget, const Value &data) const;

Passes data to a widget.

Parameters

  • widget (StringView): The name of the widget
  • data (const Value &): The data

Lua: GuiInterface:setData

void setSliderData(StringView slider, int range, int position) const;

Sets a slider's range and position together, or separately.

Parameters

  • slider (StringView): The name of the slider
  • range (int): The slider range
  • position (int): The slider position

Lua: GuiInterface:setSliderData

void setSliderPosition(StringView slider, int position) const;

Sets a slider's range and position together, or separately.

Parameters

  • slider (StringView): The name of the slider
  • position (int): The slider position

Lua: GuiInterface:setSliderPosition

void setSliderRange(StringView slider, int range) const;

Sets a slider's range and position together, or separately.

Parameters

  • slider (StringView): The name of the slider
  • range (int): The slider range

Lua: GuiInterface:setSliderRange

void setContainer(StringView grid, const Container &c) const;

Shows a container's items in a grid.

Parameters

  • grid (StringView): The name of the grid
  • c (const Container &): The container

Lua: GuiInterface:setContainer

void setGridSize(StringView grid, int size) const;

Sets the number of cells in a grid.

Parameters

  • grid (StringView): The name of the grid
  • size (int): The size

Lua: GuiInterface:setGridSize

void addGridItem(StringView grid, const Value &item) const;

Adds / replaces a grid item.

Parameters

  • grid (StringView): The name of the grid
  • item (const Value &): The item

Lua: GuiInterface:addGridItem

void setGridItem(StringView grid, int index, const Value &item) const;

Adds / replaces a grid item.

Parameters

  • grid (StringView): The name of the grid
  • index (int): The item index
  • item (const Value &): The item

Lua: GuiInterface:setGridItem

void clearGrid(StringView grid) const;

Removes every grid item.

Parameters

  • grid (StringView): The name of the grid to clear

Lua: GuiInterface:clearGrid

void addListItem(StringView list, StringView item, const Value &data = {}) const;

Adds an item to a list, with optional data.

Parameters

  • list (StringView): The name of the list
  • item (StringView): The name of the item
  • data (const Value &): Table of data to store

Lua: GuiInterface:addListItem

void clearList(StringView list) const;

Removes every list item.

Parameters

  • list (StringView): The name of the list

Lua: GuiInterface:clearList

void setSelectedListItem(StringView list, StringView item) const;

Selects a list item.

Parameters

  • list (StringView): The name of the list
  • item (StringView): The name of the item

Lua: GuiInterface:setSelectedListItem

void playEffect(StringView widget, StringView effect, bool restart = true) const;

Plays / stops a widget effect.

Parameters

  • widget (StringView)
  • effect (StringView)
  • restart (bool)

Lua: GuiInterface:playEffect

void stopEffect(StringView widget, StringView effect, bool immediate = false) const;

Plays / stops a widget effect.

Parameters

  • widget (StringView)
  • effect (StringView)
  • immediate (bool)

Lua: GuiInterface:stopEffect

template <class Host> void setHost(const Host &host, StringView bone = {}) const;

For world GUIs (worldIcon): attaches the GUI to an object, optionally to a bone.

Parameters

  • host (const Host &): The shape to host the gui
  • bone (StringView): The joint (Optional)

Lua: GuiInterface:setHost

void setWorldPosition(Vec3 p) const;

For world GUIs: sets / reads the world position.

Parameters

  • p (Vec3)

Lua: GuiInterface:setWorldPosition

Vec3 worldPosition() const;

For world GUIs: sets / reads the world position.

Returns Vec3

Lua: GuiInterface:getWorldPosition

void setRequireLineOfSight(bool required) const;

For world GUIs: whether it hides when the view is blocked.

Parameters

  • required (bool): True if gui requires line of sight to render

Lua: GuiInterface:setRequireLineOfSight

void setMaxRenderDistance(double d) const;

For world GUIs: the distance beyond which it isn't drawn.

Parameters

  • d (double): The max render distance

Lua: GuiInterface:setMaxRenderDistance

void setFadeRange(double range) const;

For world GUIs: the distance over which it fades out.

Parameters

  • range (double): The fade range

Lua: GuiInterface:setFadeRange

void setOpenCloseEffect(StringView openEffect, StringView closeEffect) const;

Effects played when the GUI opens and closes.

Parameters

  • openEffect (StringView): The name of the open effect
  • closeEffect (StringView): The name of the close effect

Lua: GuiInterface:setOpenCloseEffect

void setSelectedDropDownItem(StringView dropDown, StringView item) const;

Selects a drop-down item.

Parameters

  • dropDown (StringView)
  • item (StringView)

Lua: GuiInterface:setSelectedDropDownItem

void setSliderRangeLimit(StringView slider, int limit) const;

Limits how far a slider can move.

Parameters

  • slider (StringView): The name of the slider
  • limit (int): The slider range limit

Lua: GuiInterface:setSliderRangeLimit

void setItemIcon(StringView imageBox, StringView resource, StringView group, StringView name) const;

Shows an item icon by resource/group/name (see gui::itemIcon).

Parameters

  • imageBox (StringView): The name of the imagebox
  • resource (StringView): The item resource
  • group (StringView): The item group
  • name (StringView): The item name

Lua: GuiInterface:setItemIcon

void createGrid(StringView grid, const GridSpec &spec) const;

Creates a grid in a widget.

Parameters

  • grid (StringView): The name of the grid
  • spec (const GridSpec &)

Lua: GuiInterface:createGridFromJson

void addGridItemsFromFile(StringView grid, StringView jsonPath, const Value &additionalData = {}) const;

Adds grid items from a JSON file.

Parameters

  • grid (StringView): The name of the grid
  • jsonPath (StringView): Json file path
  • additionalData (const Value &): Additional data to the json (Optional)

Lua: GuiInterface:addGridItemsFromFile

void setContainers(StringView grid, const Vector<Container> &containers) const;

Shows several containers' items in a grid.

Parameters

  • grid (StringView): The name of the grid
  • containers (const Vector<Container> &)

Lua: GuiInterface:setContainers

void playGridEffect(StringView grid, int index, StringView effect, bool restart = true) const;

Plays / stops an effect on one grid item.

Parameters

  • grid (StringView): The name of the grid
  • index (int): The index in the grid
  • effect (StringView): The name of the effect
  • restart (bool): If the effect should restart if its already palying (Defaults to true)

Lua: GuiInterface:playGridEffect

void stopGridEffect(StringView grid, int index, StringView effect) const;

Plays / stops an effect on one grid item.

Parameters

  • grid (StringView): The name of the grid
  • index (int): The index in the grid
  • effect (StringView): The name of the effect

Lua: GuiInterface:stopGridEffect

void addToPickupDisplay(const Uuid &item, int amount) const;

For the survival HUD: adds to / removes from the pickup display.

Parameters

  • item (const Uuid &): The item uuid
  • amount (int): Quantity of items picked up

Lua: GuiInterface:addToPickupDisplay

void removeFromPickupDisplay(const Uuid &item, int amount) const;

For the survival HUD: adds to / removes from the pickup display.

Parameters

  • item (const Uuid &): The item uuid
  • amount (int): Quantity of items to remove

Lua: GuiInterface:removeFromPickupDisplay

void compassAddIcon(StringView icon, Optional<String> image = atl::none, bool showDistance = false, Optional<int> width = atl::none, Optional<int> height = atl::none) const;

For gui::createCompassHudGui: adds an icon to the compass.

Parameters

  • icon (StringView): Name of the new compass icon.
  • image (Optional<String>): The name or path of the image. (Optional)
  • showDistance (bool): If the icon should display distance. (Optional)
  • width (Optional<int>): The width of the icon, defaults to 22. (Optional)
  • height (Optional<int>): The height of the icon, defaults to 22. (Optional)

Lua: GuiInterface:compassAddIcon

void compassRemoveIcon(StringView icon) const;

Removes a compass icon.

Parameters

  • icon (StringView): Name of a compass icon.

Lua: GuiInterface:compassRemoveIcon

void compassSetIconWorldPosition(StringView icon, Vec3 position, const World &world = {}) const;

Places a compass icon at a world position.

Parameters

  • icon (StringView): Name of a compass icon.
  • position (Vec3): The position to set.
  • world (const World &): The world, defaults to same as the script

Lua: GuiInterface:compassSetIconWorldPosition

template <class Host> void compassSetIconHost(StringView icon, const Host &host, StringView joint = {}) const;

Makes a compass icon follow an object.

Parameters

  • icon (StringView): Name of a compass icon.
  • host (const Host &): The host of the icon
  • joint (StringView): The host joint/bone name (Optional)

Lua: GuiInterface:compassSetIconHost

void compassSetIconStacking(StringView icon, bool stacking) const;

Whether a compass icon stacks with nearby icons.

Parameters

  • icon (StringView): Name of a compass icon.
  • stacking (bool): The stacking setting.

Lua: GuiInterface:compassSetIconStacking

void compassPingMarker(StringView icon, StringView effect, Optional<Color> color = atl::none) const;

Plays a ping effect on a compass icon.

Parameters

  • icon (StringView): Name of the compass icon.
  • effect (StringView): The name of the effect
  • color (Optional<Color>): The color of the effect

Lua: GuiInterface:compassPingMarker

void trackQuest(StringView name, StringView title, bool mainQuest, const Vector<QuestTask> &tasks, Optional<String> icon = atl::none) const;

Shows a quest in the tracker.

Parameters

  • name (StringView): The name of quest
  • title (StringView): The quest title to be displayed in the tracker
  • mainQuest (bool): If the quest is a main quest (Displayed on top in the tracker)
  • tasks (const Vector<QuestTask> &)
  • icon (Optional<String>): The icon to display in the tracker (Optional)

Lua: GuiInterface:trackQuest

void untrackQuest(StringView name) const;

Removes a quest from the tracker.

Parameters

  • name (StringView): The name of quest

Lua: GuiInterface:untrackQuest

Gui &onButton(StringView button, atl::Function<void()> fn);

Called when a button is clicked.

Parameters

  • button (StringView)
  • fn (atl::Function<void ()>)

Returns Gui &

Gui &onTextChanged(StringView editBox, atl::Function<void(String)> fn);

Called with an edit box's text whenever it changes.

Parameters

  • editBox (StringView)
  • fn (atl::Function<void (String)>)

Returns Gui &

Gui &onTextAccepted(StringView editBox, atl::Function<void(String)> fn);

Called with an edit box's text when Enter is pressed.

Parameters

  • editBox (StringView)
  • fn (atl::Function<void (String)>)

Returns Gui &

Gui &onSlider(StringView slider, atl::Function<void(int)> fn);

Called with a slider's new position.

Parameters

  • slider (StringView)
  • fn (atl::Function<void (int)>)

Returns Gui &

Gui &horizontalSlider(StringView widget, int range, int value, atl::Function<void(int)> fn, bool numbered = false);

Turns a widget into a horizontal / vertical slider, called with its new position.

Parameters

  • widget (StringView)
  • range (int)
  • value (int)
  • fn (atl::Function<void (int)>)
  • numbered (bool)

Returns Gui &

Lua: GuiInterface:createHorizontalSlider

Gui &verticalSlider(StringView widget, int range, int value, atl::Function<void(int)> fn);

Turns a widget into a horizontal / vertical slider, called with its new position.

Parameters

  • widget (StringView): The name of the widget
  • range (int): The range of the slider
  • value (int): The start value on the slider
  • fn (atl::Function<void (int)>): Slider change callback function name

Returns Gui &

Lua: GuiInterface:createVerticalSlider

Gui &dropDown(StringView widget, const Vector<String> &options, atl::Function<void(String)> fn);

Turns a widget into a drop-down, called with the selected option.

Parameters

  • widget (StringView): The name of the widget
  • options (const Vector<String> &): The name of the function
  • fn (atl::Function<void (String)>): The options in the dropdown menu

Returns Gui &

Lua: GuiInterface:createDropDown

Gui &onGridButton(StringView button, atl::Function<void(int, Value)> fn);

Called with the index and item data when a grid button is clicked.

Parameters

  • button (StringView)
  • fn (atl::Function<void (int, Value)>)

Returns Gui &

Gui &onGridItemClicked(StringView grid, atl::Function<void(int, Value)> fn);

Called with the index and item data when a grid item is clicked.

Parameters

  • grid (StringView)
  • fn (atl::Function<void (int, Value)>)

Returns Gui &

Gui &onListSelection(StringView list, atl::Function<void(Value args)> fn);

Called when a list item is selected (engine-defined arguments).

Parameters

  • list (StringView)
  • fn (atl::Function<void (Value)>)

Returns Gui &

Gui &onOpen(atl::Function<void()> fn);

Called when the GUI opens.

Parameters

  • fn (atl::Function<void ()>): Function to be called when gui is opened

Returns Gui &

Lua: GuiInterface:setOnOpenCallback

Gui &onClose(atl::Function<void()> fn);

Called when the GUI closes.

Parameters

  • fn (atl::Function<void ()>)

Returns Gui &

Gui &clearOnClose();

Removes the onClose handler (a destroyOnClose GUI is still cleaned up when it closes).

Returns Gui &

Lua: GuiInterface:clearOnCloseCallback

Gui &onGridItemChanged(StringView grid, atl::Function<void(Value args)> fn);

Called when a grid item changes (engine-defined arguments, e.g. grid, index, item).

Parameters

  • grid (StringView)
  • fn (atl::Function<void (Value)>)

Returns Gui &

Gui &onGridMouseFocus(StringView button, atl::Function<void(Value args)> fn);

Called when the mouse enters or leaves a grid item (engine-defined arguments).

Parameters

  • button (StringView)
  • fn (atl::Function<void (Value)>)

Returns Gui &

Gui &onDressbotUnlock(atl::Function<void(Uuid)> fn);

For dress bot GUIs: called with the unlocked customization item.

Parameters

  • fn (atl::Function<void (Uuid)>): The name function.

Returns Gui &

Lua: GuiInterface:setDressbotUnlockCallback

Describes a grid for createGrid.

struct GridSpec
StringView type;
StringView layout;
int itemWidth = 0, itemHeight = 0, itemCount = 0;

A quest task shown by trackQuest (for gui::createQuestTrackerGui).

struct QuestTask
String name;
String text;
int count = 0;
int target = 0;
bool complete = false;
inline Gui createAmmunitionContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createAmmunitionContainerGui

inline Gui createBatteryContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createBatteryContainerGui

inline Gui createChallengeHUDGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createChallengeHUDGui

inline Gui createChallengeMessageGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createChallengeMessageGui

inline Gui createCharacterCustomizationGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createCharacterCustomizationGui

inline Gui createChemicalContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createChemicalContainerGui

inline Gui createCompassHudGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createCompassHudGui

inline Gui createContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createContainerGui

inline Gui createCraftBotGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createCraftBotGui

inline Gui createDressBotGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createDressBotGui

inline Gui createEngineGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createEngineGui

inline Gui createFertilizerContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createFertilizerContainerGui

inline Gui createGasContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createGasContainerGui

inline Gui createGlowstickContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createGlowstickContainerGui

inline Gui createHideoutGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createHideoutGui

inline Gui createLogbookGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createLogbookGui

inline Gui createMechanicStationGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createMechanicStationGui

inline Gui createMininghubDispenserGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createMininghubDispenserGui

inline Gui createNameTagGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createNameTagGui

inline Gui createOreCrusherContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused.

Returns Gui

Lua: sm.gui.createOreCrusherContainerGui

inline Gui createPortableCrafterGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createPortableCrafterGui

inline Gui createProspectorContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createProspectorContainerGui

inline Gui createQuestTrackerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createQuestTrackerGui

inline Gui createRefineryContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused.

Returns Gui

Lua: sm.gui.createRefineryContainerGui

inline Gui createSawbotGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createSawbotGui

inline Gui createSeatGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createSeatGui

inline Gui createSeatUpgradeGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createSeatUpgradeGui

inline Gui createSeedContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createSeedContainerGui

inline Gui createSteeringBearingGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createSteeringBearingGui

inline Gui createSurvivalHudGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createSurvivalHudGui

inline Gui createWaterContainerGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createWaterContainerGui

inline Gui createWorkbenchGui(bool destroyOnClose = false);

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

Parameters

  • destroyOnClose (bool): If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false)

Returns Gui

Lua: sm.gui.createWorkbenchGui

inline Size screenSize();

[client] The screen size in pixels.

Returns Size

Lua: sm.gui.getScreenSize

inline Size computeTextSize(StringView text, StringView font, StringView align, Optional<double> maxWidth = atl::none, bool replaceTags = true);

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

Parameters

  • text (StringView): The text to compute.
  • font (StringView): The font to use.
  • align (StringView): The text alignment.
  • maxWidth (Optional<double>): The maximum desired widget width before wrapping (optional) (Defaults to -1)
  • replaceTags (bool): Should tags be replaced before calculating? (optional) (Defaults to true)

Returns Size

Lua: sm.gui.computeTextSize

inline String currentLanguage();

[client] The game's language.

Returns String

Lua: sm.gui.getCurrentLanguage

inline String translate(StringView text);

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

Parameters

  • text (StringView): The text containing localization tags

Returns String

Lua: sm.gui.translateLocalizationTags

inline String ticksToTimeString(int ticks);

Formats ticks as "HH:MM:SS".

Parameters

  • ticks (int): Game ticks

Returns String

Lua: sm.gui.ticksToTimeString

inline ItemIcon itemIcon(const Uuid &item);

Looks up an item's icon.

Parameters

  • item (const Uuid &): The uuid.

Returns ItemIcon

Lua: sm.gui.getItemIconFromUuid

inline bool hasActiveGui();

[client] True while any GUI is open.

Returns bool

Lua: sm.gui.hasActiveGui

inline void hideGui(bool hide);

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

Parameters

  • hide (bool): The gui visibility

Lua: sm.gui.hideGui

inline void hideHotbar(bool hide);

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

Parameters

  • hide (bool): The hotbar visibility

Lua: sm.gui.hideHotbar

inline void blockInGameMenu(bool block);

[client] Blocks the in-game menu.

Parameters

  • block (bool): The new blocking state for the in game menu.

Lua: sm.gui.blockInGameMenu

inline void setProgressFraction(double fraction);

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

Parameters

  • fraction (double): The fraction that determines how much of the circle is filled.

Lua: sm.gui.setProgressFraction

inline void setCharacterDebugText(const Character &c, StringView text, bool clear = true);

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

Parameters

  • c (const Character &): The character.
  • text (StringView): The debug text.
  • clear (bool): If true the previous text will be overwritten. (Defaults to true)

Lua: sm.gui.setCharacterDebugText

inline void onDisplayMessage(atl::Function<void(Value args)> fn);

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

Parameters

  • fn (atl::Function<void (Value)>): Function to be called when a alert message is called

Lua: sm.gui.bindDisplayMessageCallback

inline void startFadeToBlack(double duration, double timeout);

[client] Fades the screen to black.

Parameters

  • duration (double): Animation duration
  • timeout (double): Seconds until the fade fades back

Lua: sm.gui.startFadeToBlack

inline void startFadeToBlackWaitForWorld(double duration, double timeout);

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

Parameters

  • duration (double): Animation duration
  • timeout (double): Seconds until the fade starts waiting for the world

Lua: sm.gui.startFadeToBlackWaitForWorld

inline void endFadeToBlack(double duration, bool force = false);

[client] Fades back in from black.

Parameters

  • duration (double): Animation duration
  • force (bool): If true, start the fade out from full black even if there was no fade to black active. (Defaults to false)

Lua: sm.gui.endFadeToBlack

inline void exitToMenu();

[client] Leaves to the main menu.

Lua: sm.gui.exitToMenu

inline void openGarageImportGui();

[client] Opens the garage creation import GUI.

Lua: sm.gui.openGarageImportGui

inline void setGarageImportGuiStorage(const Container &c);

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

Parameters

  • c (const Container &): The container import gui should use for materials.

Lua: sm.gui.setGarageImportGuiStorage

inline void onGarageButton(atl::Function<void(Value args)> fn);

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

Parameters

  • fn (atl::Function<void (Value)>): Function to be called when button is pressed

Lua: sm.gui.setGarageButtonCallback

inline void onGarageError(atl::Function<void(Value args)> fn);

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

Parameters

  • fn (atl::Function<void (Value)>): Function to be called when error is met

Lua: sm.gui.setGarageErrorCallback

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

struct Size
double width = 0, height = 0;

What Gui::setItemIcon needs to show an item.

struct ItemIcon
String resource, group, name;