UIService

Noir.Services.UIService: NoirService

A service for showing UI to players in an OOP manner. Map UI, screen popups, physical popups, etc, are all supported.


Noir.Services.UIService:_GetSavedWidgets()

Returns all saved widgets (serialized versions).

Used internally. Do not use in your code.

Returns

  • table<integer, NoirSerializedWidget>


Noir.Services.UIService:_LoadWidgets()

Loads all widgets saved in g_savedata.

Used internally. Do not use in your code.


Noir.Services.UIService:_SaveWidget(widget)

Saves a widget.

Used internally. Do not use in your code.

Parameters

  • widget: NoirWidget


Unsaves a widget.

Used internally. Do not use in your code.

Parameters

  • widget: NoirWidget


Adds a widget to the UIService.

Used internally. Do not use in your code.

Parameters

  • widget: NoirWidget - The widget to add


Removes a widget from the UIService.

Used internally. Do not use in your code.

Parameters

  • widget: NoirWidget - The widget to remove


Creates a map label widget.

This is a label that is shown on the map (duh), similar to what you see at shipwrecks, key locations (e.g: "Harrison Airbase").

Parameters

  • text: string

  • labelType: SWLabelTypeEnum

  • position: SWMatrix

  • visible: boolean

  • player: NoirPlayer|nil

Returns

  • NoirMapLabelWidget


Creates a screen popup widget.

This is a rounded-rectangle with text shown on your screen, exactly the same as the tutorial popups you get when you start a singleplayer game.

Parameters

  • text: string

  • X: number - -1 (left) to 1 (right)

  • Y: number - -1 (top) to 1 (bottom)

  • visible: boolean

  • player: NoirPlayer|nil

Returns

  • NoirScreenPopupWidget


Creates a popup widget.

This is a 2D popup that is shown in 3D space. It can be attached to a body or an object too.

This is used in the Stormworks career tutorial.

Parameters

  • text: string

  • position: SWMatrix

  • renderDistance: number - in meters

  • visible: boolean

  • player: NoirPlayer|nil

Returns

  • NoirPopupWidget


Creates a map line widget.

Simply renders a line connecting two points on the map.

Parameters

  • startPosition: SWMatrix

  • endPosition: SWMatrix

  • width: number

  • visible: boolean

  • colorR: number|nil

  • colorG: number|nil

  • colorB: number|nil

  • colorA: number|nil

  • player: NoirPlayer|nil

Returns

  • NoirMapLineWidget


Creates a map object widget.

Similar to a map label, this is shown on the map. However, this comes with an interactive circular icon that when hovered over, shows a title and a subtitle.

This is what Stormworks missions use to show mission locations.

Parameters

  • title: string

  • text: string

  • objectType: SWMarkerTypeEnum

  • position: SWMatrix

  • radius: number

  • visible: boolean

  • colorR: number|nil

  • colorG: number|nil

  • colorB: number|nil

  • colorA: number|nil

  • player: NoirPlayer|nil

Returns

  • NoirMapObjectWidget


Returns a widget by ID.

Parameters

  • ID: integer

Returns

  • NoirWidget|nil


Returns all widgets shown to a player.

Unlike :GetWidgetsBelongingToPlayer(), this will include widgets that are shown to all players including this player.

Parameters

  • player: NoirPlayer

Returns

  • table<integer, NoirWidget>


Returns all widgets belonging to a player (ignoring widgets belonging to all players).

Parameters

  • player: NoirPlayer

Returns

  • table<integer, NoirWidget>


Remove a widget by ID. This will also hide the widget from players.

Parameters

  • ID: integer


Returns the player a serialized widget belongs to.

Raises an error if the player does not exist and peer id is not -1.

Parameters

  • ID: integer - The peer ID of the player, or -1 if everyone

Returns

  • NoirPlayer|nil

Last updated