Skip to content

Conversation

@wjt
Copy link
Member

@wjt wjt commented Jan 9, 2026

Previously, guard.gd would check that the detected node was an instance of the Player script. This could be limiting if, for example, we wanted to make a challenge whether the player needs to escort an NPC without the NPC or the player-character being detected.

We also wish to add a level to the Champ StoryQuest where the player-character is not an instance of our Player script/scene, but a simple hand-rolled CharacterBody2D. This is intended to provide a venue for participants to explore their own player-character implementation and abilities. Because a hand-rolled player cannot interact, fight, or grapple, the obvious mechanic to use in this level is stealth. So we would like it to be possible for guards to detect an arbitrary CharacterBody2D that happens to be in the "players" physics layer.

This is easy to achieve by removing the type checks, adjusting the signal signature, and in stealth_game_logic.gd use a duck-typing approach of calling the defeat() method on the detected node if it is present. Nowhere else is the specific API of the Player script used.

Helps #1738

Previously, guard.gd would check that the detected node was an instance of the
Player script. This could be limiting if, for example, we wanted to make a
challenge whether the player needs to escort an NPC without the NPC or the
player-character being detected.

We also wish to add a level to the Champ StoryQuest where the player-character
is not an instance of our Player script/scene, but a simple hand-rolled
CharacterBody2D. This is intended to provide a venue for participants to explore
their own player-character implementation and abilities. Because a hand-rolled
player cannot interact, fight, or grapple, the obvious mechanic to use in this
level is stealth. So we would like it to be possible for guards to detect an
arbitrary CharacterBody2D that happens to be in the "players" physics layer.

This is easy to achieve by removing the type checks, adjusting the signal
signature, and in stealth_game_logic.gd use a duck-typing approach of calling
the defeat() method on the detected node if it is present. Nowhere else is the
specific API of the Player script used.

Helps #1738
@wjt wjt requested a review from a team as a code owner January 9, 2026 13:06
@github-actions
Copy link

github-actions bot commented Jan 9, 2026

Play this branch at https://play.threadbare.game/branches/endlessm/wjt/stealth-allow-guards-to-detect-any-node.

(This launches the game from the start, not directly at the change(s) in this pull request.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants