mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-13 19:04:54 +01:00
Friend level with some interactivity
This commit is contained in:
parent
275ffc5ec4
commit
497c8a81ea
2 changed files with 50 additions and 7 deletions
47
levels/time-machine/friend
Normal file
47
levels/time-machine/friend
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue