Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check who is dead at the start of meetings and don't let them talk at… #369

Open
wants to merge 1 commit into
base: nightly
Choose a base branch
from

Conversation

edtervit
Copy link

@edtervit edtervit commented Aug 1, 2024

… the end of a meeting

There is a bug with that latest version of TOH. During the ejection screen all ghosts have their isDead status set to false, causing alive players to hear the ghosts and potentially spoiling who the impostor is.

The fix is a simple array of player id's, at the start of each meeting it checks who is dead, then makes sure they're not able to speak during the ejection screen.

If a mod has reviving, the fix in the pr shouldn't affect it, only if they can be revived during a meeting. From what I found from googling the only mod with reviving does so during the TASK gamestate so this fix shouldn't affect it.

}
}
return [...prevState];
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

I might be missing something but couldn't you use the above otherDead variable? It appears to be set at the time time and to the same values.

}
if (checkIfPlayerWasDeadAtStartOfMeeting(myPlayer.ptr) && !myPlayer.isDead) {
myPlayer.isDead = true;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be refactored out of the loop as we don't need to check the local players dead state for every other player.

// bug with TOH where all players are considered alive during the ejection screen. This is a workaround
if (checkIfPlayerWasDeadAtStartOfMeeting(player.ptr) && !player.isDead) {
player.isDead = true;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

O(n^2), this is what lead me to look for other ways to do it and found the otherDead variable previously mentioned. It uses an indexed type so instead of iterating the entire player list for every player you can directly look it up. I know the performance difference is probably negligible but it should be slightly faster to use a look up type and I believe this is ran for basically every frame of the game.

Copy link

github-actions bot commented Aug 1, 2024

Download the artifacts for this pull request:


This service is provided by nightly.link. These artifacts will expire in 90 days and will not be available for download after that time.

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