Skip to content

feat(retro-office): make local-office floor footprint configurable - #143

Open
lucapinello wants to merge 1 commit into
iamlukethedev:mainfrom
lucapinello:casa/configurable-floor-footprint
Open

feat(retro-office): make local-office floor footprint configurable#143
lucapinello wants to merge 1 commit into
iamlukethedev:mainfrom
lucapinello:casa/configurable-floor-footprint

Conversation

@lucapinello

Copy link
Copy Markdown

Make the local-office floor footprint configurable

What

The local-office floor plate is currently hardcoded to 1800×720 in
src/features/retro-office/core/district.ts:

export const LOCAL_OFFICE_CANVAS_WIDTH = 1800;
export const LOCAL_OFFICE_CANVAS_HEIGHT = 720;

This PR makes those two values read from environment variables, falling back to
the current constants when unset:

  • LOCAL_OFFICE_CANVAS_WIDTHNEXT_PUBLIC_LOCAL_OFFICE_WIDTH (default 1800)
  • LOCAL_OFFICE_CANVAS_HEIGHTNEXT_PUBLIC_LOCAL_OFFICE_HEIGHT (default 720)

Parsing is defensive (positive integers only; anything else falls back to the
default), so a missing or malformed value can never break an existing install.

Why

The default footprint is a long, corridor-shaped call center. Some deployments
want a different shape — our use case is a household / "home" floor: a
compact, roughly-square plate with a central common room ringed by a few rooms,
which reads as a home rather than an office. Today that requires editing core
geometry; this makes it a config knob instead.

Everything downstream already derives from these two constants — the floor plane,
the four perimeter walls, the interior floor lines and the isometric camera
framing (SCALE / toWorld / LOCAL_CAMERA_TARGET), plus the walkability zone
LOCAL_OFFICE_ZONE used by pathfinding — so overriding them reshapes the whole
plate coherently with no other changes.

The one guard added

The built-in east-wing gym / QA-lab decorative floor tiles in
scene/environment.tsx are authored at fixed canvas coordinates
(x ∈ [1092, 1534]). On a plate smaller than the default they would render past
the wall. A new exported flag, FOOTPRINT_FITS_DEFAULT_OFFICE (true only when the
plate is at least the default size), now gates those two tile blocks so they
render exactly as before on the default footprint and are cleanly omitted on a
smaller custom one.

Backwards compatibility

Fully backwards compatible. With no env vars set, the footprint is exactly
1800×720 and FOOTPRINT_FITS_DEFAULT_OFFICE is true, so rendering is
byte-identical to before. npx tsc --noEmit passes.

Files

  • src/features/retro-office/core/district.ts — env-driven footprint + the
    FOOTPRINT_FITS_DEFAULT_OFFICE flag.
  • src/features/retro-office/scene/environment.tsx — gate the east-wing
    decorative tiles on the new flag.

The local-office floor plate is hardcoded to 1800x720 in core/district.ts.
Make LOCAL_OFFICE_CANVAS_WIDTH/HEIGHT read from NEXT_PUBLIC_LOCAL_OFFICE_WIDTH/
HEIGHT (positive ints), falling back to the current 1800/720 defaults so nothing
changes for existing users. Floor, walls, floor lines, camera framing and the
walkability zone all already derive from these two constants, so overriding them
reshapes the plate coherently.

Add FOOTPRINT_FITS_DEFAULT_OFFICE and gate the east-wing gym/QA-lab decorative
floor tiles (authored at fixed x in [1092,1534]) on it, so they render exactly as
before on the default footprint and are cleanly omitted on a smaller custom plate
instead of spilling past the wall.

Motivating use case: a household/home floor (compact, roughly-square plate with a
central common room ringed by a few rooms) instead of the default call-center
corridor.
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