Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
bleeptrack 2021-01-05 13:15:08 +01:00
commit aef7882dcb
17 changed files with 223 additions and 9 deletions

View file

@ -2,8 +2,8 @@ name: "Build"
on: on:
push: push:
branches: tags:
- main - '*'
env: env:
PROJECT_NAME: ${{ github.event.repository.name }} PROJECT_NAME: ${{ github.event.repository.name }}

21
levels/index/add Normal file
View file

@ -0,0 +1,21 @@
title = Updating files in the index
cards = add
[description]
So you start working, and make changes to your files! Git lets you choose which of these changes you want to put in the next commit. This is like updating the index version of that file to the new version.
The command for this is the same - `git add`!
[setup]
echo a > a
echo b > b
echo c > c
git add .
git commit -m "Initial commit"
[win]
# Make changes to all three files, and add all of them to the index.
test "$(git diff --cached --name-only | wc -l)" -eq 3

21
levels/index/checkout Normal file
View file

@ -0,0 +1,21 @@
title = Checking out files from the index
cards = add reset checkout
[description]
So you've made changes to your files, but you decide that you don't want to keep them! You can use `git checkout` for that!
[setup]
echo a > a
echo b > b
echo c > c
git add .
git commit -m "Initial commit"
echo x > a
echo x > b
[win]
# Remove all changes in your local files!
test "$(git diff --name-only | wc -l)" -eq 0

27
levels/index/commit Normal file
View file

@ -0,0 +1,27 @@
title = Make a commit \o/
cards = add reset checkout commit
[description]
With that, we're ready to make our first commit! It will contain the version of the files which are currently in the index.
[setup]
echo a > a
echo x > b
echo x > c
git add .
git commit -m "Initial commit"
echo x > a
echo b > b
git add b
echo c > c
[win]
# File a contains "x" in the last main commit.
test "$(git show main:a)" = x
# File b contains "x" in the last main commit.
test "$(git show main:b)" = x
# File c contains "x" in the last main commit.
test "$(git show main:c)" = x

26
levels/index/commit-a Normal file
View file

@ -0,0 +1,26 @@
title = Make a commit, but faster!
cards = add reset checkout commit commit-a
[description]
There is a time-saving trick, where instead of a plain `git commit`, you can use
git commit -a
This will automatically add all changes you made to local files! Very convenient.
[setup]
echo a > a
echo b > b
echo c > c
git add .
git commit -m "Initial commit"
echo x > a
echo x > b
echo x > c
[win]
# Make a commit where all files contain "x".
test "$(git show main:a)" = x && test "$(git show main:b)" = x && test "$(git show main:c)" = x

26
levels/index/mv Normal file
View file

@ -0,0 +1,26 @@
title = Rename a file in the next commit
cards = add reset checkout mv commit
[description]
Other times, you might want to rename a file in the next commit. Use
git mv [file] [new name]
for that. The effect is very similar as if you had created a copy with a new name, and removed the old version.
[setup]
echo a > a
echo SPECIAL > b
echo x > c
git add .
git commit -m "Initial commit"
echo x > a
echo b >> b
git add b
[win]
# Make a commit where you rename the file b to "x".
test "$(git ls-tree --name-only main)" = "$(echo -e "a\nc\nx")"

19
levels/index/new Normal file
View file

@ -0,0 +1,19 @@
title = Add new files to the index
cards = add
[description]
In the index, we can prepare what will be in the next commit.
Initially, the index will be empty, and all files are untracked. If you have a file, and you want to have it in the next commit, use `git add`!
[setup]
echo a > a
echo b > b
echo c > c
[win]
# Add all three files to the index.
test "$(git diff --cached --name-only | wc -l)" -eq 3

22
levels/index/reset Normal file
View file

@ -0,0 +1,22 @@
title = Resetting files in the index
cards = add reset
[description]
If you already have changes in the index, but want to reset them, you can use `git reset`!
[setup]
echo a > a
echo b > b
echo c > c
git add .
git commit -m "Initial commit"
echo x > a
echo x > b
git add .
[win]
# Reset all changes in files in the index!
test "$(git diff --cached --name-only | wc -l)" -eq 0

24
levels/index/rm Normal file
View file

@ -0,0 +1,24 @@
title = Delete a file in the next commit
cards = add reset checkout rm commit
[description]
If you want to remove a file in the next commit, you can use `git rm`! This will both delete the file locally, and in the index.
If a file is modified, you'll need to reset these changes first/reset the files.
[setup]
echo a > a
echo x > b
echo x > c
git add .
git commit -m "Initial commit"
echo x > a
echo b > b
git add b
[win]
# Make a commit where all files are deleted ¯\_(^_^)_/¯
test "$(git ls-tree main | wc -l)" -eq 0

