-
Notifications
You must be signed in to change notification settings - Fork 378
Add townies system with occasional helpers #2129
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
manuq
wants to merge
15
commits into
main
Choose a base branch
from
townies-system
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.
+1,219
−59
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
73930f3
Add global state for helper characters
manuq 47b8621
InventoryItem: Add NONE type and color constants
manuq 55b953e
CharacterRandomizer: Allow accessing the head sprite.
manuq dee61be
CharacterRandomizer: Vary the animation when randomizing
manuq f12051e
Quest: Add optional retelling dialogue to the resource
manuq b9a8ad6
StoryQuestProgress: Add helper character face to HUD
manuq 2996980
Add RetellingManager and RetellingTownie
manuq 5f0dd09
Add HelperCharacter
manuq e5a7cf6
Frays End, Eternal Loom: Add retelling and remove sokobans
manuq c404a15
Sokobans cleanup: Remove incorporating threads state
manuq 1ca9bdd
Sokobans: Remove project setting to skip the sokobans
manuq d867c0c
Musician and Void quests: Add retelling dialogue
manuq fc14f35
Musician quest: Add helpers
manuq 446ff47
Void quest: Add helpers
manuq 6e7dcee
fixup! Add RetellingManager and RetellingTownie
wjt 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
17 changes: 17 additions & 0 deletions
17
scenes/game_elements/characters/npcs/components/default_helper.dialogue
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,17 @@ | ||
| # SPDX-FileCopyrightText: The Threadbare Authors | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| ~ start | ||
| Do you want some help? | ||
| - Yes => help_accepted | ||
| - No => help_denied | ||
|
|
||
| ~ help_accepted | ||
| # TODO: do something that helps the player here. Like: | ||
| # do fix_bridge() | ||
| Bye! | ||
| do GameState.global.helper.clear() | ||
| => END | ||
|
|
||
| ~ help_denied | ||
| OK, bye! | ||
| => END |
16 changes: 16 additions & 0 deletions
16
scenes/game_elements/characters/npcs/components/default_helper.dialogue.import
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,16 @@ | ||
| [remap] | ||
|
|
||
| importer="dialogue_manager" | ||
| importer_version=15 | ||
| type="Resource" | ||
| uid="uid://c667fv6ngpc7s" | ||
| path="res://.godot/imported/default_helper.dialogue-2d2de185b0afee791b6bd97e2398a0de.tres" | ||
|
|
||
| [deps] | ||
|
|
||
| source_file="res://scenes/game_elements/characters/npcs/components/default_helper.dialogue" | ||
| dest_files=["res://.godot/imported/default_helper.dialogue-2d2de185b0afee791b6bd97e2398a0de.tres"] | ||
|
|
||
| [params] | ||
|
|
||
| defaults=true |
34 changes: 34 additions & 0 deletions
34
scenes/game_elements/characters/npcs/components/helper_character.gd
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,34 @@ | ||
| # SPDX-FileCopyrightText: The Threadbare Authors | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| extends Node | ||
| ## @experimental | ||
| ## | ||
| ## Makes a CharacterRandomizer a helper. | ||
| ## | ||
| ## If the global game state has help of the same type, the character becomes visible and | ||
| ## interactible, using the persisted character seed and ready to help the player. | ||
| ## Otherwise, it remains hidden and deactivated. | ||
| ## The help itself must be implemented per scene on the instantiated character. | ||
|
|
||
| ## The helper type to match. | ||
| @export var helper_type: InventoryItem.ItemType = InventoryItem.ItemType.MEMORY | ||
|
|
||
| ## The CharacterRandomizer that will offer help. | ||
| @onready var character: CharacterRandomizer = get_parent() | ||
|
|
||
|
|
||
| func _ready() -> void: | ||
| GameState.global.helper.changed.connect(_on_helper_state_changed) | ||
| _on_helper_state_changed() | ||
|
|
||
|
|
||
| func _on_helper_state_changed() -> void: | ||
| var is_enabled := ( | ||
| helper_type == GameState.global.helper.helper_type | ||
| and bool(GameState.global.helper.character_seed) | ||
| ) | ||
| character.visible = is_enabled | ||
| character.process_mode = Node.PROCESS_MODE_INHERIT if is_enabled else Node.PROCESS_MODE_DISABLED | ||
| if is_enabled: | ||
| character.character_seed = GameState.global.helper.character_seed | ||
| character.apply_character_randomizations() |
1 change: 1 addition & 0 deletions
1
scenes/game_elements/characters/npcs/components/helper_character.gd.uid
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://diskln3jup064 |
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
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,30 @@ | ||
| # SPDX-FileCopyrightText: The Threadbare Authors | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| @tool | ||
| class_name HelperCharacterState | ||
| extends Resource | ||
|
|
||
| ## The type of help, matching the magical threads type. | ||
| ## This is left to game designers interpretation but usually: | ||
| ## [br][br] | ||
| ## - Memory is about expanding the lore of the game.[br] | ||
| ## - Imagination is about making things appear in the level.[br] | ||
| ## - Spirit is about reducing the difficulty of an action-based puzzle.[br] | ||
| @export var helper_type: InventoryItem.ItemType = InventoryItem.ItemType.NONE | ||
|
|
||
| ## The seed to display a character with same visual features when offering help. | ||
| @export var character_seed: int = 0 | ||
|
|
||
|
|
||
| ## Consume the help. | ||
| func clear() -> void: | ||
| helper_type = InventoryItem.ItemType.NONE | ||
| character_seed = 0 | ||
| emit_changed() | ||
|
|
||
|
|
||
| ## Obtain the help. | ||
| func obtain(new_helper_type: InventoryItem.ItemType, new_character_seed: int) -> void: | ||
| helper_type = new_helper_type | ||
| character_seed = new_character_seed | ||
| emit_changed() |
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://yu6cw51sylfu |
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
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
17 changes: 17 additions & 0 deletions
17
...ests/lore_quests/quest_001/1_music_puzzle/components/dialogues/music_lore_helper.dialogue
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,17 @@ | ||
| # SPDX-FileCopyrightText: The Threadbare Authors | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| ~ start | ||
| My town has been unraveled. | ||
| Do you want to hear my story? | ||
| - Yes => help_accepted | ||
| - No => help_denied | ||
|
|
||
| ~ help_accepted | ||
| Lore lore lore. | ||
| Bye! | ||
| do GameState.global.helper.clear() | ||
| => END | ||
|
|
||
| ~ help_denied | ||
| OK, bye! | ||
| => END |
16 changes: 16 additions & 0 deletions
16
...re_quests/quest_001/1_music_puzzle/components/dialogues/music_lore_helper.dialogue.import
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,16 @@ | ||
| [remap] | ||
|
|
||
| importer="dialogue_manager" | ||
| importer_version=15 | ||
| type="Resource" | ||
| uid="uid://jf1tng8jxd3o" | ||
| path="res://.godot/imported/music_lore_helper.dialogue-e07faa651568cb20c63b23c6b4902663.tres" | ||
|
|
||
| [deps] | ||
|
|
||
| source_file="res://scenes/quests/lore_quests/quest_001/1_music_puzzle/components/dialogues/music_lore_helper.dialogue" | ||
| dest_files=["res://.godot/imported/music_lore_helper.dialogue-e07faa651568cb20c63b23c6b4902663.tres"] | ||
|
|
||
| [params] | ||
|
|
||
| defaults=true |
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.
I think you put
NONEat the end because you didn't want to have to update every instance in the game. OK! Perhaps we can later reorder this and update all resources.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.
The other option is to have
GameState.global.helperbenullwhen there is no helper. Then you would not need to introduce theNONEmember here, which is a potential source of bugs if someone setsNONEon aCollectibleItem.