when an extractor is built on a planet it should how up that something is built there #9
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?
Done. A planet with an extractor built on it now shows it, in both places you look at a planet.
The extractor lives on
PlanetSurface.tscn, a scene you are not looking at from space, so an already-mined planet was indistinguishable from an untouched one - you had to land to find out. Marking it only on the world map would have been half an answer, since most of the time you are looking at planets in space.Planet.gd): an amber derrick planted on the planet's outline. It is anchored to the shape's own topmost vertex rather than a fixed radius, so it sits ON the rim whatever lumpy shape the seed drew, instead of floating off it or sinking inside it.WorldMapContent.gd): a small amber badge on the planet marker, in the same amber, so the two read as the same fact.Both are keyed by planet NAME via the existing
GameState.has_extractor_at().Planet.gdresolves it once in_ready()rather than polling: building an extractor happens on the surface scene, and coming back to space rebuildsMain.tscnfrom scratch, so a Planet node never outlives a change to its own answer.Test
tests/test_planet_extractor_marker.gdchecks that a planet with no extractor shows neither derrick nor badge, that building one turns both on, that the marker does not leak onto a different planet, and that the derrick actually clears the outline.Mutation-testing the assertions caught a bug in my own test, which is why it is worth doing. The "is the derrick buried inside the planet?" check originally took the furthest of all four derrick points from the centre. That passes a derrick pointing straight into the ground: the two base corners sit a half-width to either side of the rim vertex, so they are
sqrt(|base|^2 + w^2)from the centre and clear the rim on their own. I confirmed the hole by flippingDERRICK_HEIGHTnegative - the test passed happily. The check now measures the tip alone (extractor_derrick_tip()), and the same mutation fails it.DERRICK_HEIGHTnegated)Looked at it
tests/_planet_derrick_preview.tscnrenders a mined planet next to an untouched one for real (Xvfb + Mesa softpipe, viatests/screenshot.sh). The derrick is clearly visible on the left planet and absent on the right; I sized it up once after seeing it at gameplay scale. The map badge was checked the same way viatests/_marker_preview.tscn.Full suite: 40/40 passing.
Reopening the outcome here: you were right that this had no visible effect in game, and the cause was a wrong assumption of mine rather than a build/caching issue.
Planet.gdresolved the marker once in_ready(), on the stated assumption that extractors are built onPlanetSurface.tscnand that returning to space rebuildsMain.tscnfrom scratch - so a Planet node could never outlive a change to its own answer.That is not how it works. Extractors are built from space, via
BuildController._planet_under_fleet()with the fleet parked on the planet (BuildController.gd:334-341). The Planet node is therefore already in the tree with_ready()long since run,shows_extractorhad already been resolved tofalse, and nothing ever updated it. The derrick only turned up if the planet later drifted out ofPlanetField's spawn radius and came back. Building an extractor read as doing nothing at all.Fixed in
2eb779e:GameStateemitsextractor_added, andPlanetkeeps its marker in step with it - redrawing only when its own answer actually changes, not per frame.Why the test did not catch it: it registered the extractor and then spawned a planet, which is the opposite of the order the game does it in. Spawning fresh always looked right. The test now keeps a planet alive across the build and asserts the derrick appears on that already-present node; with the signal connection removed it fails with "a planet already in the tree never picked up its derrick".
That is a gap in how I verified the original ticket: I tested
Planet.gdin isolation with a hand-setplanet_name, and rendered a screenshot of planets that already had their extractor registered at spawn. Neither exercised the actual build flow, which is the only path a player takes.Full suite: 40/40.