2026-08-15 04:45:15 +02:00
|
|
|
extends SceneTree
|
|
|
|
|
|
|
|
|
|
var game_state: Node
|
|
|
|
|
var main: Node
|
|
|
|
|
var fleet: Node
|
2026-08-16 18:54:44 +02:00
|
|
|
var skill: Node
|
|
|
|
|
# Mirrors GasBombController.AOE_RADIUS's value rather than referencing the
|
|
|
|
|
# class constant directly - see test_gas_bomber_cooldowns.gd's identical fix.
|
|
|
|
|
const AOE_RADIUS_FOR_TEST: float = 180.0
|
2026-08-15 04:45:15 +02:00
|
|
|
var inside_enemies: Array = []
|
|
|
|
|
var outside_enemy: Node
|
|
|
|
|
var stage := 0
|
|
|
|
|
var elapsed := 0.0
|
|
|
|
|
var original_zoom := 2.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _initialize() -> void:
|
|
|
|
|
game_state = root.get_node("GameState")
|
|
|
|
|
game_state.buildings.clear()
|
|
|
|
|
game_state.extractors.clear()
|
|
|
|
|
game_state.transporters.clear()
|
|
|
|
|
game_state.stored_vessels.clear()
|
|
|
|
|
game_state.vessel_deliveries.clear()
|
|
|
|
|
game_state.reset_progression()
|
|
|
|
|
game_state.rocks = 0
|
|
|
|
|
game_state.gas = 0
|
|
|
|
|
game_state.fleet_cargo = 0
|
|
|
|
|
game_state.fleet_gas_cargo = 0
|
|
|
|
|
game_state.build_time_scale = 0.01
|
2026-08-16 20:14:29 +02:00
|
|
|
game_state.research_points = 1
|
2026-08-16 18:54:44 +02:00
|
|
|
# #60: after research/crafting resets the fleet hold below, top it up
|
|
|
|
|
# with fleet-carried gas for the shot itself (ammunition, not the ore/gas
|
|
|
|
|
# spent researching or crafting the bomber).
|
2026-08-15 04:45:15 +02:00
|
|
|
|
|
|
|
|
# Research is gas-only: any amount of ore and 29 gas must still leave it
|
|
|
|
|
# waiting, then the thirtieth unit starts and completes the unlock.
|
|
|
|
|
var lab_id: int = game_state.add_building(GameState.BUILDING_SHIP_LAB, Vector2.ZERO)
|
|
|
|
|
if not game_state.queue_lab_research(lab_id, "unlock_gas_bomber"):
|
|
|
|
|
_fail_now("could not queue Gas Bomber research")
|
|
|
|
|
return
|
|
|
|
|
game_state.deposit_resource_to_building(lab_id, GameState.RESOURCE_ORE, 200)
|
|
|
|
|
game_state.deposit_resource_to_building(lab_id, GameState.RESOURCE_GAS, 29)
|
|
|
|
|
game_state._advance_lab_research(10.0)
|
|
|
|
|
if game_state.outstanding_resource_cost(lab_id, GameState.RESOURCE_GAS) != 1 \
|
|
|
|
|
or game_state.outstanding_resource_cost(lab_id, GameState.RESOURCE_ORE) != 0:
|
|
|
|
|
_fail_now("research shortfall was not tracked as gas")
|
|
|
|
|
return
|
|
|
|
|
if game_state.vessel_is_unlocked(GameState.VESSEL_GAS_BOMBER):
|
|
|
|
|
_fail_now("Gas Bomber unlocked without its full gas cost")
|
|
|
|
|
return
|
|
|
|
|
game_state.deposit_resource_to_building(lab_id, GameState.RESOURCE_GAS, 1)
|
|
|
|
|
game_state._advance_lab_research(10.0)
|
|
|
|
|
if not game_state.vessel_is_unlocked(GameState.VESSEL_GAS_BOMBER):
|
|
|
|
|
_fail_now("30 gas did not unlock the Gas Bomber")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
# Crafting requires both resources and preserves the vessel type.
|
|
|
|
|
var crafter_id: int = game_state.add_building(GameState.BUILDING_SHIP_CRAFTER, Vector2.ZERO)
|
|
|
|
|
if not game_state.queue_order(crafter_id, GameState.VESSEL_GAS_BOMBER):
|
|
|
|
|
_fail_now("unlocked Gas Bomber could not be queued")
|
|
|
|
|
return
|
|
|
|
|
game_state.deposit_resource_to_building(crafter_id, GameState.RESOURCE_ORE, 10)
|
|
|
|
|
game_state.deposit_resource_to_building(crafter_id, GameState.RESOURCE_GAS, 7)
|
|
|
|
|
game_state._advance_production(10.0)
|
|
|
|
|
if game_state.outstanding_resource_cost(crafter_id, GameState.RESOURCE_GAS) != 1 \
|
|
|
|
|
or game_state.outstanding_resource_cost(crafter_id, GameState.RESOURCE_ORE) != 0:
|
|
|
|
|
_fail_now("crafting shortfall was not tracked as gas")
|
|
|
|
|
return
|
|
|
|
|
if not game_state.order_list(crafter_id).is_empty() \
|
|
|
|
|
and bool(game_state.order_list(crafter_id)[0].started):
|
|
|
|
|
_fail_now("Gas Bomber started with insufficient gas")
|
|
|
|
|
return
|
|
|
|
|
game_state.deposit_resource_to_building(crafter_id, GameState.RESOURCE_GAS, 1)
|
|
|
|
|
game_state._advance_production(10.0)
|
|
|
|
|
if game_state.stored_vessels != [GameState.VESSEL_GAS_BOMBER]:
|
|
|
|
|
_fail_now("crafting did not produce a typed Gas Bomber")
|
|
|
|
|
return
|
|
|
|
|
|
2026-08-16 18:54:44 +02:00
|
|
|
game_state.fleet_gas_cargo = 20
|
#84: move 215 root files into a folder hierarchy
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>
2026-08-21 19:44:14 +02:00
|
|
|
main = load("res://world/Main.tscn").instantiate()
|
2026-08-15 04:45:15 +02:00
|
|
|
root.add_child(main)
|
|
|
|
|
fleet = main.get_node("Fleet")
|
|
|
|
|
skill = main.get_node("GasBombController")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> bool:
|
|
|
|
|
elapsed += delta
|
|
|
|
|
match stage:
|
|
|
|
|
0:
|
|
|
|
|
if elapsed < 0.2:
|
|
|
|
|
return false
|
|
|
|
|
main.get_node("EnemySpawner").set_process(false)
|
|
|
|
|
main.get_node("AsteroidField").set_process(false)
|
Asteroids can be shot apart for the ore inside them
Asteroids were pure hazard: the only thing one could ever do was cost you a
ship. They now take damage like anything else and break open, dropping ore the
fleet can fly over and collect - the one resource reachable in open space
without conquering anything, and something for the new fire stick to do out
there.
Two ways to destroy one, deliberately not equivalent. Shot apart yields the
ore; flown into does not - the rock shatters against a hull rather than being
mined, and a ship or a shield charge has just been spent on it. Without that
split a shield vessel could farm asteroids by ramming them.
Asteroid.take_damage() matches Enemy's contract exactly, so every weapon that
already knew how to hurt an enemy hurts an asteroid through the same branch
rather than a second special case: bolts, the laser sweep, and the gas bomb's
blast all pick both groups up together.
Dropped ore carries the asteroid's own drift, so it reads as debris rather
than as a spawned pickup, and it expires after a minute. Rock grew an optional
lifetime for that, defaulting to 0 (never) so hand-placed surface rocks are
unchanged - a planet surface is bounded and authored, open space is not, and a
field shot up and abandoned would otherwise leak nodes for the session. Rock's
header note that asteroids and rocks are never on screen together is no longer
true and now says so; the hexagon-versus-lump shape language matters more now
that they sit side by side, not less.
Five weapon tests silenced the asteroid field but never cleared what it had
already placed. That was harmless while asteroids were untouchable and is not
any more - two of them assert exact hit counts, and a drifting rock in the
beam would have made those fail intermittently.
Suite 111/111.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 10:27:40 +02:00
|
|
|
# Asteroids are shootable now, and the laser and the bomb both
|
|
|
|
|
# sweep them alongside enemies - so whatever the field already
|
|
|
|
|
# spawned would be counted as a hit. Silencing the spawner is not
|
|
|
|
|
# enough; what it placed before that has to go too. Same
|
|
|
|
|
# clean-slate idiom as test_ship_lab.gd.
|
|
|
|
|
for hazard in get_nodes_in_group("asteroids"):
|
|
|
|
|
if is_instance_valid(hazard):
|
|
|
|
|
hazard.free()
|
2026-08-15 04:45:15 +02:00
|
|
|
if main.get_node("UI/GasBombButton").visible:
|
|
|
|
|
return _fail_now("bomb control appeared without a Gas Bomber")
|
|
|
|
|
fleet.spawn_ships(2, Vector2.ZERO, PackedStringArray([
|
|
|
|
|
GameState.VESSEL_INTERCEPTOR, GameState.VESSEL_GAS_BOMBER]))
|
|
|
|
|
main.get_node("Camera2D").zoom = Vector2(original_zoom, original_zoom)
|
|
|
|
|
skill._process(0.0)
|
|
|
|
|
if not main.get_node("UI/GasBombButton").visible:
|
|
|
|
|
return _fail_now("fleet Gas Bomber did not reveal the bomb control")
|
|
|
|
|
|
|
|
|
|
var press := InputEventScreenTouch.new()
|
|
|
|
|
press.index = 7
|
|
|
|
|
var bomb_button: Control = main.get_node("UI/GasBombButton")
|
|
|
|
|
press.position = bomb_button.global_position + bomb_button.size * 0.5
|
|
|
|
|
press.pressed = true
|
|
|
|
|
main._handle_touch(press)
|
|
|
|
|
if not skill.aiming:
|
|
|
|
|
return _fail_now("bomb control did not begin aiming")
|
|
|
|
|
var drag := InputEventScreenDrag.new()
|
|
|
|
|
drag.index = 7
|
|
|
|
|
drag.position = Vector2(350, 700)
|
|
|
|
|
main._handle_drag(drag)
|
|
|
|
|
if main.get_node("Camera2D").zoom.x >= original_zoom:
|
|
|
|
|
return _fail_now("long aim did not zoom out")
|
|
|
|
|
|
2026-08-15 14:43:29 +02:00
|
|
|
# speed is set AFTER add_child(): _ready() copies it from the
|
|
|
|
|
# enemy's definition, which would otherwise clobber a
|
|
|
|
|
# pre-add_child override the instant the enemy entered the tree.
|
2026-08-15 04:45:15 +02:00
|
|
|
for offset in [Vector2(-60, 0), Vector2(70, 35)]:
|
#84: move 215 root files into a folder hierarchy
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>
2026-08-21 19:44:14 +02:00
|
|
|
var enemy: Node = load("res://enemies/Enemy.tscn").instantiate()
|
2026-08-15 04:45:15 +02:00
|
|
|
enemy.position = skill.aim_target + offset
|
|
|
|
|
main.add_child(enemy)
|
2026-08-15 14:43:29 +02:00
|
|
|
enemy.speed = 0.0
|
2026-08-15 04:45:15 +02:00
|
|
|
inside_enemies.append(enemy)
|
#84: move 215 root files into a folder hierarchy
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>
2026-08-21 19:44:14 +02:00
|
|
|
outside_enemy = load("res://enemies/Enemy.tscn").instantiate()
|
2026-08-16 18:54:44 +02:00
|
|
|
outside_enemy.position = skill.aim_target + Vector2(AOE_RADIUS_FOR_TEST + 80.0, 0)
|
2026-08-15 04:45:15 +02:00
|
|
|
main.add_child(outside_enemy)
|
2026-08-15 14:43:29 +02:00
|
|
|
outside_enemy.speed = 0.0
|
2026-08-15 04:45:15 +02:00
|
|
|
|
|
|
|
|
var release := InputEventScreenTouch.new()
|
|
|
|
|
release.index = 7
|
|
|
|
|
release.position = drag.position
|
|
|
|
|
release.pressed = false
|
|
|
|
|
main._handle_touch(release)
|
|
|
|
|
if not skill.projectile_active:
|
|
|
|
|
return _fail_now("release did not throw a gas bomb")
|
2026-09-04 22:34:29 +02:00
|
|
|
# #201 doubled the blast. Read off the bomb actually in flight, so
|
|
|
|
|
# a constant that stops reaching the effect fails here rather than
|
|
|
|
|
# passing on the strength of its own declaration.
|
|
|
|
|
if int(skill.projectiles[0].damage) != 6:
|
|
|
|
|
return _fail_now("gas bomb carries %d damage, expected the doubled 6" \
|
|
|
|
|
% int(skill.projectiles[0].damage))
|
2026-08-15 04:45:15 +02:00
|
|
|
elapsed = 0.0
|
|
|
|
|
stage = 1
|
|
|
|
|
1:
|
|
|
|
|
if elapsed < 2.5:
|
|
|
|
|
return false
|
|
|
|
|
if skill.last_hit_count != 2:
|
|
|
|
|
return _fail_now("AOE hit %d enemies instead of 2" % skill.last_hit_count)
|
|
|
|
|
for enemy in inside_enemies:
|
|
|
|
|
if is_instance_valid(enemy):
|
|
|
|
|
return _fail_now("an enemy inside the AOE survived")
|
|
|
|
|
if not is_instance_valid(outside_enemy) or outside_enemy.hp != outside_enemy.max_hp:
|
|
|
|
|
return _fail_now("the AOE damaged an enemy outside its radius")
|
|
|
|
|
if absf(main.get_node("Camera2D").zoom.x - original_zoom) > 0.03:
|
|
|
|
|
return _fail_now("camera did not restore its pre-aim zoom")
|
|
|
|
|
print("TEST_GAS_BOMBER: PASS")
|
|
|
|
|
quit(0)
|
|
|
|
|
return true
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _fail_now(message: String) -> bool:
|
|
|
|
|
print("TEST_GAS_BOMBER: FAIL (%s)" % message)
|
|
|
|
|
quit(1)
|
|
|
|
|
return true
|