tests: assert players stay on the floor in the game-flow multiplayer test too
checkpoint / checkpoint (push) Successful in 1m33s
checkpoint / checkpoint (push) Successful in 1m33s
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015jtxAiu5dAW4WxCNdGkrkJ
This commit is contained in:
@@ -59,13 +59,19 @@ func _run() -> void:
|
||||
await process_frame
|
||||
quit(0); return
|
||||
|
||||
# role a: move and look for a remote node.
|
||||
# role a: hold still briefly (confirm we don't fall through the floor),
|
||||
# then move and look for a remote node.
|
||||
var player = game.get_node("Player")
|
||||
var min_y := 1000.0
|
||||
for i in 30:
|
||||
await process_frame
|
||||
min_y = minf(min_y, player.global_position.y)
|
||||
var on_floor: bool = min_y > -3.0
|
||||
|
||||
var start: Vector3 = player.global_position
|
||||
var max_remotes := 0
|
||||
for i in 120:
|
||||
# Drive the player forward by faking held input.
|
||||
player._input_direction = Vector2(0, 1)
|
||||
player._input_direction = Vector2(0, 1) # fake held forward
|
||||
await process_frame
|
||||
var n := 0
|
||||
for c in game.get_children():
|
||||
@@ -73,5 +79,5 @@ func _run() -> void:
|
||||
n += 1
|
||||
max_remotes = maxi(max_remotes, n)
|
||||
var moved: bool = player.global_position.distance_to(start) > 1.0
|
||||
print("RESULT a remotes=%d moved=%s" % [max_remotes, str(moved)])
|
||||
quit(0 if (moved and max_remotes >= 1) else 1)
|
||||
print("RESULT a remotes=%d moved=%s on_floor=%s" % [max_remotes, str(moved), str(on_floor)])
|
||||
quit(0 if (moved and max_remotes >= 1 and on_floor) else 1)
|
||||
|
||||
Reference in New Issue
Block a user