diff --git a/levels/01-blob/win b/levels/01-blob/win new file mode 100644 index 0000000..0815775 --- /dev/null +++ b/levels/01-blob/win @@ -0,0 +1,7 @@ +BLOB_COUNT=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep blob | wc -l) + +if [ "$BLOB_COUNT" -gt 2 ]; then + echo yes +else + echo no +fi diff --git a/main.gd b/main.gd index 2a27e46..679395c 100644 --- a/main.gd +++ b/main.gd @@ -76,6 +76,11 @@ func load_level(id): goal_repository.path = goal_repository_path active_repository.path = active_repository_path + var win_script = level_prefix+level+"/win" + var win_script_target = game.tmp_prefix+"/win" + var dir = Directory.new() + dir.copy(win_script, win_script_target) + func construct_repo(script, path): # Becase in an exported game, all assets are in a .pck file, we need to put # the script somewhere in the filesystem. @@ -87,7 +92,7 @@ func construct_repo(script, path): game.global_shell.run("mkdir " + path) game.global_shell.cd(path) game.global_shell.run("git init") - var o = game.global_shell.run("source "+script_path) + var o = game.global_shell.run("sh "+script_path) if game.debug: print(o) diff --git a/terminal.gd b/terminal.gd index eb4d088..55d3dc9 100644 --- a/terminal.gd +++ b/terminal.gd @@ -41,10 +41,14 @@ func send_command_async(command): func run_command_in_a_thread(command): var o = repo.shell.run(command) + check_win_condition() input.text = "" output.text = output.text + "$ " + command + "\n" + o - repo.update_everything() # FIXME + repo.update_everything() func receive_output(text): output.text += text + +func check_win_condition(): + print( repo.shell.run("bash /tmp/win") )