From 13dc516edf77132e3ab08bb0fa1fe9000cfd5f69 Mon Sep 17 00:00:00 2001 From: blinry Date: Thu, 4 Feb 2021 15:19:54 +0100 Subject: [PATCH] Add sandbox button to the title, and add CLI badge explainer --- levels/sandbox/empty | 4 ++++ levels/sandbox/sequence | 2 ++ levels/sandbox/three-commits | 7 ++++--- levels/sequence | 1 + scenes/level_select.gd | 3 +++ scenes/sandbox.gd | 2 +- scenes/sandbox.tscn | 4 +--- scenes/title.gd | 6 ++++++ scenes/title.tscn | 9 ++++++++- 9 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 levels/sandbox/sequence diff --git a/levels/sandbox/empty b/levels/sandbox/empty index ab578f3..1f954a5 100644 --- a/levels/sandbox/empty +++ b/levels/sandbox/empty @@ -1,3 +1,7 @@ title = Empty sandbox +[description] + +This is an empty sandbox you can play around in. + [setup] diff --git a/levels/sandbox/sequence b/levels/sandbox/sequence new file mode 100644 index 0000000..0573100 --- /dev/null +++ b/levels/sandbox/sequence @@ -0,0 +1,2 @@ +empty +three-commits diff --git a/levels/sandbox/three-commits b/levels/sandbox/three-commits index 7d8d22a..d327b29 100644 --- a/levels/sandbox/three-commits +++ b/levels/sandbox/three-commits @@ -1,4 +1,5 @@ -title = Three commits +title = Sandbox +cards = checkout add reset-file checkout-file commit merge rebase [setup] @@ -16,9 +17,9 @@ git branch not_main [description] -That's all for now! Here's a sandbox you can play around in. +Here's a sandbox you can play around in. -Did you see the black terminal at the very bottom? All cards you play translate into actual commands, and there'a a real Git repo behind this! Fun things to try: +You can use both the playing cards, as well as the terminal. Fun things to try: - Make a commit that merges three timelines together at once! - Create some tags! diff --git a/levels/sequence b/levels/sequence index 1d334c1..ef70220 100644 --- a/levels/sequence +++ b/levels/sequence @@ -3,3 +3,4 @@ files branches merge index +sandbox diff --git a/scenes/level_select.gd b/scenes/level_select.gd index 598236b..1dfcf39 100644 --- a/scenes/level_select.gd +++ b/scenes/level_select.gd @@ -54,6 +54,9 @@ func reload(): badge.sparkling = false level_list.add_child(hb) + + if badge.active: + game.notify("You get a golden badge for each level you solve without using the playing cards! Can you solve them all using the command line?", badge, "cli-badge") level_id += 1 chapter_id += 1 diff --git a/scenes/sandbox.gd b/scenes/sandbox.gd index a2f98b6..ea57d5e 100644 --- a/scenes/sandbox.gd +++ b/scenes/sandbox.gd @@ -18,7 +18,7 @@ func _ready(): path = game.tmp_prefix+"/repos/sandbox/" helpers.careful_delete(path) - game.global_shell.run("mkdir " + path) + game.global_shell.run("mkdir '%s'" % path) game.global_shell.cd(path) game.global_shell.run("git init") game.global_shell.run("git symbolic-ref HEAD refs/heads/main") diff --git a/scenes/sandbox.tscn b/scenes/sandbox.tscn index 719d96c..ee28577 100644 --- a/scenes/sandbox.tscn +++ b/scenes/sandbox.tscn @@ -3,8 +3,7 @@ [ext_resource path="res://scenes/terminal.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/repository.tscn" type="PackedScene" id=2] [ext_resource path="res://styles/theme.tres" type="Theme" id=3] -[ext_resource path="res://sandbox.gd" type="Script" id=4] - +[ext_resource path="res://scenes/sandbox.gd" type="Script" id=4] [node name="Sandbox" type="Control"] anchor_right = 1.0 @@ -41,7 +40,6 @@ anchor_bottom = 0.0 margin_right = 949.0 margin_bottom = 1070.0 size_flags_horizontal = 3 -editable_path = true [node name="Terminal" parent="Columns" instance=ExtResource( 1 )] anchor_right = 0.0 diff --git a/scenes/title.gd b/scenes/title.gd index b4c76c9..f2374af 100644 --- a/scenes/title.gd +++ b/scenes/title.gd @@ -14,3 +14,9 @@ func levels(): func on_survey_pressed(): game.open_survey() + + +func sandbox(): + game.current_chapter = levels.chapters.size() - 1 + game.current_level = levels.chapters[game.current_chapter].levels.size() -1 + get_tree().change_scene("res://scenes/main.tscn") diff --git a/scenes/title.tscn b/scenes/title.tscn index 30498fd..22126a1 100644 --- a/scenes/title.tscn +++ b/scenes/title.tscn @@ -71,10 +71,17 @@ margin_right = 351.0 margin_bottom = 39.0 text = "Levels" -[node name="Button2" type="Button" parent="VBoxContainer"] +[node name="Button3" type="Button" parent="VBoxContainer"] margin_top = 44.0 margin_right = 351.0 margin_bottom = 83.0 +text = "Sandbox" + +[node name="Button2" type="Button" parent="VBoxContainer"] +margin_top = 88.0 +margin_right = 351.0 +margin_bottom = 127.0 text = "Quit" [connection signal="pressed" from="VBoxContainer/Button" to="." method="levels"] +[connection signal="pressed" from="VBoxContainer/Button3" to="." method="sandbox"] [connection signal="pressed" from="VBoxContainer/Button2" to="." method="quit"]