Render the entrance arrow during ghost placement #63
No reviewers
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder!63
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "61-render-entrance-placement-arrow"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Renders a flat chevron on the doorstep tile during ghost placement, pointing at the building's door, so the player can see which way the entrance faces while rotating with R and T.
Builds on #55, which added the data model:
BuildingFootprintparses an arrow into an anchor-relativedoorstep(steps)and a unitentrance_direction(steps).Changes
BuildingSite.yaw_for(direction)— turns a grid-space direction into the Y rotation for a mesh authored pointing along-Z. It sits besiderotation_for()because it is the same kind of thing (pure site maths, no node, no state) and because a static is testable headless, which the rendering is not.It negates the ints rather than the floats.
-float(0)is-0.0, andatan2(-0.0, -0.0)is a half turn rather than none — the float form pointed a failed-parse footprint backwards. A test pins the zero case.PlacementController— a thirdMeshInstance3Dsibling of the ghost:_ready(), not per frame. Unlike the placement highlight, which regenerates because its cells change with every hover, the arrow's shape never varies — only where it stands and which way it faces, and those are the node's transform. Two triangles meeting at a notch, wound so the face normal points at+Y, sized as ratios oftile_sizevia three new exports.cell_to_world(anchor + doorstep(steps))plus its ownarrow_hover_height.cell_to_world()already sits on the tile's top face, so there is no separate height lookup.UNSHADEDandCULL_DISABLED, for the same reasons the highlight's is:ImmediateMeshcarries no normals unless asked, and a lit material with none renders black.cells.is_empty()— the same bargainBuildingSite.position_for()makes, so a footprint that failed to parse stays quiet rather than reporting itself sixty times a second.The arrow keeps one colour rather than following the validity tint. Which way the door faces is true whether or not the site is legal, and a second thing changing colour alongside the ghost reads as noise. Easy to reverse if it plays badly.
Verification
Full GUT suite green: 177/177, 1063 asserts, no orphans. Four new tests on
yaw_for: the cardinals by hand, the property thatVector3.FORWARDrotated by the yaw lands on the direction asked for, the doorstep invariant at all four rotations ofone_by_three_L, and the zero-direction case.tools/screenshot_entrance_arrow.gd— straight-down orthographic shot ofone_by_three_Lat all four rotations, footprint tiles in blue with the anchor lighter, arrow in red. In every one the arrow stands on an unoccupied tile and points into the L:It draws no building mesh on purpose — the first attempt did, and an opaque box over the tiles in question makes the shot useless.
Confirmed in the running game by hand: the arrow appears in placement mode, tracks the door through all four rotations at the game's own camera angle, and disappears on cancel. The four exports were tuned there.
Noted while doing this
The GUT suite passed 177/177 while
placement_controller.gdhad a parse error in it — no test loads that script, so nothing noticed. It was caught by bootinggame.tscnheaded for twenty frames. Every controller change is currently unverified by the suite; a boot check promoted intotools/would close that gap. Worth its own issue.Closes #61
🤖 Generated with Claude Code
https://claude.ai/code/session_01DtdF9mqzKi95DHBn9Et1pz