Skip to content

InputHud: Allow custom built player#2098

Merged
manuq merged 3 commits intomainfrom
fix-gym-scene
Apr 2, 2026
Merged

InputHud: Allow custom built player#2098
manuq merged 3 commits intomainfrom
fix-gym-scene

Conversation

@manuq
Copy link
Copy Markdown
Collaborator

@manuq manuq commented Apr 2, 2026

Consider that a player is no more than a CharacterBody2D, that is the first node in group "player". An thus may or may not have features like PlayerInteraction, PlayerRepel, or PlayerHook.

This fixes the gym_area_test scene, which has a custom built player.

Consider that a player is no more than a CharacterBody2D, that is the first node
in group "player". An thus may or may not have features like PlayerInteraction,
PlayerRepel, or PlayerHook.

This fixes the gym_area_test scene, which has a custom built player.
@manuq manuq requested a review from a team as a code owner April 2, 2026 13:49
@manuq
Copy link
Copy Markdown
Collaborator Author

manuq commented Apr 2, 2026

The (fantastic) recent changes in input hints broke the res://scenes/game_elements/characters/components/gym_area_test.tscn scene, which has a custom built player using the InputWalkBehavior in a CharacterBody2D.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Play this branch at https://play.threadbare.game/branches/endlessm/fix-gym-scene/.

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

Copy link
Copy Markdown
Member

@wjt wjt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I think you could tweak the dynamic lookup though.

I wonder if scenes/quests/story_quests/champ/3_stealth/champ_stealth.tscn still works - it uses a custom character.

Comment on lines +46 to +49
if "player_interaction" in player:
player_interaction = player.player_interaction as PlayerInteraction
if player_interaction:
player_interaction.can_interact_changed.connect(_update_player_state)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (untested) is a little more concise and perhaps a bit clearer:

Suggested change
if "player_interaction" in player:
player_interaction = player.player_interaction as PlayerInteraction
if player_interaction:
player_interaction.can_interact_changed.connect(_update_player_state)
player_interaction = player.get("player_interaction") as PlayerInteraction
if player_interaction:
player_interaction.can_interact_changed.connect(_update_player_state)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, and even works!

@manuq
Copy link
Copy Markdown
Collaborator Author

manuq commented Apr 2, 2026

I was about to slip #2099 in here but better not!

@manuq
Copy link
Copy Markdown
Collaborator Author

manuq commented Apr 2, 2026

Makes sense, I think you could tweak the dynamic lookup though.

I wonder if scenes/quests/story_quests/champ/3_stealth/champ_stealth.tscn still works - it uses a custom character.

Oh, let me check before merging.

@manuq
Copy link
Copy Markdown
Collaborator Author

manuq commented Apr 2, 2026

Makes sense, I think you could tweak the dynamic lookup though.
I wonder if scenes/quests/story_quests/champ/3_stealth/champ_stealth.tscn still works - it uses a custom character.

Oh, let me check before merging.

The level scene works. The hints don't appear but only because the CharacterBody2D is not in group "player". I wonder if that is left to the learners. The level scene also has its custom input hints:

image

So adding player to group "player" shows both overlapped:

image

I'm going to merge as-is for now.

@manuq manuq merged commit 076bf5d into main Apr 2, 2026
6 checks passed
@manuq manuq deleted the fix-gym-scene branch April 2, 2026 14:35
@wjt
Copy link
Copy Markdown
Member

wjt commented Apr 2, 2026

An open question is how we would adjust the global HUD labels for quests where the character has different abilities.

@manuq
Copy link
Copy Markdown
Collaborator Author

manuq commented Apr 2, 2026

An open question is how we would adjust the global HUD labels for quests where the character has different abilities.

I was thinking the same thing! Maybe the quest.tres can have a mapping of ability to its name and input action. Or just name and by convention ABILITY_A is always the repel input action, ABILITY_B is always the throw input action... But then what to do with aim which is 4 input actions? Tricky.

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