Skip to content

Block guard detection and light with doors - #2886

Open
ChiguireDigital wants to merge 4 commits into
endlessm:mainfrom
ChiguireDigital:fix/door-guard-detection
Open

ChiguireDigital wants to merge 4 commits into
endlessm:mainfrom
ChiguireDigital:fix/door-guard-detection

Conversation

@ChiguireDigital

Copy link
Copy Markdown
Contributor

Summary

  • Block guard detection when doors are closed.
  • Add light occlusion to horizontal and vertical doors.
  • Enable and disable door light occlusion based on the door's opened state.

Resolves #2824

@ChiguireDigital
ChiguireDigital requested a review from a team as a code owner September 14, 2026 01:02
@ChiguireDigital

Copy link
Copy Markdown
Contributor Author
Detection (1)

Hi! Here is the result for now (it was a bit tricky, but I think I solved it well 😅), let me know if there are any errors.

@github-actions

Copy link
Copy Markdown

Play this branch at https://play.threadbare.game/branches/ChiguireDigital/fix/door-guard-detection/.

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

@wjt

wjt commented Sep 14, 2026

Copy link
Copy Markdown
Member

Great start!

I think it would be useful to include a test scene exercising this - even simply committing the change you did to test.

I made a similar change, except i gave the guard a patrol path that spans the whole width between those two doors. Of course the guard is blocked by the door, but: their light and vision can go through the door.

Screencast.From.2026-09-14.12-50-35.0.00.-.0.16.8.mp4

@ChiguireDigital

Copy link
Copy Markdown
Contributor Author

Hi! I’ve addressed the issues I found:

Regarding the lighting, I slightly increased the size of the LightOccluder2D; this prevents light from bleeding through to the other side, even when the guard is right up against the door.

As a result, when the guard stands close to the door, the LightOccluder2D itself lights up (since the guard is inside it); I think this creates a nice effect where the bottom of the door on the opposite side gets illuminated.

As for detection, I realized the issue stemmed from the guard's automatic detection system, which triggered upon entering a specific radius but didn't account for obstacles between the enemy and the player. To fix this, I incorporated the function used for the guard's vision range to detect obstacles.

I also added a test scene named "issue_2824.tscn" where you can test the implemented changes.

Test.mp4

That’s how it stands for now; I’ll keep an eye out in case there’s anything else to resolve :)

@ChiguireDigital

Copy link
Copy Markdown
Contributor Author

Hello! I'm still following this issue, I'll be looking forward to your review. Thank you! 🙂

@manuq manuq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is looking nice! Let's first merge the guards into the existing demo. I copied your guard, and also added a new one that moves vertically to also test detection and occlussion in vertical doors.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's a great idea to add a scene to test it. I think this should be done directly in the existing doors & levers scene, not add a new one. Also the character should be the StoryVore (we don't use template characters in Dev Archipelago). Instead of suggesting, I came up with a separate PR based on your own level, can you review it? #2928

If you agree, then please rebase your changes after that one is merged.

@ChiguireDigital

Copy link
Copy Markdown
Contributor Author

@manuq Done! My changes are working perfectly in the scene you created :)

%ColliderWhenClosed.set_collision_layer_value(Enums.CollisionLayers.WALLS, not opened)
%ColliderWhenClosed.set_collision_layer_value(Enums.CollisionLayers.SIGHT_OCCLUDERS, not opened)
%ColliderWhenClosed.set_collision_mask_value(Enums.CollisionLayers.PLAYERS, not opened)
$LightOccluder2D.visible = not opened

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Leonardo-UTP Leonardo-UTP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I reviewed Pull Request #2886 and tested the changes requested in issue #2824 using the doors_and_levers scene.

I tested the guard detection and light behavior with both horizontal and vertical doors. Closed doors correctly block both guard detection and light, while opening the doors allows both to work as expected.

During my testing, I didn't find any issues related to these changes. I've attached two videos for reference showing the tests I performed.

Guard detection test:
[PR #2886 – Guard Detection Through Doors Test]

Light occlusion test (horizontal and vertical doors):
[PR #2886 – Door Light Occlusion Test]

@ChiguireDigital

Copy link
Copy Markdown
Contributor Author

Thank you for the review, Leo!! ☺️

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.

Doors: Block guard's detection and add light occlusion

4 participants