8
levels/index/sequence Normal file
View file

@ -0,0 +1,8 @@
new
add
reset
checkout
commit
commit-a
rm
mv

View file

@ -1,2 +1,3 @@
index
time-machine time-machine
low-level low-level

View file

@ -6,8 +6,13 @@
}, },
{ {
"id": "checkout", "id": "checkout",
"command": "git checkout [commit, ref]", "command": "git checkout [commit, ref, file]",
"description": "Drag this card to a commit or to a branch to travel to it!" "description": "Drag this card to a commit or to a branch to travel to it!\n\nAlternatively, reset changes in a local file."
},
{
"id": "commit-a",
"command": "git commit -a",
"description": "Make a new commit, after automatically adding all changes to the index.\nYou'll be asked to enter a short description of what you changed."
}, },
{ {
"id": "commit-auto", "id": "commit-auto",
@ -51,8 +56,8 @@
}, },
{ {
"id": "reset", "id": "reset",
"command": "git reset [commit]", "command": "git reset [commit, file]",
"description": "Jump to the commit, and update the index. Keep the current environment." "description": "Jump to the commit, and update the index. Keep the current environment.\n\nAlternatively, reset changes in a file in the index."
}, },
{ {
"id": "cherry-pick", "id": "cherry-pick",
@ -79,6 +84,16 @@
"command": "git add [file]", "command": "git add [file]",
"description": "Put the current status of the file into the plan." "description": "Put the current status of the file into the plan."
}, },
{
"id": "rm",
"command": "git rm [file]",
"description": "Delete a file both in the working directory, as well as the index."
},
{
"id": "mv",
"command": "git mv [file] [string]",
"description": "DOESN'T WORK YET\n\nRename a file both in the working directory, as well as the index."
},
{ {
"id": "commit", "id": "commit",
"command": "git commit", "command": "git commit",

View file

@ -15,6 +15,7 @@ func _process(_delta):
$Energy.text = str(game.energy) $Energy.text = str(game.energy)
func load_card_store(): func load_card_store():
card_store = {}
var cards_json = JSON.parse(helpers.read_file("res://resources/cards.json")).result var cards_json = JSON.parse(helpers.read_file("res://resources/cards.json")).result
for card in cards_json: for card in cards_json:
card_store[card["id"]] = card card_store[card["id"]] = card

View file

@ -5,6 +5,8 @@ onready var level_list = $ScrollContainer/MarginContainer/Levels
func _ready(): func _ready():
var chapter_id = 0 var chapter_id = 0
levels.reload()
for chapter in levels.chapters: for chapter in levels.chapters:
var level_id = 0 var level_id = 0

View file

@ -121,6 +121,7 @@ func load_level(level_id):
func reload_level(): func reload_level():
cards.load_card_store()
levels.reload() levels.reload()
load_level(game.current_level) load_level(game.current_level)

View file

@ -175,7 +175,6 @@ margin_bottom = 383.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="LevelName" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"] [node name="LevelName" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
visible = false
margin_right = 633.0 margin_right = 633.0
margin_bottom = 60.0 margin_bottom = 60.0
rect_min_size = Vector2( 0, 60 ) rect_min_size = Vector2( 0, 60 )
@ -186,6 +185,7 @@ __meta__ = {
} }
[node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"] [node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
margin_top = 65.0
margin_right = 633.0 margin_right = 633.0
margin_bottom = 336.0 margin_bottom = 336.0
size_flags_vertical = 3 size_flags_vertical = 3

View file

@ -61,13 +61,13 @@ __meta__ = {
} }
[node name="Button" type="Button" parent="VBoxContainer"] [node name="Button" type="Button" parent="VBoxContainer"]
margin_right = 352.0 margin_right = 351.0
margin_bottom = 39.0 margin_bottom = 39.0
text = "Levels" text = "Levels"
[node name="Button2" type="Button" parent="VBoxContainer"] [node name="Button2" type="Button" parent="VBoxContainer"]
margin_top = 44.0 margin_top = 44.0
margin_right = 352.0 margin_right = 351.0
margin_bottom = 83.0 margin_bottom = 83.0
text = "Quit" text = "Quit"
[connection signal="pressed" from="VBoxContainer/Button" to="." method="levels"] [connection signal="pressed" from="VBoxContainer/Button" to="." method="levels"]