Complete lab, quest, garrison, and energy tickets

This commit is contained in:
Loïc Wisniewski 2026-09-03 00:12:08 +02:00
commit 0f7edff15a
20 changed files with 238 additions and 45 deletions

View file

@ -21,6 +21,8 @@ extends SceneTree
# E. it goes back to patrolling once the enemy is gone
# F. losing a garrison vessel frees the berth, so it gets crewed again
# G. enemies fight back - a garrison vessel is a target like any other
# H. #186 - with no hostile nearby, the same weapon-target contract lets a
# garrison shoot asteroids for ore
var game_state: Node
var main: Node
@ -30,6 +32,7 @@ var outpost_id: int = 0
var guard: Node2D
var component: Node
var enemy: Node2D
var asteroid: Node2D
var stage: int = 0
var elapsed: float = 0.0
var orbit_min: float = INF
@ -231,14 +234,40 @@ func _process(delta: float) -> bool:
return _fail("the garrison is still fighting an enemy that is gone")
print("stood down and went back to its patrol")
# --- H. asteroids are valid lower-priority targets -----------
asteroid = load("res://world/Asteroid.tscn").instantiate()
asteroid.position = Vector2(300.0, 0.0)
asteroid.velocity = Vector2.ZERO
main.add_child(asteroid)
asteroid.hp = 100000
dummy_hp_before = asteroid.hp
elapsed = 0.0
stage = 6
return false
6:
if elapsed < 2.5:
return false
if not component.is_engaging():
return _fail("an asteroid beside the outpost was not engaged")
if asteroid.hp >= dummy_hp_before:
return _fail("the garrison engaged an asteroid but never shot it")
print("garrison shot a nearby asteroid through the shared target contract")
asteroid.queue_free()
elapsed = 0.0
stage = 7
return false
7:
if elapsed < 0.5:
return false
# --- F. a lost vessel frees its berth ------------------------
if game_state.garrison_crew(outpost_id).size() != 1:
return _fail("the crew is not 1 before the kill")
guard.take_damage(1)
elapsed = 0.0
stage = 6
stage = 8
return false
6:
8:
if elapsed < 0.3:
return false
if not game_state.garrison_crew(outpost_id).is_empty():