Skip to content

Electricity & House Usage

Furniture-driven electricity, climate stubs, and the House Usage panel in Housing Central.

Requires Config.Features.electricity = true (default on in current builds).

House Usage panel

Shown on the Housing Central home screen. Built server-side in server/central.luabuildUsage.

RowUnitSourceNotes
Electricity LevelkWhSum of placed furniture electricity.usage vs maxReal drain / capacity
Humidity Level%GetHouseTemperature humidity returnStub — defaults to 50
Temperature°CGetHouseTemperatureBase 25 + healthy heater offsets
Heating LevelUI placeholder (disabled)
Gas LevelUI placeholder (disabled)

Humidity and base temperature are open stubs in server/utils.lua (escrow-editable). Servers can hook weather, dehumidifiers, etc. without touching escrowed code.

Electricity drain

Each catalog item can declare:

json
{
  "price": 55,
  "object": "mp_b_lit_lamptable_06",
  "label": "Table Lamp",
  "electricity": { "usage": 5 }
}

On load, furniture.lua indexes models into Main.furnitureElectricity[hash] = { usage = n }.

FunctionMeaning
GetElectricityDrain(housingId)Sum of usage for powered furniture with furniture_health > 0
GetPotentialElectricityDrain(housingId)Sum for all remaining powered furniture (broken or not) — used for MDT + repair gate
GetMaxElectricity(housingId)Capacity cap (see below)

Implementation: server/electricity/electricity.lua.

Max capacity

  1. Start from location.property_settings.ELECTRICITY (property creator / locations), or Config.Electricity.defaultMax (default 200).
  2. Apply the highest owned upgrade cap from Config.Electricity.upgradeCaps:
UpgradeCap (kWh)
ELECTRICITY_10200
ELECTRICITY_15250
ELECTRICITY_20300

Upgrade purchase needs: 15 requires 10, 20 requires 15. See Upgrades.

Overload

Checked after placing furniture (and related furniture changes):

  1. If live drain (GetElectricityDrain) > max → overload.
  2. Sets housing.settings.electricityOverloaded = true.
  3. Sets furniture_health = 0 on all powered furniture.
  4. Notifies players in / near the property.

While overloaded or while a piece has furniture_health <= 0:

  • Fridge / other powered interactions are blocked.
  • Heaters do not apply temperature offsets.

Repair flow

  1. Remove enough powered furniture so potential drain ≤ max (GetPotentialElectricityDrain).
  2. Target a broken electric piece → Repair Electrical.
  3. Client runs Config.Electricity.repairMinigame via bridge.minigames (default rythmClick).
  4. On success, health restored to 100.
  5. When potential ≤ max and no broken powered furniture remain → clears electricityOverloaded.

Who can repair: Config.Electricity.canRepair(src) — admins, optional repairJobs, and/or prp-characters Electrical rep ≥ minRep.

Fridges

Catalog example:

json
{
  "price": 400,
  "object": "ch_chint02_derelict_drink_fridge",
  "label": "Drink Fridge",
  "electricity": { "usage": 40 },
  "storage": { "slots": 5, "maxWeight": 50000 }
}
  • Category fridgesOpen Fridge target.
  • Stash id: PROPERTY_FRIDGE_{housingId}_{furnitureId}.
  • Slots / weight come from catalog (Main.furnitureStorage).
  • No housing-side item allowlist — restrict items in your inventory config if needed.
  • Requires power (healthy furniture, not overloaded) + STORAGE privilege.

Heaters & temperature

json
{
  "price": 250,
  "object": "prop_elec_heater_01",
  "label": "Electric Heater",
  "electricity": { "usage": 15 },
  "heating": { "temperatureOffset": 3 }
}

Indexed as Main.furnitureHeating[hash] = { temperatureOffset = n }.

Editable stub (server/utils.lua):

lua
function GetHouseTemperature(_, _, housingId)
    local temperature = 25
    -- + temperatureOffset from healthy heaters when electricity is on and not overloaded
    return temperature, humidity
end
DefaultValue
Base temperature25 °C
Base humidity50 % (from GetPlayerTemperature)

Humidity is not changed by furniture in the stock build. Add dehumidifier params / logic in GetHouseTemperature if you want live Humidity Level.

Humidity Level

QuestionAnswer
Does the MDT show it?Yes — always displayed
Does it react to furniture / weather?No in stock — fixed 50%
Can servers change it?Yes — edit GetPlayerTemperature / GetHouseTemperature in server/utils.lua

Config — Config.Electricity

lua
Config.Electricity = {
    defaultMax = 200,
    upgradeCaps = {
        ELECTRICITY_10 = 200,
        ELECTRICITY_15 = 250,
        ELECTRICITY_20 = 300,
    },
    minRep = 0,
    repairJobs = {},
    repairMinigame = {
        name = "rythmClick",
        options = { targetCount = 3 },
    },
    canRepair = function(src)
        -- admins, repairJobs, or Electrical rep
    end,
}

Toggle the whole feature with Config.Features.electricity.

Catalog & editable files

GoalEdit
Add lamps / fridges / heaters + usagefurnishing/furniture_items.json
Categories / Open Fridge / Repair targetsfurniture.lua
Drain, overload, repairserver/electricity/*.lua
Temperature / humidity stubsserver/utils.lua
Caps, repair rulesconfig/sh_config.lua

See Editable files.

Out of scope

Not implemented in the stock electricity system:

  • Power sockets / electrician placement skill
  • Weather-driven climate (prp-sync style)
  • Gas Level gameplay