Files
tidewall/test/bots/test_scripted_player.gd
claudeandClaude Opus 5.5 aa797580a7 #72: The packet ship, the lifeline mortar and the gull-kite
Eric chose option B on #72. The drop is now the GDD's launch:

- A packet ship sails a seeded straight line past the island, offshore,
  as close in as it can while keeping 45 m of open water from any land
  (eight-way probes; up to 32 headings, then the four world sides).
- Jump fires the lifeline mortar along the look heading. How high the
  player aims sets the charge (-10 to 45 degrees: 16 to 110 m/s over
  the ground; every shot climbs at 75 m/s). The climb can't be steered
  and the kite can't open until the arc tops out. Riders still aboard at
  the end are fired towards the middle of the island.
- Drop.reach() mirrors the fall for both ways down (kite at the top, or
  a fall with the kite opening by itself); bots, the soak and autoplay
  clients and the tutorial pilot aim with Drop.aim_charge().
- Bots fire at their landing spot once abeam of it, when in easy reach
  at their own staggered moment, or just before the route ends, and open
  the kite early only when the spot is beyond the rest of a fall.
- Art: VesselModels.ship() (two-masted packet, tanned square sails, a
  salt-white boot-top, a bowsprit and the mortar on its bed, mirrored to
  face the island), the figure's gull-kite (figure.py), and a lifeline
  cord from the muzzle to each player still climbing.
- Renamed barge to ship and wing-sail to gull-kite throughout code,
  tests, captures, docs and the tutorial text. make match now defaults to
  seed 2, where the scripted player still harvests and builds.

Closes #72

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:49:21 -05:00

47 lines
2.0 KiB
GDScript

extends TestCase
## The scripted player from issue M8: a stand-in for a person, which also harvests and
## builds, things bots don't do yet.
func test_a_scripted_seat_sends_commands_like_anyone_else() -> void:
var loop: ServerLoop = ServerLoop.new(99, 1, 1)
loop.play_humans_by_script()
assert_eq(loop.scripted.size(), 1)
assert_eq(loop.scripted[0].player_id, 1)
assert_eq(loop.bots.size(), 1)
for _index: int in Tuning.TICK_RATE_HZ * 24:
loop.run_tick()
assert_ne(loop.sim.entities.find(1).drop_state, Drop.ABOARD, "the scripted player leapt from the ship")
func test_harvests_driftwood_and_builds_with_it() -> void:
# Seed 2 is the match `make match` plays: the player lands, finds a weapon, cuts
# driftwood and puts up a breakwater and a wall within a minute. (It was seed 29 from
# H3 until the packet ship (#72) changed where everyone lands; on 29 the scripted
# player now falls in a landing fight.)
var loop: ServerLoop = ServerLoop.new(2, 1, 23)
loop.play_humans_by_script()
var player: ScriptedPlayer = loop.scripted[0]
var placed: int = 0
var harvests: int = 0
while loop.ticks < 2400 and player.step != ScriptedPlayer.DONE:
loop.run_tick()
for event: Dictionary in loop.sim.events:
if event["type"] == "piece_placed" and event["player"] == player.player_id:
placed += 1
elif event["type"] == "harvest" and event["player"] == player.player_id:
harvests += 1
assert_eq(player.step, ScriptedPlayer.DONE)
assert_true(harvests >= 3, "swung at props %d times" % harvests)
assert_true(player.harvested >= ScriptedPlayer.WANTED_DRIFTWOOD, "harvested %d" % player.harvested)
assert_eq(player.built, 2)
assert_eq(placed, 2)
var kinds: Array[int] = []
for piece: StructureSet.Piece in loop.sim.structures.pieces.values():
if piece.owner == player.player_id:
kinds.append(piece.kind)
kinds.sort()
assert_eq(kinds, [StructureSet.WALL, StructureSet.BREAKWATER] as Array[int])
assert_false(loop.sim.entities.find(player.player_id).eliminated)