49 lines
2.0 KiB
GDScript
49 lines
2.0 KiB
GDScript
extends Node
|
|
|
|
func settle() -> void:
|
|
for frame in 12: await get_tree().process_frame
|
|
await RenderingServer.frame_post_draw
|
|
|
|
func check_rows(surface: Control) -> void:
|
|
var rows: Array[Node] = surface._choices.find_children("*","HBoxContainer",true,false)
|
|
assert(rows.size() == 3)
|
|
for row in rows:
|
|
var label: Label = row.get_node("LootModuleName")
|
|
assert(label.size.x > 200,"Name must fill the space beside its fixed-size icon")
|
|
assert(label.get_line_count() <= 3,"Module names must not wrap letter by letter")
|
|
assert(row.size.y < 90,"Each module must fit a compact row")
|
|
|
|
func _ready() -> void:
|
|
GameState.start_new_run()
|
|
if not InputMap.has_action("ship_mini_boost"): InputMap.add_action("ship_mini_boost")
|
|
var captain := GameState.captain
|
|
for gear in captain.gear_items: gear.level = 50
|
|
var profile := {"id":"ruins-layout","name":"Asteria","seed":8428159,"difficulty":0.4,"landing_damage":5,"oxygen":55,"temperature":55,"flora":10,"easy":false,"system_level":7}
|
|
assert(captain.expedition.begin_visit(profile))
|
|
var layer := CanvasLayer.new()
|
|
add_child(layer)
|
|
var surface := Control.new()
|
|
surface.set_script(preload("res://scripts/planets/surface_screen.gd"))
|
|
surface.captain = captain
|
|
surface.progress = captain.expedition
|
|
layer.add_child(surface)
|
|
surface.set_process(false)
|
|
surface.set_physics_process(false)
|
|
var poi: Dictionary = surface.world.data.pois[0]
|
|
poi.kind = "ruins"
|
|
var rng := RandomNumberGenerator.new()
|
|
rng.seed = 100
|
|
var result: Dictionary = captain.expedition.resolve_poi(captain,poi,rng)
|
|
assert(result.modules.size() == 3)
|
|
result.modules[0].definition = preload("res://resources/items/ship_computer.tres")
|
|
surface._poi = poi
|
|
surface._show_poi()
|
|
await settle()
|
|
check_rows(surface)
|
|
assert(get_viewport().get_texture().get_image().save_png("res://artifacts/ruins_loot_layout_fixed.png") == OK)
|
|
get_window().size = Vector2i(800,600)
|
|
await settle()
|
|
check_rows(surface)
|
|
print("RUINS LOOT LAYOUT PASS: 3 modules including computer, readable names and compact rows at 1280x720 and 800x600")
|
|
get_tree().quit()
|