102 lines
4.1 KiB
GDScript
102 lines
4.1 KiB
GDScript
extends Node
|
|
const NETWORK := preload("res://scripts/planets/mining_network.gd")
|
|
const PROFILES := preload("res://scripts/planets/planet_profiles.gd")
|
|
|
|
func settle() -> void:
|
|
for frame in 12: await get_tree().process_frame
|
|
|
|
func shot(file: String) -> void:
|
|
await settle()
|
|
await RenderingServer.frame_post_draw
|
|
get_viewport().get_texture().get_image().save_png("res://artifacts/mining_%s.png" % file)
|
|
|
|
func _ready() -> void:
|
|
GameState.start_new_run()
|
|
GameState.set_process(false)
|
|
var captain: Resource = GameState.captain
|
|
var progress: Resource = captain.expedition
|
|
var profile: Dictionary
|
|
for index in 100:
|
|
var p := PROFILES.generate(654321, index, "Asterion")
|
|
if NETWORK.has_recruit(p) and NETWORK.has_deep_deposit(p):
|
|
profile = p
|
|
break
|
|
var game := preload("res://scenes/game/game.tscn").instantiate()
|
|
add_child(game)
|
|
game.set_physics_process(false)
|
|
game.player.set_physics_process(false)
|
|
game.player.get_node("WeaponController").set_physics_process(false)
|
|
for enemy in get_tree().get_nodes_in_group("enemies"): enemy.set_physics_process(false)
|
|
var controller := game.get_node("PlanetExpeditions")
|
|
assert(progress.begin_visit(profile))
|
|
controller._enter()
|
|
var surface := Control.new()
|
|
surface.set_script(preload("res://scripts/planets/surface_screen.gd"))
|
|
surface.captain = captain
|
|
surface.progress = progress
|
|
surface.flight_ship = game.player
|
|
surface.finished.connect(controller.finish_surface)
|
|
controller.screen = surface
|
|
controller._layer.add_child(surface)
|
|
await settle()
|
|
surface.weather.set_condition("clear", true)
|
|
var deposit: Dictionary = surface.world.data.pois.filter(func(p): return p.kind == "deep_deposit")[0]
|
|
var camp: Dictionary = surface.world.data.pois.filter(func(p): return p.kind == "crew")[0]
|
|
surface._poi = deposit
|
|
surface.lander.position = deposit.position
|
|
surface._previous_position = deposit.position
|
|
surface.camera.position = deposit.position
|
|
surface.camera.reset_smoothing()
|
|
captain.parts = 199
|
|
surface._show_poi()
|
|
assert(surface._choices.find_child("BuildMiningOutpost", true, false).disabled)
|
|
captain.parts = 200
|
|
surface._show_poi()
|
|
await shot("construction")
|
|
surface._choices.find_child("BuildMiningOutpost", true, false).pressed.emit()
|
|
assert(progress.mining_stations.size() == 1 and captain.parts == 0)
|
|
assert(surface.world._poi_sprites[deposit.id].get_meta("outpost", false))
|
|
await shot("built_outpost")
|
|
surface._poi = camp
|
|
surface._show_poi()
|
|
assert(surface._choices.find_child("HireCrew", true, false).disabled)
|
|
progress.freighter_rooms.cabin_1 = "crew_cabin"
|
|
surface._show_poi()
|
|
await shot("recruitment")
|
|
surface._choices.find_child("HireCrew", true, false).pressed.emit()
|
|
assert(progress.crew.size() == 1 and NETWORK.free_cabin(progress).is_empty())
|
|
surface._return(true)
|
|
await settle()
|
|
controller.open_freighter()
|
|
var screen: Control = controller.screen
|
|
screen._select_section("command")
|
|
await settle()
|
|
var member: Dictionary = NETWORK.cabin_crew(progress, "cabin_1")
|
|
var option: OptionButton = screen._content.find_child("StationCrew_"+str(profile.id).md5_text().substr(0, 8), true, false)
|
|
assert(option.item_count == 2)
|
|
option.select(1)
|
|
screen._assign_station(profile.id, option)
|
|
NETWORK.advance(progress, 60)
|
|
progress.emit_changed()
|
|
assert(progress.deuter == 1 + member.management)
|
|
await shot("command")
|
|
assert(screen._drawer.size.x <= 490 and screen._drawer.get_global_rect().end.y <= 721)
|
|
screen._select_section("storage")
|
|
await settle()
|
|
assert(screen._economy_labels.has("stock_header"))
|
|
var before: String = screen._economy_labels.stock_header.text
|
|
NETWORK.advance(progress, 60)
|
|
progress.emit_changed()
|
|
assert(screen._economy_labels.stock_header.text != before)
|
|
await shot("storage")
|
|
screen._select_section("cabin_1")
|
|
await shot("cabin")
|
|
assert(screen._content.find_children("*", "Button", true, false).size() == 1)
|
|
screen._dismiss_crew(member.id)
|
|
assert(progress.crew.is_empty() and NETWORK.total_rate(progress) == 0)
|
|
controller._leave()
|
|
game.free()
|
|
get_tree().paused = false
|
|
print("MINING_COLONY_REVIEW_OK: surface construction gate and sprite, hiring gate and cabin, station assignment, live storage, cabin dismissal and compact layout")
|
|
get_tree().quit()
|