Compose planet surfaces from profiles

This commit is contained in:
Loïc Wisniewski 2026-08-14 16:05:32 +02:00
commit 2f68515f33
19 changed files with 123 additions and 39 deletions

View file

@ -4,6 +4,7 @@ extends Node2D
func _ready() -> void:
GameState.planet_name = "Violet Tempest"
GameState.planet_type = "gas_giant"
GameState.surface_profile_id = "gas"
GameState.surviving_ship_count = 3
GameState.rocks = 128
GameState.gas = 46

View file

@ -37,19 +37,34 @@ func _process(delta: float) -> bool:
# emission advances continuously so the source visibly looks active.
game_state.planet_name = "Gas Test"
game_state.planet_type = "gas_giant"
game_state.surface_profile_id = "gas"
var surface: Node = load("res://PlanetSurface.tscn").instantiate()
root.add_child(surface)
var rock_field: Node = surface.get_node("RockField")
var gas_field: Node = surface.get_node("GasVentField")
if not rock_field.rocks.is_empty() or rock_field.is_processing():
var gas_field: Node = surface.get_node("SurfaceFeatures/ResourceProvider")
if gas_field.get_script() != load("res://GasVentField.gd"):
surface.free()
return _fail("gas surface spawned or continued processing ore rocks")
return _fail("gas surface did not compose the gas feature scene")
if surface.get_node_or_null("RockField") != null:
surface.free()
return _fail("gas surface tree contains an ore producer")
gas_field._process(0.5)
if gas_field.emission_phase <= 0.0:
surface.free()
return _fail("gas-source emission animation did not advance")
surface.free()
game_state.surface_profile_id = "rocky"
var rocky_surface: Node = load("res://PlanetSurface.tscn").instantiate()
root.add_child(rocky_surface)
var rocky_features: Node = rocky_surface.get_node("SurfaceFeatures/ResourceProvider")
if rocky_features.get_script() != load("res://RockField.gd"):
rocky_surface.free()
return _fail("rocky surface did not compose the ore feature scene")
if rocky_surface.get_node_or_null("GasVentField") != null:
rocky_surface.free()
return _fail("rocky surface tree contains a gas producer")
rocky_surface.free()
var found_giant: bool = false
for x in range(-12, 13):
for y in range(-12, 13):