Skip to main content

Modconfigurationscreen

Based on game build 714014 | Last updated: 2026-03-09

Overview​

ModConfigurationScreen is a UI screen that presents and manages configuration options for a specific mod. It retrieves mod configuration data via KnownModIndex, renders interactive widgets (e.g., spinners), allows user edits, and supports applying, resetting, or discarding changes. It extends Screen and is part of the Redux UI framework. It does not directly interact with game entities or components but integrates with system-level mod APIs (KnownModIndex) and screen management (TheFrontEnd).

Usage example​

local ModConfigurationScreen = require "screens/redux/modconfigurationscreen"
local screen = ModConfigurationScreen("my_mod_id", true)
TheFrontEnd:PushScreen(screen)

Dependencies & tags​

Components used: None
Tags: None identified

Properties​

PropertyTypeDefault ValueDescription
modnamestring—The internal mod identifier passed to the constructor.
configtablenilConfiguration options loaded via KnownModIndex:LoadModConfigurationOptions.
optionstable{}List of normalized configuration options ready for display.
client_configboolean—Whether configuration is for client-only mod settings.
dirtybooleanfalseWhether any settings have been modified since load.
started_defaultboolean—Whether the initial state matched all defaults.
optionwidgetstable{}Array of UI widget data structures corresponding to options.
options_scroll_listScrollingGrid—Scrollable container widget for mod option widgets.
dialogRectangleWindow—Window container housing all UI elements.
option_headerWidget—Header container for title, description, and value descriptions.
option_descriptionText—Tooltip widget showing hover text for the selected option.
value_descriptionText—Tooltip widget showing hover text for the selected value.

Main functions​

CollectSettings()​

  • Description: Gathers the current state of all mod settings into a table suitable for saving.
  • Parameters: None.
  • Returns: table or nil — a list of option tables with keys: name, label, options, default, and saved (current value).
  • Error states: Returns nil if no options exist.

ResetToDefaultValues()​

  • Description: Resets all option values to their mod-defined defaults and refreshes the UI. Shows a confirmation dialog if settings have been changed.
  • Parameters: None.
  • Returns: Nothing.

Apply()​

  • Description: Persists modified settings to disk via KnownModIndex:SaveConfigurationOptions, then closes the screen. Does nothing if no changes were made.
  • Parameters: None.
  • Returns: Nothing.

Cancel()​

  • Description: Closes the screen. If settings were modified and not reset, shows a confirmation dialog before discarding changes.
  • Parameters: None.
  • Returns: Nothing.

ConfirmRevert(callback)​

  • Description: Displays a Yes/No confirmation dialog (using PopupDialogScreen) before reverting changes. Executes callback on confirmation.
  • Parameters: callback (function) — function to execute if user confirms.
  • Returns: Nothing.

MakeDirty(dirty)​

  • Description: Sets or toggles the dirty flag indicating whether settings have been modified.
  • Parameters: dirty (boolean? optional) — if omitted, sets dirty to true. If true/false, sets flag accordingly.
  • Returns: Nothing.

IsDefaultSettings()​

  • Description: Checks whether all current settings match their mod defaults.
  • Parameters: None.
  • Returns: boolean — true if every option’s value equals its default.

IsDirty()​

  • Description: Returns whether any settings have been modified.
  • Parameters: None.
  • Returns: boolean — value of self.dirty.

OnControl(control, down)​

  • Description: Handles input events (keyboard/controller). Supports CONTROL_CANCEL (Back), CONTROL_MENU_START (Apply), and CONTROL_MENU_BACK (Reset to Default).
  • Parameters:
    control (number) — input control constant.
    down (boolean) — whether key/button was pressed (true) or released (false).
  • Returns: boolean — true if the control was handled, else delegates to base class.

Events & listeners​

  • Listens to: None (no inst:ListenForEvent calls observed).
  • Pushes: None (no inst:PushEvent calls observed).