spaceship/ExplorationTracker.gd
Loïc Wisniewski 85814ce88c Initial commit: SpaceshipTest, a top-down space RTS in Godot 4.7.1
A fleet of neon-outlined ships explores a procedurally generated, seeded
infinite world: tap/joystick steering, pinch zoom, formation pivoting,
planet landings, an ore economy with extractors and haulers, and player
built structures (mothership, ship crafter, command centre).

All art is hand-drawn with draw_* calls rather than textures, and the
backgrounds are camera-relative shaders so they stay precise at large
world coordinates.

Includes a 35-test headless suite (tests/run_tests.sh) plus screenshot
tooling that renders real frames through Xvfb and Mesa softpipe, since
--headless has no GPU.

Excluded from version control: .godot/ (import cache, and it holds
export credentials), builds/, android/build/ and packaged APKs - all
regenerable, and ~325 MB combined.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 18:41:58 +02:00

23 lines
924 B
GDScript

extends Node2D
# Tracks which world chunks have been explored (fleet has come within
# sensor range), so the world map can reveal only chunks actually visited
# instead of the whole procedurally generated world at once. Writes
# directly into GameState.explored_chunks (not a local dict) so this
# history survives the Main.tscn <-> PlanetSurface.tscn scene swap, which
# tears down and recreates this node from scratch each time.
@export var sensor_radius_chunks: int = 1
@onready var fleet: Node2D = get_node("../Fleet")
func _process(_delta: float) -> void:
var center_chunk: Vector2i = WorldGen.chunk_coords(fleet.get_centroid())
for dx in range(-sensor_radius_chunks, sensor_radius_chunks + 1):
for dy in range(-sensor_radius_chunks, sensor_radius_chunks + 1):
GameState.explored_chunks[center_chunk + Vector2i(dx, dy)] = true
func get_explored_chunks() -> Array:
return GameState.explored_chunks.keys()