Skip to main content

Worldsettings

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

Overview

WorldSettings is a component responsible for storing and managing world-level configuration settings as key-value pairs. It is typically attached to the world entity and responds to network events (ms_setworldsetting) to update settings during gameplay. This component provides a simple interface to get and set arbitrary world settings, which are persisted and accessible throughout the world instance.

Usage example

-- Assuming 'world' is the world entity
world:AddComponent("worldsettings")

-- Set a custom world setting
world.components.worldsettings:SetSetting("storm_frequency", 0.75)

-- Retrieve the setting later
local stormFreq = world.components.worldsettings:GetSetting("storm_frequency")

Dependencies & tags

Components used: None identified
Tags: None identified

Properties

PropertyTypeDefault ValueDescription
settingstable{}Internal dictionary storing key-value pairs of world settings.

Main functions

GetSetting(setting)

  • Description: Retrieves the value of a world setting by its key.
  • Parameters: setting (string) - the key identifying the setting.
  • Returns: The stored value for the given setting key, or nil if the key does not exist.

SetSetting(setting, value)

  • Description: Sets a world setting to a new value.
  • Parameters:
    • setting (string) - the key identifying the setting.
    • value (any) - the value to assign to the setting.
  • Returns: Nothing.

Events & listeners

  • Listens to: ms_setworldsetting - triggers when a network message requests a world setting update; calls SetSetting with the message data (data.setting, data.value).
  • Pushes: None identified.