VedalAI / neuro-amongus

Among Us Plugin for Neuro-sama
GNU General Public License v3.0
540 stars 49 forks source link

Vision improvements & fixes #11

Closed oleg20111511 closed 1 year ago

oleg20111511 commented 1 year ago

1) Cleaned up a little bit by spliting up UpdateVision function because it was starting to get too big

2) Replaced FindObjectsOfType(DeadBody) with a patch to Die that detects the body body by Physics2D.OverlapCircleAll at death point. Couldn't find a more direct way to fetch the bady, so this is somewhat of a workaround. This also means that deadBodies list is no longer updated every frame, but only when someone is killed or a meeting is called (which is when dead bodies are cleared).

3) Fixed raycast that was supposed to check if a player is visible. I noticed that, when player is hidden, there appears an overlap with Shadow layer on the raycast, and used that for detection. It doesn't work if player stands on the very edge of the shadow while visually being 100% invisible, but the margin is really tiny so shouldn't affect that much.

Vedal987 commented 1 year ago

This is good! There is one small bug where it still registers players as seen if they are just slightly out of the view vertically (eg. the dummy in medbay on the skeld) but it should make little practical difference. We can always add a check for the vertical distance between the players.

Alexejhero commented 1 year ago

Don't worry about my suggested changes, I've implemented them in #13.