-
Notifications
You must be signed in to change notification settings - Fork 455
Add scripts to make a pruned “StoryQuest Kit” bundle #2576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wjt
wants to merge
1
commit into
main
Choose a base branch
from
wjt/sqckck
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # SPDX-FileCopyrightText: The Threadbare Authors | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| name: "Make StoryQuest Kit" | ||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| paths: | ||
| - 'tools/sqckck.*' | ||
| - '.github/workflows/make-storyquest-kit.yml' | ||
| release: | ||
| types: | ||
| - published | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| env: | ||
| GODOT_VERSION: "4.7.1" | ||
|
|
||
| jobs: | ||
| make-storyquest-kit: | ||
| name: Make StoryQuest Kit | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| # Fetch full history of commits and tags so that git describe --tags works | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: ./.github/actions/lfs-cached-checkout | ||
|
|
||
| - name: Install Godot | ||
| uses: endlessm/godot-export-action/download-godot@v3 | ||
| with: | ||
| godot_version: ${{ env.GODOT_VERSION }} | ||
|
|
||
| - name: Restore .godot directory cache | ||
| uses: actions/cache/restore@v6 | ||
| with: | ||
| path: | | ||
| .godot | ||
| key: ${{ runner.os }}-dotgodot-${{ inputs.godot_version }}.${{ inputs.godot_flavor }}-${{ hashFiles('**/*.import') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-dotgodot-${{ inputs.godot_version }}.${{ inputs.godot_flavor }}- | ||
|
|
||
| - name: Make StoryQuest Kit | ||
| id: sqckck | ||
| run: ./tools/sqckck.sh | ||
| env: | ||
| GODOT: build/godot | ||
| GIT_AUTHOR_NAME: Threadbare StoryQuest Kit Maker | ||
| GIT_COMMITTER_NAME: Threadbare StoryQuest Kit Maker | ||
| GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | ||
| GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | ||
|
|
||
| - name: Upload kit artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| path: ${{ steps.sqckck.outputs.zip_file }} | ||
| archive: false | ||
|
|
||
| - name: Attach to release | ||
| if: ${{ github.event_name == 'release' }} | ||
| shell: bash | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -ex | ||
| gh release upload '${{ github.ref_name }}' "${{ steps.sqckck.outputs.zip_file }}" --repo '${{ github.repository }}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # SPDX-FileCopyrightText: The Threadbare Authors | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| extends Node2D | ||
|
|
||
| @onready var bridge_to_frays_end: ToggleableTileMapLayer = %BridgeToFraysEnd | ||
| @onready var bridge_to_frays_end_broken: ToggleableTileMapLayer = %BridgeToFraysEndBroken | ||
| @onready var story_quest_elder: Elder = %StoryQuestElder | ||
|
|
||
|
|
||
| func _ready() -> void: | ||
| # In the stripped-back StoryQuest kit, this is the home scene and Fray's End | ||
| # is not present. | ||
| var home_scene: String = ThreadbareProjectSettings.get_setting( | ||
| ThreadbareProjectSettings.HOME_SCENE | ||
| ) | ||
| var is_storyquest_kit := ResourceUID.ensure_path(home_scene) == scene_file_path | ||
|
|
||
| # Conditionally block the route back to Fray's End | ||
| bridge_to_frays_end.set_toggled(is_storyquest_kit) | ||
| bridge_to_frays_end_broken.set_toggled(not is_storyquest_kit) | ||
|
|
||
| if is_storyquest_kit and GameState.quest: | ||
| # The player has returned here after completing a quest. Silently mark | ||
| # it as completed. | ||
| GameState.mark_quest_completed() | ||
| GameState.save() | ||
|
|
||
| if not is_storyquest_kit: | ||
| # Don't need the StoryQuest Elder here in the normal project. | ||
| story_quest_elder.queue_free() | ||
| story_quest_elder = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://db0hjoby7su6n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # SPDX-FileCopyrightText: The Threadbare Authors | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| @tool | ||
| extends MainLoop | ||
| ## StoryQuest Construction Kit Construction Kit | ||
| ## | ||
| ## Prunes the game's source tree to make a reduced-size bundle that can be used | ||
| ## as the basis for a StoryQuest. | ||
|
|
||
| const GitDescribeExport = preload("res://addons/threadbare_git_describe/export.gd") | ||
|
|
||
| const HOME_SCENE := "res://scenes/dev/dev_archipelago.tscn" | ||
|
|
||
| const TEMPLATE_QUEST := "res://scenes/quests/template_quests/NO_EDIT/quest.tres" | ||
|
|
||
| const DELETE_PATHS := [ | ||
| "res://assets/third_party/tiny-swords-non-cc0", | ||
| "res://scenes/quests/lore_quests", | ||
| "res://scenes/quests/story_quests", | ||
| "res://scenes/world_map", | ||
| ] | ||
|
|
||
|
|
||
| func rm_rf(path: String) -> void: | ||
| # You can only delete empty folders, so using DirAccess.remove() means | ||
| # traversing the whole folder tree and deleting each leaf before its parent | ||
| # folder. But you can trash a non-empty folder in a single step! | ||
| var global_path := ProjectSettings.globalize_path(path) | ||
| var ret := OS.move_to_trash(global_path) | ||
| if ret != OK: | ||
| push_error("Failed to trash ", global_path, ": ", error_string(ret)) | ||
|
Comment on lines
+24
to
+31
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could also do this in the shell script, might be easier... |
||
|
|
||
|
|
||
| func _process(_delta: float) -> bool: | ||
| var home_scene := ResourceUID.path_to_uid(HOME_SCENE) | ||
| ProjectSettings.set_setting(ThreadbareProjectSettings.HOME_SCENE, home_scene) | ||
|
|
||
| var opening_quest := ResourceUID.path_to_uid(TEMPLATE_QUEST) | ||
| ProjectSettings.set_setting(ThreadbareProjectSettings.OPENING_QUEST, opening_quest) | ||
|
|
||
| ProjectSettings.set_setting("application/config/name", "Threadbare StoryQuest Kit") | ||
| GitDescribeExport.set_versions() | ||
|
|
||
| if ProjectSettings.save() != OK: | ||
| push_error("Failed to save project settings") | ||
|
|
||
| for path: String in DELETE_PATHS: | ||
| rm_rf(path) | ||
|
|
||
| return true # End the main loop | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://leeahp1ik7lj |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding 2 more elders to that first island makes it more confusing. Maybe I need to redesign the level more. I am tempted though to keep it as-is and then iterate in a subsequent PR