From 497c8a81ea17cd35353173ba4206e764b3635d69 Mon Sep 17 00:00:00 2001 From: blinry Date: Tue, 22 Dec 2020 17:52:15 +0100 Subject: [PATCH] Friend level with some interactivity --- levels/time-machine/friend | 47 ++++++++++++++++++++++++++++++++++++++ scenes/main.gd | 10 +++----- 2 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 levels/time-machine/friend diff --git a/levels/time-machine/friend b/levels/time-machine/friend new file mode 100644 index 0000000..1b70f33 --- /dev/null +++ b/levels/time-machine/friend @@ -0,0 +1,47 @@ +title = Friend +cards = pull push commit-auto checkout + +[description] + +Your friend added another line to your essay! Get it, add a third one and send it to them! + +Take turns until you have five lines! + +[setup yours] + +echo "Line 1" > essay +git add . +git commit -m "One line" + +git push -u friend main + +[setup friend] + +git checkout main +echo "Line 2, gnihihi" >> essay +git commit -am "Another line" + +[actions friend] + +if test "$(git log --oneline | wc -l)" -eq 3; then + git reset --hard main # Necessary because the working directory isn't updated when we push to the friend. + echo "Line 4, blurbblubb" >> essay + git commit -am "Final line" + hint "Oh nice, I added a fourth line!" +fi + +[win] + +# Got the second line from your friend +git show HEAD:essay | grep gnihihi + +# Got the fourth line from your friend. +git show HEAD:essay | grep blurbblubb + +[win friend] + +# The friend got a third line from you +test "$(git show HEAD:essay | wc -l)" -ge 3 + +# The friend got a fifth line from you +test "$(git show HEAD:essay | wc -l)" -ge 5 diff --git a/scenes/main.gd b/scenes/main.gd index 9bbc6e1..deae58e 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -164,18 +164,14 @@ func repopulate_chapters(): chapter_select.select(current_chapter) func update_repos(): + var win_states = levels.chapters[current_chapter].levels[current_level].check_win() + show_win_status(win_states) + for r in repositories: var repo = repositories[r] repo.update_everything() file_browser.update() index.update() - - #if levels.chapters[current_chapter].levels[current_level].check_win(): - # show_win_status() - - var win_states = levels.chapters[current_chapter].levels[current_level].check_win() - show_win_status(win_states) - func toggle_cards(): cards.visible = not cards.visible