Draw capture points behind fleet vessels #50
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Capture point rings currently draw over the fleet, so a ship parked inside one is partly swallowed by the ring fill - exactly where the player most needs to see their own vessels.
Why it happens
CapturePoint(added underPlanetSetupHost, insideSurfaceFeatures) leavesz_indexat its default0, the same layerShipdraws on. The codebase already has a settled convention for world objects that must sit behind the fleet, all of them settingz_index = -1in_ready():Planet.gd:66,Rock.gd:31,Building.gd:19,Hauler.gd:14,Transporter.gd:14,VesselDelivery.gd:11Scope
CapturePoint._ready(), setz_index = -1, with a one-line comment naming the convention (same shape as the comment inRock.gd).Out of scope
Any change to capture behaviour, colours, or radii.
Acceptance criteria
bash tests/run_tests.sh capturepasses.Tests
Extend
tests/test_capture_points.gdwith az_index < 0assertion (no new test file needed) and re-rendertests/_capture_points_preview.tscn, adding a ship inside one of the rings so the layering is actually visible in the shot.Repo notes (read before starting)
/storage/emulated/0/GodotProjects/SpaceshipTest.touchon it. Android FUSE does not bump mtime under~/storage/shared, and Godot's import cache will silently keep serving the old version, making a correct fix look like it did nothing.bash tests/run_tests.sh <substring>; full suite with no argument. Tests areSceneTreescripts printingTEST_NAME: PASS/TEST_NAME: FAIL (reason)and callingquit(0|1)- copy the shape oftests/test_capture_points.gd.bash tests/screenshot.sh <res://Scene.tscn> <out.png> <frames> 720x1280. Use few frames (~15); the software rasterizer is slow.--headlessrenders nothing at all, so it cannot validate visuals.NeonDraw/NeonPiece; do not introduce a different visual idiom.*Definitionresources plus capability component scenes. Do not addif type == "..."branches.FileAccess, nouser://).GameStateis an in-memory autoload. Do not invent a save system.Traps that have already cost hours on this codebase
const X = preload(...)in a test file that is itself the-sentry point. It evaluates during that file's own early compilation, which can run before autoloads are registered; any script it pulls in that referencesGameStateinside a function body then fails to compile withIdentifier not found: GameState. Usevar X: Scriptplusload()inside_initialize()instead. See the header comment intests/test_capture_points.gd.[]to a typedArray[Resource]export from another script fails at runtime - the compiler only sees the target asResourceand cannot confirm the element type. Leave the declared default alone, or build the typed array inside the owning script.Fleet.spawn_ships(0, ...)does not empty the fleet - it falls back to one default interceptor by design. Clearfleet.shipsexplicitly if a test or preview needs genuinely zero ships.ship.positionwithout also settingship.move_targetletsShip._physics_processsteer it straight back toward the stale target within a few frames.SceneTreetest's own_process()clock under device load, even with--fixed-fps 60. Gate waits on the system's own state (a component's timer or flag), not onelapsed >= duration.queue_free()s itself (projectiles, shells) must not be re-read inside a per-frame wait condition - cache the scalar you need before the wait._screenshot_tool.gd's_initialize(), so their_ready()races the game scene's own_ready(). Do setup on the first_process()tick, andget_tree().paused = trueonce everything is placed if the scene must hold still.Implemented and pushed as
5b2dd77.CapturePoint.gdleftz_indexat its default0, the same layerShipdraws on, so a ship parked inside a ring was partly swallowed by the ring fill. Setz_index = -1in_ready(), matching the convention every other world object already follows.Verified visually: rendered a ship directly on top of a capture point ring and confirmed it draws fully in front. Asserted
z_index < 0intests/test_capture_points.gd.