Skip to content

F13 Faction Power Grid: generators, relays, breakers, and maintenance hazards#433

Draft
Malerus wants to merge 5 commits into
masterfrom
fusion-core-project
Draft

F13 Faction Power Grid: generators, relays, breakers, and maintenance hazards#433
Malerus wants to merge 5 commits into
masterfrom
fusion-core-project

Conversation

@Malerus
Copy link
Copy Markdown
Contributor

@Malerus Malerus commented Apr 6, 2026

About The Pull Request

Adds a complete modular F13 Faction Power Grid system, replacing the flat always-on area power model with a wired generator → relay → junction box chain that factions must actively maintain. The system is designed to work with both indoor faction bases (flood-fill zone discovery) and outdoor wasteland setups (range-limited direct stamping).

videoplayback.1775440442079.publer.com.mp4

Generator Variants

  • Fusion Core Generator — Pre-War Vault-Tec unit, 1000W per core, up to 2 cores (2000W max, ~30 min/core).
  • Diesel Generator (/faction_generator/diesel) — Industrial CP-8800 unit, 750W flat output, 1440L tank (~48 min full). Fuelled by pouring diesel from any reagent container.
  • Atomic Generator (/faction_generator/atomic) — Poseidon PEAG-5, 1500W flat, single atomic fuel cell chamber (~22 min/cell). Highest output, rarest fuel.
  • Wastelander Generator (/faction_generator/wastelander) — Jury-rigged diesel unit for outdoor/wasteland use. No flood-fill: powers lights within 10 tiles of the generator and any wired relay in reach. Uses the same wired relay/breaker infrastructure as the vault-tec grid, just range-limited.

Grid Components

  • Power Relay — Standard distribution node; extends the grid, carries turret links and downstream junction boxes. Wiring with live cables shocks the user.
  • Wasteland Relay (/power_relay/wasteland) — Scavenged relay post; same as a standard relay but auto-stamps lights within its own 10-tile radius instead of flooding an area datum. Usable as a range extender for the wastelander generator.
  • Breaker Box (/power_relay/breaker_box) — Inline manual cutoff panel. Wire it between the generator and downstream devices; clicking it cuts or restores everything downstream without touching the generator. Respects manually_tripped so upstream power-restore cascades from the generator can never silently re-enable a breaker a player deliberately opened.
  • Junction Box — Connects a building's internal circuit to the grid via depth-first flood-fill. Supports multi-zone buildings, staircase Z-traversal, and openspace bridging. Outdoor areas use a range-limited per-light path instead of area-stamping.
  • Core Fabricator — Recycles depleted fusion core casings into fresh cores at reduced material cost. Draws power from the grid.

Maintenance & Safety Risks
All generator variants track a maintenance interval (~15 min). Failing to service with a wrench while running escalates hazards specific to the generator type:

  • Diesel / Wastelander: degrading fuel lines → increasing fire probability each tick; worst-case auto-trip.
  • Atomic: aging containment seals → escalating localised radiation pulses.

Additional hazards across all types:

  • Pressing a lit welder or open flame against a generator builds heat_exposure; thresholds trigger fire_act() (diesel: sustained fire + neighbour spread; atomic: containment breach + wide radiation pulse).
  • Touching a live generator while standing in water electrocutes the user.
  • Cutting a live cable with wirecutters electrocutes the user.
  • Inserting fuel into a live generator causes an arc flash.
  • Diesel running indoors produces CO exhaust; sustained exposure causes escalating oxy/tox damage with staged warnings (4 ticks → headache, 8 → dizziness, 15 → critical).
  • Draining a diesel tank without a container held spills fuel on the floor.

Button-in-Wall Fix
Door/access buttons mounted on wall tiles (which are typically in /area/space rather than the stamped zone) now correctly respond to F13 grid power changes. power_change() on /area/f13 now explicitly sweeps closed tiles adjacent to the area and notifies buttons there. Both the generator's stamp_zone() and the wasteland relay maintain a button_sweep_cache of border space-tiles so each power toggle reaches those buttons without re-scanning the whole area.

F13 Turret Power Integration
F13 turrets now check area.f13_grid_power for their power state in non-immune, non-outdoor areas, so they go offline when a generator is down.

Vault Floor Tile Fix
Crowbarring and replacing vault floor tiles now correctly preserves the exact tile subtype and icon_state. ChangeTurf retains icon_state when the source and destination share the same DMI file; f13_vault plating and tile items carry saved_turf_type to recreate the exact subtype on re-placement.

Fuel Reagent Spills
/datum/reagent/fuel now creates a slippery oil decal when spilled on a turf (≥5 volume), matching diesel drain and tank fire behaviour.

New Area Subtypes
Adds granular sub-areas for Enclave, AHS, NCR, Legion, and Followers factions (barracks, armory, command, medical, etc.). Adds outdoors = 1 / open_space = 1 to forest and wildland areas, requires_power = TRUE to sewers, and a /wasteland/cold/powered alias for map compatibility.

Admin Tools
The master_breaker debug tool gains a full per-area power panel (toggle individual F13 areas live) and a new F13 Area Power Panel admin verb. Four in-game paper manuals are spawnable for player/mapper reference (Vault-Tec fusion, CPS diesel, Poseidon atomic, wastelander field guide by Wade Tucker).

Pre-Merge Checklist

  • You tested this on a local server.
  • This code did not runtime during testing.
  • You documented all of your changes.

Changelog

🆑
add: Added the F13 Faction Power Grid system generators, relays, junction boxes, breakers, and core fabricators now form a wired power chain factions must actively run and maintain.
add: Added four generator variants: fusion core (pre-War, 2000W), diesel (industrial, 750W), atomic (Poseidon, 1500W), and jury-rigged wastelander (diesel, 500W, range-limited outdoor use).
add: Added a wasteland relay post and breaker box as grid extension and manual cutoff components for the wastelander generator.
add: Added per-generator maintenance intervals: generators require a wrench service every ~15 minutes while running or risk escalating type-specific hazards (fire, radiation, auto-trip).
add: Added active safety hazards to generators water electrocution, arc flash on live refuelling, wirecutters shock on live cable, heat ignition from open flames, CO exhaust poisoning indoors from diesel.
add: Added atomic fuel cell item for the Poseidon atomic generator.
add: Added four in-game operator manuals for each generator variant (spawnable paper items).
add: F13 turrets now go offline when the grid supplying their area is down.
add: Added admin F13 Area Power Panel for per-area grid debugging.
add: Added new faction sub-area types for Enclave, AHS, NCR, Legion, and Followers.
fix: Fixed door/access buttons on wall tiles (in /area/space) not responding to F13 grid power changes.
fix: Fixed junction boxes in outdoor/wasteland areas lighting every light of that area type across the entire map outdoor stamping is now range-limited to the box's immediate vicinity.
fix: Fixed the breaker box not holding its OFF state when the generator cascades a power-on signal downstream.
fix: Fixed vault floor tiles not restoring the correct subtype and appearance when crowbarred and re-placed.
fix: Fuel reagent now creates a slippery oil decal when spilled on a turf.
tweak: Diesel generator enforces a 30-second hot-refuel cooldown after shutdown.
tweak: Diesel drain captures fuel into a held container; excess spills on the floor.
code: Generator fuel system is fully abstracted (accepted_fuel_path, fuel_is_liquid, fuel_per_unit, watts_per_fuel_unit) new generator variants only need to set vars and override hazard callbacks.
/:cl:

@Malerus Malerus marked this pull request as draft April 6, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant