Skip to content

feat(fp): player building crews that build phone orders in real time - #15

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

KunalSiyag merged 1 commit into
mainfrom
fp/crews

Conversation

@KunalSiyag

Copy link
Copy Markdown
Owner

What

Orders you place on foot from the phone now go to your own two building crews, who build them in real time on site, so you can see a build happen (feedback: "no visible build, want CoC-style crews").

Sim (scripts/sim/)

  • CitySim.apply_player_order(mi, a): apply_action for the phone. The order's sites go to the player's D.CREWS (2) crews instead of the contractors, and the order is kept in crew_jobs (total / done in crew seconds, crew -1 while it waits).
  • advance_crews(seconds): _process feeds it the frame time at game speed, holding time back while a sliced tick or spread work runs. Sites go through their stages, finished orders open, waiting orders take crews as they free up (crew_job_started / crew_job_finished, cancelled when a bulldoze clears the sites). Saves keep the orders.
  • Times (D.crew_seconds): 2 min (park) to 5 min (airport) at speed 1, 10 s per road tile (CREW_MIN_S, CREW_MAX_S, CREW_TILE_S).

Crews on site (scripts/fp/crews/, flag crews)

  • crew_rig.gd: a foreman by the gate, two builders whose clips follow the stage, a hauler carrying crates from a pile to the work, dust while they work, and a board over the gate naming the crew, the order, the stage and the time left. A crew that takes an order while you play walks in through the gate; a road crew moves along the road.
  • crew_bodies.gd: HC's trades bodies, loaded on background threads, pooled for reuse (stand-in capsules without the roster).
  • crew_grid.gd: a per-site walk grid (0.8 m cells) over the ground inside the hoarding and the construction kit's decks, clear of every collision box, cylinder and deck post, with links for steps and climbs.
  • crew_spots.gd: picks the door, the foreman's spot and pile, work spots the door reaches, and a drop point the hauler reaches without walking into the crew. When a finished building fills its lot, the crew works from the scaffold.
  • crew_card.gd: a card under the top bar listing the orders with stage, progress and countdown, and the ones waiting.
  • crews_feature.gd: wires it up. E on a worker gets a word about the job, the site's interact label names its crew, and a toast says when an order is done. There's a new crews photo-tour shot through a site gate.

Construction kit and view (scripts/world/)

  • ConstructionKit.deck() / decks_of(): where people stand on a site's own parts (the ground among the rebar, the poured slab, the slab under a frame, every frame floor, the scaffold boards) and which posts to keep clear.
  • The hoarding's gate faces the frontage road and is the Site root's gate meta. Each spoil berm now blocks on its own, so the pit inside is open ground.
  • CityView.site_gate(i) and site_decks(i) read them in world space.

Phone, HUD, interact

  • The phone builds through apply_player_order and shows how many crews are free and how long the order takes, or when a crew frees up.
  • hud_style gets crew colours, and the interact label shows which crew builds a site.

Shared

  • FpFeature.link_signal() / unlink_signals(): a shared way for features to connect signals and drop them in teardown (used by crews).
  • The crews feature frees its pooled bodies on NOTIFICATION_PREDELETE, so quitting without teardown does not leak them.

Tests

  • New fp_crew_jobs_test (sim: queueing, timing, sliced-tick hold, saves, cancel, finish_all_sites, instant mode).
  • New fp_crews_test (arrival through the gate, hauler route, talk, queue, every stage including the scaffold, finish, cancel, road crew, rebuild, photo shot, teardown, free without teardown).
  • fp_core_test and fp_player_test read the gate from CityView.site_gate.

Checks run

  • tools/gate.sh full with GATE_RETRIES=1: PASS (36 steps, no flaky steps).
  • tools/gate.sh render --only fp_photo: PASS (24 shots, including the new crews shot).
  • pre-commit run --all-files and python tools/checks/run_all.py: PASS.
  • tools/gen_api_docs.py: regenerated docs/api; README.md and docs/fp/ARCHITECTURE.md updated.

Orders placed from the phone now go to the player's two building crews
instead of the contractors. CitySim.apply_player_order hands an order's
sites to a crew and keeps the order in crew_jobs; advance_crews moves
the crews on with the frame time at game speed, held back while a
sliced tick or spread work runs. A building takes 2 minutes (a park) to
5 (the airport) at speed 1 and a road 10 seconds a tile; a third order
waits for a free crew. Sites go through their stages as the work goes
in, finished orders open, a bulldoze cancels the order, and saves keep
the orders.

Each crew is on its site to see: a foreman by the gate, two builders
whose clips follow the stage and a hauler carrying crates from a pile
to the work, in the trades bodies from the character roster, with dust
and a board over the gate naming the crew, the order, the stage and the
time left. A crew that takes an order while you play walks in through
the gate, and a road crew moves along the road.

Where they stand comes from a per-site grid (crew_grid.gd) over the
ground inside the hoarding and the construction kit's new decks: the
ground among the rebar, the slab, every frame floor and the scaffold
boards, with the posts kept clear. crew_spots.gd picks the door, the
foreman's spot, work spots the door reaches and a drop point the hauler
reaches without walking into the crew. The hoarding gate now faces the
frontage road, and each spoil berm blocks on its own, so the pit inside
is open ground.

The phone says how many crews are free and how long an order takes, a
card under the top bar counts down the orders, E on a worker gets a
word about the job and the site's interact label names its crew.
FpFeature gains link_signal() and unlink_signals() for teardown.

Behind the "crews" flag, with fp_crew_jobs_test (sim) and fp_crews_test
(grid, spots, rig, card, photo shot); fp_core_test and fp_player_test
read the gate from CityView.site_gate.

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 39 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 4baf21e into main Oct 20, 2026
8 checks passed
@KunalSiyag
KunalSiyag deleted the fp/crews branch October 20, 2026 23:54
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