Skip to content

feat(fp): phone Build app that builds for the mayor who owns the land - #11

Merged
KunalSiyag merged 1 commit into
mainfrom
fp/build
Oct 20, 2026
Merged

KunalSiyag merged 1 commit into
mainfrom
fp/build

Conversation

@KunalSiyag

Copy link
Copy Markdown
Owner

Summary

A GTA-style phone with a Build app. Press B on foot and order city work on the tile ahead of you. The order is placed for the mayor who owns that land and paid from that district's treasury.

  • Tools (keys 1-6):
    • Road
    • Homes, Shops and Industry zones
    • Build: a service building, picked with the mouse wheel and listed cheapest first, from Park to Airport
    • Bulldoze
  • Placing: left click places the order, right click undoes a start point (or closes the phone), and B or Esc closes it. A road takes a start click and an end click and follows the same L-shaped path as the mayors' roads. A zone takes two corner clicks.
  • Aiming: the target is the tile ahead along the camera's heading. Looking straight ahead picks 2 tiles out, looking up reaches 6, and looking down picks the next tile. Tiles are 20 m and the eye is under 2 m up, so a ray to the ground swung by whole tiles per degree; the pitch picks the distance instead.
  • The mayor's authority: each order goes through CitySim.apply_action(owner, action). It follows the mayors' rules (it counts in their actions_ok) and starts the same staged construction sites.
    • Unclaimed land is refused ("no mayor to build for").
    • A road that crosses into another district is refused.
    • A district past the sim's debt floor is refused.
    • The toast names the district that placed the order.
  • Preview (build_rules.gd): read-only copies of _act_road, _act_zone, _act_build (including the nearby-lot search) and _act_bulldoze. The ghost covers the right tiles in cyan when the order can be placed and amber when not, and the phone shows the price; the sim still checks again when the order is placed. The test checks that every quote matches what the owner actually paid.
  • Phone UI:
    • The owning district, "Acting for Mayor …" and that district's treasury.
    • A grid of the six tools.
    • The chosen building and its price.
    • What the click will do or why not.
    • The keys.
    • It slides in at the bottom right, above the district caption.
  • Put away while driving (drive_changed) or under any menu. It does not open in the city overview, so B still steps through sites there.
  • Wiring:
    • Feature phone in scripts/fp/phone/, behind the phone flag. The folder is not named build/ because the root .gitignore ignores that name.
    • Input action phone_toggle (B); only the [input] section of project.godot changed.
    • The pause-menu key list shows B.

No gamepad binding yet: every pad button is already used on foot, so the phone is keyboard and mouse only for now.

Area

  • sim
  • ai
  • fp
  • world
  • assets
  • tooling / CI

Testing

  • tools/gate.sh quick passes
  • tools/gate.sh full passes (gameplay or rendering changes)
  • pre-commit run --all-files passes (on the changed files)
  • Added or updated a test in tools/tests/
  • Checked in game (describe below, screenshots welcome)

New fp_phone_test (45 checks):

  • Road path shape and length cap, like the sim's.
  • The phone shows the owner, the mayor and the treasury; the ghost marks the aimed tile.
  • A road from a start click to an end click, priced at $30 for 3 tiles, with undo of the start.
  • A road in another district is paid by that district only.
  • Refusals with a toast: a road into another district, unclaimed land, and a district at the debt floor.
  • Zoning homes, building a park, the building list wrapping around, and bulldozing.
  • For every placement, the phone's quote equals what the owner paid.
  • Aiming: 2 tiles ahead when looking level, 6 looking up, the next tile looking down.
  • Keys: B and the number keys.
  • The phone goes away while driving and under a menu.
  • Teardown.

fp_core_test now counts 12 features.

I checked it in windowed captures at 1280x720 (third person):

  • The phone shows Northwest Civic Campus, Acting for Mayor Ada Okafor, $6.4k.
  • A 4-tile road preview shows as a cyan band down the street; placing it charged $40, and machines and cones appeared on the site. The toast read "Northwest Civic Campus: Road construction started on 4 tiles".
  • The School preview showed its price.

The first captures caught two problems, both fixed here: a 30 cm ghost slab was almost invisible from 50 m, so it is now a slab plus a faint column, and the toast was cut off.

Checklist

  • Conventional Commit title (feat(fp): ..., fix(sim): ...)
  • No secrets, API keys or raw prompts in code or logs
  • New gameplay behind a flag in data/feature_flags.json, or not needed (phone)
  • Docs updated (README, AGENTS.md, docs/) if behaviour or commands changed (ARCHITECTURE row and input action, README and PLAYING keys, API docs regenerated)
  • No new files over 5 MB, or explained here

B opens a phone with a Build app on foot: road, homes, shops, industry,
a building from the service list, and bulldoze, aimed at the tile ahead
(the camera's pitch sets the distance, 0.6 to 6 tiles). Each order goes
through CitySim.apply_action for the mayor who owns that tile, so it is
paid from that district's treasury and starts the same construction
sites as the mayors' own orders. Unclaimed land, roads into another
district and districts too deep in debt are refused with a toast.

build_rules.gd mirrors the sim's checks for the preview: a cyan or amber
ghost over the tiles, the owner, the price and why not. The phone goes
away while driving or under a menu. Behind the "phone" flag, with
fp_phone_test.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Automated review

No new findings on the 20 changed files (gdlint, complexity, TODO policy, dead code).

Run python3 tools/checks/run_all.py locally for the full set of checks.

@KunalSiyag
KunalSiyag merged commit bd7e5e4 into main Oct 20, 2026
8 checks passed
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