API ReferenceGE ExtensionsuigameplaySelectortileGenerators
Campaign Tiles Generator
Tile generator for legacy campaign entries in the gameplay selector grid.
Tile generator for legacy campaign entries in the gameplay selector grid.
Overview
ui_gameplaySelector_tileGenerators_campaignTiles provides campaign tiles and detail panels for the gameplay selector. Campaigns are loaded from campaign_campaignsLoader and marked as legacy/deprecated content.
Extension path: lua/ge/extensions/ui/gameplaySelector/tileGenerators/campaignTiles.lua
Exports (M)
| Hook Handler | Signature | Description |
|---|---|---|
onGameplaySelectorGetTiles | (items, backend) | Adds campaign tiles to the items list. |
onGameplaySelectorGetDetails | (itemDetails, details, buttonInstance, backend) | Provides detail panel for a selected campaign. |
Internals
Tile Structure
Each campaign item includes:
{
name = translate(campaign.title),
system = "Campaigns (deprecated)",
type = "Campaign (deprecated)",
level = translate(core_levels.getLevelTitle(campaign.level)),
sourceIcons = {}, -- beamNG icon if official, bug icon if auxiliary
order = -tonumber(campaign.date),
isLegacy = true,
key = "campaign_<sourceFile>",
validBackends = {gameplaySelector = true},
}Detail Panel
The detail panel includes:
- Specifications: difficulty, authors, creation date, multiplayer info, scenario count
- Legacy notice: "Campaign system is outdated"
- Tags: official, auxiliary, mod info
- Button: "Start Campaign" - calls
campaign_campaignsLoader.start(campaign)and tracks recent usage
Key Generation
local function getKeyFromDetails(details)
return string.format("campaign_%s", details.campaignSourceFile)
endHow It Works
- The gameplay selector fires
onGameplaySelectorGetTileshook - This generator iterates all campaigns from
campaign_campaignsLoader.getList() - Each campaign is converted to a tile with system/type/level metadata
- When a user selects a campaign,
onGameplaySelectorGetDetailsloads full data - The "Start Campaign" button launches the campaign and tracks recent usage
Additional Exports
The following exports are available but not yet documented in detail:
M.onGameplaySelectorGetDetailsM.onGameplaySelectorGetTiles