-
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
Changes from 12 commits
73930f3
47b8621
55b953e
dee61be
f12051e
b9a8ad6
2996980
5f0dd09
e5a7cf6
c404a15
1ca9bdd
d867c0c
fc14f35
446ff47
6e7dcee
11b3bf7
4b625e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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 |
| 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() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://diskln3jup064 |
| 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() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://yu6cw51sylfu |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # SPDX-FileCopyrightText: The Threadbare Authors | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| ~ start | ||
| Townies: Tell us a story about your last adventure! | ||
| StoryWeaver: I went on a quest with the musician and I... | ||
| - Learned a forgotten song {{ memory_text() }} => retell_memory | ||
| - Slipped past the guards {{ imagination_text() }} => retell_imagination | ||
| - Fought off some InkDrinkers {{ spirit_text() }} => retell_spirit | ||
|
Comment on lines
+6
to
+8
Member
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. We can iterate on this but I wonder if we should make the options conditional on the thread being available. Something like this:
Collaborator
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. This comes from the spec by @JoniCeceri, but now I see that's not part of the text I copy/pasted in the issue. The retelling of each option should be available anyways. If the player has the corresponding thread, they receive a reward. Currently, the 2 quests to which I added retelling will have all 3 threads, so is impossible to test at this point.
Member
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. I guess I disagree with the spec then 😀 but indeed – impossible to test without making threads optional. |
||
|
|
||
| ~ retell_memory | ||
| StoryWeaver: Let me whistle it to you... | ||
| if has_memory() | ||
| do give_memory_upgrade() | ||
| Townie: Oh I remember it! That's the lullaby my mother used to sing! | ||
| => END | ||
|
|
||
| ~ retell_imagination | ||
| StoryWeaver: Like I was a lizard, fast as a hare. | ||
| if has_imagination() | ||
| do give_imagination_upgrade() | ||
| Townie: I start imagining it now! | ||
| => END | ||
|
|
||
| ~ retell_spirit | ||
| StoryWeaver: Because they had stolen the ink! | ||
| if has_imagination() | ||
| do give_spirit_upgrade() | ||
| Townie: Ha! I feel brave now! | ||
| => END | ||
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.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 agree, I couldn't find another way in the prior game state. But now with resources, it looks like I should be able to get rid of the NONE enum and use null on the whole helper state. Thanks! Let me try it.