Fleet carries mined resources until it delivers them to the mothership #14
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?
Part 1 of #12, and the foundation the rest of it stands on.
Today
Rock.gd:83doesGameState.rocks += 1the moment a rock is mined, so ore is banked globally and instantly wherever the fleet happens to be. #12 wants ore to be carried by the fleet and only counted once it reaches the mothership.Scope
GameState(survives the space <-> planet-surface scene swap, like everything else there).rocks.rockswhen the fleet reaches the mothership.GameState.get_mothership_position()already exists;PlanetFieldalready compares fleet CENTROID distance rather than per-ship collision, and this should do the same for the same reason (per-ship jostling makes boundary tests flicker).rocksdirectly - delivering to the mothership is already their whole job (GameState._process, theHAULER_ARRIVALpayout).Deliberately not here: the UI for it, and anything that spends resources. Those are separate tickets so this one can land verified on its own.
Acceptance
rocksunchanged.rocksand empties cargo.Done in
fc32e26.Rock.gdcreditedGameState.rockson pickup, so ore was banked instantly from anywhere on the map. Mining now fillsGameState.fleet_cargo, and that only becomes spendable when the fleet reaches the mothership.Delivery lives in
BuildingFieldbecause that node already knows where the buildings are and already answers "is the fleet standing on one?". It uses the fleet CENTROID - the same stable single-number testPlanetandBuildingalready use - rather than per-ship collision, which flickers as ships jostle in formation.Cargo lives in the
GameStateautoload so it survivesMain.tscnbeing torn down on every trip to a planet's surface. Ore mined ON a surface would otherwise be dropped the moment the player took off, which is the one place mining actually happens.Test
tests/test_fleet_cargo.gdcovers: mining fills the hold and leaves the bank alone; reaching the mothership banks the lot and empties the hold; with no mothership cargo just accumulates; parking on a different building is not a delivery; ore is conserved across the transfer; and cargo survives the space scene being torn down.The first version of it called
collect_cargo()directly - which would have passed withRock.gdcompletely untouched, since the entire change is which poolRock.gdcredits. It now flies a real ship over a realRock.tscninstance. That is the same mistake I made on #9 (testing around the real path instead of through it), so I went looking for it deliberately this time.Rock.gdbanks straight torocks(pre-#14 behaviour)test_resources_and_buildingsasserted the old behaviour and now asserts the new one. That is a spec change rather than a weakened test - the gathering assertion itself is unchanged.Full suite: 41/41.
Note for #15
On its own this makes mining look broken: the top-left counter still shows only
rocks, so gathering ore now visibly does nothing until the fleet happens to fly home. #15 is what closes that, so it should not sit unfinished for long.