Studios
Govhouse-3.jpg

Examples

SoonGovQbox
PAGE 04 OF 06  ·  CONFIGURATION → EXAMPLES → TROUBLESHOOTINGdocs.glitchstudios.dev
Browse docs

Rename a government for your city#

Edit Config.State.Governments and Config.State.Jobs in config/state.lua, and create a matching job in qbx_core:

Config.State.Governments.federal.label = 'National Government'
Config.State.Governments.federal.leader = 'President'
Config.State.Governments.federal.job = 'nationalgov'

Then add the job grades under Config.State.Jobs.nationalgov, using grade numbers that line up with allRank and ministerRank.

Add a lever#

Add an entry to Config.Levers:

{ id = 'tow_fee', cat = 'nsw_tax', label = 'Tow Fee', desc = 'Charged when a vehicle is towed.', unit = '$', default = 100, min = 0, max = 500, step = 10, flow = 'revenue', kinds = { 'tow_fee' }, portfolio = 'transport' },

A lever only changes behaviour once another resource reads it, so pair this with the next example.

Read a lever from another resource#

local levers = GlobalState['glitch-gov:levers']
local fuelTax = levers and levers.fuel_excise or 0

Or on the server:

local rate = exports['glitch-gov']:GetLever('income_tax')

Values are the number shown in the UI: 10 means 10 percent, 100 means 100 percent and 750 means $750.

Find which government a ledger kind belongs to#

local gov = exports['glitch-gov']:Route('fine_speeding') -- 'federal' or 'nsw' with the default config

Route uses Config.State.Routes and returns the government a glitch-treasury ledger kind is booked to.

Set a lever from a script#

local ok, message = exports['glitch-gov']:SetLever('fuel_excise', 20, 'fuel crisis event')

The server sets the value without rank, cooldown or bankruptcy checks. It still has to be inside the lever's min and max.

Open the terminal from your own script#

exports['glitch-gov']:OpenStateFinances('nsw')

Change a parliament salary#

Lower the federal_salary or nsw_salary lever in /govadmin. They are admin only by default, and Config.PaycheckLevers maps each job to the lever that scales its paycheck.