From b5143ec906a8d6f139c571cc9a1e5cb958d72eba Mon Sep 17 00:00:00 2001 From: blinry Date: Wed, 18 Nov 2020 19:51:27 +0100 Subject: [PATCH] If there's no player in a level, add one --- scenes/file_browser.gd | 2 +- scenes/level.gd | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scenes/file_browser.gd b/scenes/file_browser.gd index e96a25e..ebaabaf 100644 --- a/scenes/file_browser.gd +++ b/scenes/file_browser.gd @@ -134,7 +134,7 @@ func update(): #item.position = Vector2(rand_range(0, world.rect_size.x), rand_range(0, world.rect_size.y)) #randomize() world.add_child(item) - if not player: + if file_path == "you": player = item FileBrowserMode.COMMIT: diff --git a/scenes/level.gd b/scenes/level.gd index 47fe442..2b96e33 100644 --- a/scenes/level.gd +++ b/scenes/level.gd @@ -101,6 +101,9 @@ func construct(): var repo = repos[r] game.global_shell.cd(repo.path) game.global_shell.run(repo.setup_commands) + # If there is no player, add one. + if game.global_shell.run("test -f you && echo yes || echo no") == "no\n": + game.global_shell.run("echo \"x = 200\ny = 200\" > you") func check_win(): var won = true