58 lines
2.6 KiB
GDScript
58 lines
2.6 KiB
GDScript
extends Node
|
|
const CONDITIONS := preload("res://scripts/planets/surface_weather_conditions.gd")
|
|
func _ready() -> void:
|
|
GameState.start_new_run()
|
|
var rng := RandomNumberGenerator.new()
|
|
rng.seed = 123
|
|
for biome in range(6):
|
|
for sample in range(200):
|
|
var selected := CONDITIONS.pick(biome,rng)
|
|
assert(selected in CONDITIONS.CLIMATES[biome])
|
|
if biome == 4: assert(CONDITIONS.DATA[selected].mode != "rain" and CONDITIONS.DATA[selected].mode != "snow")
|
|
if biome == 5: assert(CONDITIONS.DATA[selected].mode != "rain")
|
|
var gallery := Image.create(1440,810,false,Image.FORMAT_RGBA8)
|
|
var index := 0
|
|
for condition in CONDITIONS.DATA:
|
|
var biome := 4 if condition == "dust_storm" else (5 if condition in ["snow","blizzard"] else 0)
|
|
var profile: Dictionary = preload("res://scripts/planets/planet_profiles.gd").generate(99,biome,"Pogoda")
|
|
profile.temperature = 75 if biome == 4 else (-35 if biome == 5 else 20)
|
|
var progress: Resource = GameState.captain.expedition
|
|
progress.lander_hp = 100
|
|
assert(progress.begin_visit(profile))
|
|
progress.visit_seed = 200+biome
|
|
var surface := preload("res://scripts/planets/surface_screen.gd").new()
|
|
surface.captain = GameState.captain
|
|
surface.progress = progress
|
|
add_child(surface)
|
|
surface.set_process(false)
|
|
surface.set_physics_process(false)
|
|
var weather: Node2D = surface.weather
|
|
weather.set_process(false)
|
|
assert(weather.set_condition(condition,true))
|
|
assert(not weather.set_condition("invalid"))
|
|
for step in range(360):
|
|
weather._process(1.0/60)
|
|
weather._clouds._process(1.0/60)
|
|
assert(weather._particles.size() > 0 and weather._particles.size() <= weather.LIMIT)
|
|
assert(weather._clouds._banks.size() == 74)
|
|
assert(is_equal_approx(weather._clouds.darkness,float(CONDITIONS.DATA[condition].darkness)))
|
|
if condition == "storm":
|
|
weather.trigger_lightning()
|
|
weather.queue_redraw()
|
|
assert(weather._bolt.size() == 9 and weather._flash > 0)
|
|
surface._update_hud()
|
|
for frame in 5: await get_tree().process_frame
|
|
await RenderingServer.frame_post_draw
|
|
var screenshot := get_viewport().get_texture().get_image()
|
|
screenshot.save_png("res://artifacts/weather_condition_%s.png" % condition)
|
|
screenshot.convert(Image.FORMAT_RGBA8)
|
|
screenshot.resize(480,270,Image.INTERPOLATE_LANCZOS)
|
|
gallery.blit_rect(screenshot,Rect2i(0,0,480,270),Vector2i(index%3*480,index/3*270))
|
|
index += 1
|
|
progress.finish_visit(GameState.captain,false)
|
|
surface.free()
|
|
await get_tree().process_frame
|
|
gallery.save_png("res://artifacts/weather_conditions_review.png")
|
|
print("WEATHER_CONDITIONS_OK: nine states, climate restrictions, 74 cloud banks, bounded particles, lightning, visible status")
|
|
get_tree().quit()
|