102 lines
4.3 KiB
GDScript
102 lines
4.3 KiB
GDScript
extends Node
|
|
const RANGE := preload("res://scripts/planets/orbital_contact_range.gd")
|
|
|
|
func settle() -> void:
|
|
for frame in 5: await get_tree().process_frame
|
|
await RenderingServer.frame_post_draw
|
|
|
|
func capture(name: String) -> void:
|
|
await settle()
|
|
get_viewport().get_texture().get_image().save_png("res://artifacts/surface_atmosphere_%s.png" % name)
|
|
|
|
func _ready() -> void:
|
|
GameState.start_new_run()
|
|
GameState.system_seed = 8428159
|
|
var game := preload("res://scenes/game/game.tscn").instantiate()
|
|
add_child(game)
|
|
await settle()
|
|
var manager := game.get_node("PlanetExpeditions")
|
|
for enemy in get_tree().get_nodes_in_group("enemies"): enemy.position = Vector2(9999,9999)
|
|
game.player.landing_combat_lock = 0
|
|
game.player.set_physics_process(false)
|
|
var planet: Node2D = game.protected_planet
|
|
game.player.position = planet.position+Vector2(planet.radius+40,0)
|
|
manager._message_time = 0
|
|
manager._process(0)
|
|
assert(not manager._prompt.visible and not game.is_near_protected_planet())
|
|
game.player.position = planet.position+Vector2(planet.radius*0.85,0)
|
|
manager._process(0)
|
|
assert(manager._prompt.visible and game.is_near_protected_planet())
|
|
game.player.position = manager.freighter.position+Vector2(140,0)
|
|
manager._process(0)
|
|
assert(not RANGE.at_freighter(game.player,manager.freighter))
|
|
game.player.position = manager.freighter.position+Vector2(45,0)
|
|
manager._process(0)
|
|
assert(manager._prompt.visible and manager._land_button.text == "DOKUJ [L]")
|
|
game.player.position = manager.freighter.position+Vector2(0,155)
|
|
assert(not RANGE.at_freighter(game.player,manager.freighter))
|
|
game.free()
|
|
var progress: Resource = GameState.captain.expedition
|
|
var profile: Dictionary = preload("res://scripts/planets/planet_profiles.gd").generate(99,0,"Atmosfera")
|
|
profile.temperature = 20
|
|
profile.oxygen = 98
|
|
profile.flora = 0
|
|
assert(progress.begin_visit(profile))
|
|
progress.visit_seed = 200
|
|
var surface := Control.new()
|
|
surface.set_script(preload("res://scripts/planets/surface_screen.gd"))
|
|
surface.captain = GameState.captain
|
|
surface.progress = progress
|
|
add_child(surface)
|
|
surface.set_physics_process(false)
|
|
surface.set_process(false)
|
|
var atmosphere: Node2D = surface._surface_viewport.get_node("SurfaceAtmosphere")
|
|
var mountains: Node2D = surface.world.get_node("Mountains")
|
|
assert(mountains.material.shader.resource_path.ends_with("mountain_blend.gdshader"))
|
|
assert(atmosphere.clouds.z_index > surface.lander.z_index)
|
|
assert(atmosphere.shadows.z_index < surface.lander.z_index)
|
|
assert(atmosphere._banks.size() == 49)
|
|
assert(atmosphere.TEXTURE.get_image().has_mipmaps())
|
|
var target: Vector2 = surface.world.data.mountains[0].position
|
|
for mountain in surface.world.data.mountains:
|
|
if mountain.position.length_squared() < target.length_squared(): target = mountain.position
|
|
surface.lander.position = target+Vector2(70,50)
|
|
surface.lander.reset_physics_interpolation()
|
|
surface.camera.position_smoothing_enabled = false
|
|
surface.camera.position = target
|
|
surface.camera.force_update_scroll()
|
|
await settle()
|
|
# Freeze time and compare camera-space displacement: clouds must move faster.
|
|
atmosphere.set_process(false)
|
|
atmosphere._process(0)
|
|
var bank: Dictionary = atmosphere._banks[0]
|
|
var previous: Vector2 = bank.mist.position
|
|
var previous_center: Vector2 = surface.camera.get_screen_center_position()
|
|
surface.camera.position += Vector2(100,0)
|
|
surface.camera.force_update_scroll()
|
|
await settle()
|
|
atmosphere._process(0)
|
|
var center_delta: Vector2 = surface.camera.get_screen_center_position()-previous_center
|
|
assert(center_delta.length() > 50)
|
|
assert(bank.mist.position.is_equal_approx(previous+center_delta*(1.0-float(bank.parallax))))
|
|
previous = bank.mist.position
|
|
atmosphere._process(1.0)
|
|
assert(bank.mist.position.distance_to(previous) > 4)
|
|
surface.camera.position = target
|
|
surface.camera.force_update_scroll()
|
|
atmosphere._process(0)
|
|
var blend: Material = mountains.material
|
|
mountains.material = null
|
|
atmosphere.hide()
|
|
await capture("before")
|
|
mountains.material = blend
|
|
await capture("mountains")
|
|
atmosphere.show()
|
|
atmosphere.set_process(true)
|
|
await capture("clouds")
|
|
progress.finish_visit(GameState.captain,false)
|
|
surface.queue_free()
|
|
await get_tree().process_frame
|
|
print("SURFACE ATMOSPHERE PASS: close-only planet/freighter contact, shared service range, transparent clouds above ship, shadows below, two parallax speeds, wind, mipmaps, blended mountains")
|
|
get_tree().quit()
|