Randoloot/tests/levels/landscape_generation_test.gd
2026-10-18 14:46:34 +02:00

24 lines
1.2 KiB
GDScript

extends Node
const GENERATOR := preload("res://scripts/planets/surface_generator.gd")
func _ready() -> void:
var styles := {}
var kinds := {}
for index in 6:
var profile: Dictionary = preload("res://scripts/planets/planet_profiles.gd").generate(711,index,"Test")
profile.temperature = 70 if index==4 else (-30 if index==5 else 20)
var data: Dictionary = GENERATOR.generate(200+index,profile)
styles[data.landscape.name] = true
assert(data.pois.size() >= 4 and data.pois.size() <= 6 and data.rocks.size() > 0)
assert(not data.has("rivers") and not data.has("river"))
assert(data.structures.size() > 0)
for structure in data.structures:
kinds[structure.kind] = true
for mountain in data.mountains:
assert(structure.position.distance_to(mountain.position) >= float(structure.size)*0.55+float(mountain.size)*0.7)
assert(data.height_texture.get_width() == 1024)
var repeated: Dictionary = GENERATOR.generate(200+index,profile)
assert(repeated.structures == data.structures and repeated.events == data.events and repeated.pois == data.pois)
assert(styles.size() == 6 and kinds.size() >= 4)
print("LANDSCAPE GENERATION PASS: six styles, seven scenery types, deterministic layouts, no rivers, separated mountains and buildings")
get_tree().quit()