Everything lived in one flat directory, so a diff gave no clue what area it touched and finding the file you wanted meant knowing its exact name. Twelve folders now, grouped by what a thing IS rather than what type it is - a vessel's definition, its component scenes and its upgrade resources sit together, because that is the set you read when you change one of them. buildings core controllers enemies logistics planets resources shaders surface ui vessels vfx world 332 files moved and every res:// reference rewritten - 306 files touched, including the autoload and main-scene paths in project.godot. Nothing renamed: this is purely where files sit, so the diff is a pile of pure moves and no behaviour is buried in it. ui_theme.tres, icon.svg and web_shell.html stay at the root, where Godot and the export preset expect them. Verified three ways, because a suite alone would not have caught all of it: the full 117 pass, the web export builds clean, and the game renders. The export is why that matters. The FIRST export after the move failed with "Attempt to open script 'res://GameState.gd'" - the old path - while project.godot on disk plainly said res://core/GameState.gd. That is this project's documented Android FUSE mtime trap: Godot served a cached copy of a file whose content had changed. A `touch` fixed it. Nothing in the test suite would have found that, because the suite runs from a copy on a native filesystem - the one place the bug cannot happen. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
76 lines
2.6 KiB
GDScript
76 lines
2.6 KiB
GDScript
extends SceneTree
|
|
|
|
var state: Node
|
|
var scene: Node
|
|
var fleet: Node
|
|
var controller: Node
|
|
var planet: Node2D
|
|
var extractor_index: int = -1
|
|
var resource_type: String
|
|
var stage: int = 0
|
|
var elapsed: float = 0.0
|
|
|
|
|
|
func _initialize() -> void:
|
|
state = root.get_node("GameState")
|
|
state.extractors.clear()
|
|
state.transporters.clear()
|
|
state.fleet_cargo = 0
|
|
state.fleet_gas_cargo = 0
|
|
scene = load("res://world/Main.tscn").instantiate()
|
|
root.add_child(scene)
|
|
fleet = scene.get_node("Fleet")
|
|
controller = scene.get_node("BuildController")
|
|
|
|
|
|
func _process(delta: float) -> bool:
|
|
elapsed += delta
|
|
match stage:
|
|
0:
|
|
scene.get_node("AsteroidField").set_process(false)
|
|
scene.get_node("EnemySpawner").set_process(false)
|
|
for planets in scene.get_node("PlanetField").populated_chunks.values():
|
|
if not planets.is_empty() and is_instance_valid(planets[0]):
|
|
planet = planets[0]
|
|
break
|
|
if planet == null:
|
|
return _fail("no nearby generated planet available")
|
|
resource_type = planet.resource_type
|
|
state.add_extractor(planet.planet_name, planet.position, resource_type, planet.planet_id)
|
|
extractor_index = state.extractors.size() - 1
|
|
state.extractors[extractor_index].inventory.deposit(resource_type, 12)
|
|
for ship in fleet.ships:
|
|
ship.position = planet.position
|
|
fleet.move_to(planet.position)
|
|
elapsed = 0.0
|
|
stage = 1
|
|
return false
|
|
1:
|
|
if elapsed < 1.2:
|
|
return false
|
|
if controller.current_extractor_index != extractor_index or not controller.transfer_button.visible:
|
|
return _fail("extractor did not expose the transfer shortcut")
|
|
if not controller.action_button.visible \
|
|
or controller.action_button.icon != controller.landing_button.icon \
|
|
or controller.landing_button.visible:
|
|
return _fail("landing was not folded into the shared action control")
|
|
controller._on_transfer_pressed()
|
|
if not controller.transfer_menu.visible or controller.transfer_list.extractor_index != extractor_index:
|
|
return _fail("transfer panel did not bind to the extractor")
|
|
var before: int = state.fleet_resource(resource_type)
|
|
controller._on_resource_transfer(resource_type, false, 5)
|
|
if state.fleet_resource(resource_type) != before + 5:
|
|
return _fail("fleet did not fetch five resources from extractor")
|
|
if state.extractor_resource(extractor_index, resource_type) < 7:
|
|
return _fail("extractor transfer removed too much stock")
|
|
print("fleet fetched %s while landing remained the contextual action" % resource_type)
|
|
print("TEST_EXTRACTOR_TRANSFER: PASS")
|
|
quit(0)
|
|
return true
|
|
return false
|
|
|
|
|
|
func _fail(message: String) -> bool:
|
|
print("TEST_EXTRACTOR_TRANSFER: FAIL (%s)" % message)
|
|
quit(1)
|
|
return true
|