MODDING INSTRUCTIONSCreate your first pack →

Native information and action panels

The Mod API provides ColonyExtension.panels(View) and onPanelAction(context, panelId, actionId). Return ColonyPanel values containing a title, label/value rows and buttons. The game shows a four-square button beside its settlement-map control only while enabled providers supply panels. No Town Inspector dependency is required. All panels share the native scrollable inspector shell, section backgrounds, inner cards, buttons, tooltip behavior and current locale.

Each provider may return eight panels; each panel allows 128 rows and sixteen actions. IDs use lowercase letters, digits and underscores, start with a letter, and contain at most 64 characters. Panel IDs must be unique per provider and action IDs unique within their panel. Lists are copied. Every message uses a mods.<your_id>.* translation key present in all thirteen catalogs, with up to eight runtime arguments of 256 characters each. Arguments are for names/numbers, not authored prose.

@Override
public List<ColonyPanel> panels(ColonyContext.View world) {
    var title = new ColonyPanel.Message("mods.my_mod.panel", List.of());
    var button = new ColonyPanel.Message("mods.my_mod.craft", List.of());
    return List.of(new ColonyPanel("production", title, List.of(),
            List.of(new ColonyPanel.Action("craft", button, ready))));
}

@Override
public void onPanelAction(ColonyContext context, String panelId, String actionId) {
    if (panelId.equals("production") && actionId.equals("craft")) {
        var bill = context.work().craftingRequest("my_mod:recipe", 1);
        // Record an accepted durable request in this extension's ordinary save state.
    }
}

panels is a read-only projection at simulation refresh boundaries, never a drawing callback. It must not change saved state or retain the scoped view. Before dispatch, the host requests fresh panels and rejects missing or disabled actions, missing providers and blocked spectator input. Only the owning extension receives the callback, with the usual expiring context and shared 128-command limit. The host refreshes projections after it returns. Commands still enforce native gameplay prerequisites; a dispatched button is not proof that its requested work was accepted.

Panels are reconstructed after loading. Persistent outcomes belong in the mod's save map; scroll position and hover state are transient. Disabling/removing the provider and restarting removes its panels and actions. Older extensions inherit an empty panel list without a binary-breaking method.

Colony Planner demonstrates these controls with native crafting, zone planning and furniture hauling. Arbitrary widget trees, custom rendering, keyboard interception and custom work executors are outside this contract.

Forgotten Towns · Modding reference