query · world.resource

Resource counts

Returns paginated detached world-wide totals for registered resources.

world.resource.counts(filters?, cursor?, page_size?) -> query-page
Stable ID
world.resource.counts
Owner
game.resource-economy
Authority
read_only
Timing
immediate
Availability
active-session
Side effects
none
Determinism
stable owner order at the current committed tick
Introduced
1.0.0

Usage

Read bounded world-wide quantities in stable Resource order. Use display_name for player-facing labels and key or resource_id for durable logic. Use world.settlement.resources when an interface specifically claims to show one settlement's stores.

Parameters

Returns

Detached world-wide resource rows with stable identity, authored key and display name, plus total, available, reserved, in-transit, consumed, and produced quantities.

Cost

Bounded by page size, the Resource owner count window, one content-catalog lookup per returned row, and the package query budget.

Fields

IDTypeUnitsRequiredDescription
availableunsigned-integerresource-unitsyesUnreserved quantity.
consumedunsigned-integerresource-unitsyesCumulative consumed quantity.
display_namestringnoneyesPlayer-facing authored resource name.
in_transitunsigned-integerresource-unitsyesQuantity in transit.
keystringnoneyesAuthored resource key.
producedunsigned-integerresource-unitsyesCumulative produced quantity.
reservedunsigned-integerresource-unitsyesReserved quantity.
resource_idstable-idnoneyesResource identity.
totalunsigned-integerresource-unitsyesCurrent quantity in containers.

Errors

Examples

local result = world.query("world.resource.counts", {page_size = 16})
if result.status == "completed" then
    for _, resource in ipairs(result.records) do
        ui.row(resource.display_name, tostring(resource.total))
    end
end

API history

Related symbols

Project references