spaceship/CargoCounter.gd
Loïc Wisniewski d1b82f4f5a Show what the fleet is carrying next to what is banked
Forgejo #15, part 2 of #12. Since #14 ore is cargo until the fleet
delivers it to the mothership, so the banked readout does not move on
pickup - mining looked broken, because gathering ore changed no number
on screen until the fleet happened to fly home.

Three things separate the carried readout from the banked one, since
colour alone is a weak signal on a phone in a game that is mostly teal:
amber rather than ore-teal (the same amber already used for ore in
transit - the extractor derrick, the hauler route), smaller and sitting
under the banked figure so it reads as subordinate, and present only
while actually carrying, so an empty hold is not a permanent 0 parked
beside the real total.

Rendered via tests/screenshot.sh and looked at, not only asserted on:
headless draws no pixels and cannot say whether two numbers read as two
different things.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 16:04:40 +02:00

33 lines
1.3 KiB
GDScript

extends NeonNumber
# What the fleet is CARRYING, shown under the banked total (#15, part 2 of
# #12). Since #14 ore is cargo until the fleet delivers it to the mothership,
# so without this, mining visibly does nothing - the banked figure above does
# not move until the fleet flies home, which reads as gathering being broken.
#
# Three things separate it from the banked readout, because colour alone is a
# weak signal on a phone screen in a game that is mostly teal:
# - amber rather than ore-teal, the same amber used elsewhere for ore in
# transit (the extractor derrick, the hauler route)
# - smaller, sitting UNDER the banked figure: subordinate to it, because
# this is the number that is not yours yet
# - present only while actually carrying something, so an empty hold is not
# a permanent zero taking up space next to the real total
#
# Reads GameState directly for the same reason ResourceCounter does: it stays
# correct across the space <-> planet-surface scene swap with nobody having
# to push updates into it.
const CARGO_GLOW: Color = Color(1.0, 0.78, 0.25)
const CARGO_CORE: Color = Color(0.22, 0.12, 0.0)
func _ready() -> void:
glow_color = CARGO_GLOW
core_color = CARGO_CORE
func _process(_delta: float) -> void:
visible = GameState.fleet_cargo > 0
if visible:
set_amount(GameState.fleet_cargo)