Block guard detection and light with doors - #2886
ChiguireDigital wants to merge 4 commits into
Conversation
|
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.) |
|
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 |
|
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.mp4That’s how it stands for now; I’ll keep an eye out in case there’s anything else to resolve :) |
|
Hello! I'm still following this issue, I'll be looking forward to your review. Thank you! 🙂 |
manuq
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
fdb34f3 to
f8cd865
Compare
|
@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 |
There was a problem hiding this comment.
Please access the light with a unique name https://github.com/endlessm/threadbare/wiki/Contributing#use-unique-names-to-reference-nodes-in-scripts
There was a problem hiding this comment.
Please access the light with a unique name https://github.com/endlessm/threadbare/wiki/Contributing#use-unique-names-to-reference-nodes-in-scripts
Ready :)
Leonardo-UTP
left a comment
There was a problem hiding this comment.
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]
|
Thank you for the review, Leo!! |

Summary
Resolves #2824