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()