Add gas giant resource system

This commit is contained in:
Loïc Wisniewski 2026-08-13 21:07:35 +02:00
commit fc68c4e8cf
9 changed files with 180 additions and 10 deletions

View file

@ -19,6 +19,7 @@ const PLANET_NAMES: Array = [
"Drift Anchor", "Stonefall", "Grey Watch", "Silent Quarry",
"Baros Rock", "Umbra Point",
]
const GAS_GIANT_NAMES: Array = ["Aurelia", "Boreas", "Cerulean Deep", "Helios Major", "Vesper"]
static var _noise: FastNoiseLite
static var _planet_noise: FastNoiseLite
@ -79,7 +80,13 @@ static func planet_data_at_chunk(chunk: Vector2i) -> Dictionary:
var local_pos: Vector2 = Vector2(rng.randf() * CHUNK_SIZE, rng.randf() * CHUNK_SIZE)
var planet_name: String = PLANET_NAMES[rng.randi() % PLANET_NAMES.size()]
var shape_seed: int = rng.randi()
return {"local_pos": local_pos, "name": planet_name, "shape_seed": shape_seed}
# A stable per-chunk roll makes gas giants persistent landmarks rather
# than a different resource whenever the scene reloads.
var gas_giant: bool = rng.randf() < 0.28
if gas_giant:
planet_name = GAS_GIANT_NAMES[rng.randi() % GAS_GIANT_NAMES.size()]
return {"local_pos": local_pos, "name": planet_name, "shape_seed": shape_seed,
"planet_type": "gas_giant" if gas_giant else "rocky", "resource_type": "gas" if gas_giant else "ore"}
static func biome_color(biome: int) -> Color: