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.lua → buildUsage.
| Row | Unit | Source | Notes |
|---|---|---|---|
| Electricity Level | kWh | Sum of placed furniture electricity.usage vs max | Real drain / capacity |
| Humidity Level | % | GetHouseTemperature humidity return | Stub — defaults to 50 |
| Temperature | °C | GetHouseTemperature | Base 25 + healthy heater offsets |
| Heating Level | — | — | UI placeholder (disabled) |
| Gas Level | — | — | UI 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:
{
"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 }.
| Function | Meaning |
|---|---|
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
- Start from
location.property_settings.ELECTRICITY(property creator / locations), orConfig.Electricity.defaultMax(default200). - Apply the highest owned upgrade cap from
Config.Electricity.upgradeCaps:
| Upgrade | Cap (kWh) |
|---|---|
ELECTRICITY_10 | 200 |
ELECTRICITY_15 | 250 |
ELECTRICITY_20 | 300 |
Upgrade purchase needs: 15 requires 10, 20 requires 15. See Upgrades.
Overload
Checked after placing furniture (and related furniture changes):
- If live drain (
GetElectricityDrain) > max → overload. - Sets
housing.settings.electricityOverloaded = true. - Sets
furniture_health = 0on all powered furniture. - 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
- Remove enough powered furniture so potential drain ≤ max (
GetPotentialElectricityDrain). - Target a broken electric piece → Repair Electrical.
- Client runs
Config.Electricity.repairMinigameviabridge.minigames(defaultrythmClick). - On success, health restored to
100. - 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:
{
"price": 400,
"object": "ch_chint02_derelict_drink_fridge",
"label": "Drink Fridge",
"electricity": { "usage": 40 },
"storage": { "slots": 5, "maxWeight": 50000 }
}- Category
fridges→ Open 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) +
STORAGEprivilege.
Heaters & temperature
{
"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):
function GetHouseTemperature(_, _, housingId)
local temperature = 25
-- + temperatureOffset from healthy heaters when electricity is on and not overloaded
return temperature, humidity
end| Default | Value |
|---|---|
| Base temperature | 25 °C |
| Base humidity | 50 % (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
| Question | Answer |
|---|---|
| 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
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
| Goal | Edit |
|---|---|
| Add lamps / fridges / heaters + usage | furnishing/furniture_items.json |
| Categories / Open Fridge / Repair targets | furniture.lua |
| Drain, overload, repair | server/electricity/*.lua |
| Temperature / humidity stubs | server/utils.lua |
| Caps, repair rules | config/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-syncstyle) - Gas Level gameplay