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

Make APC UI work correctly with multiple users #32465

Merged

Conversation

eoineoineoin
Copy link
Contributor

About the PR

Made APC user interface work correctly with multiple users.
Fixes #15563. Fixes #32312. Obsoletes #32356.

Why / Balance

Technical details

ApcComponent previously stored a 'HasAccess' on the component, updating it whenever a user opened the APC UI and sending that flag in the state to all users. This was per-user state being stored globally.

Now, no longer stores that state and instead sends a message to each user of the UI individually to inform them if they have access.

Media

APCMultiUser.mp4

Requirements

Breaking changes

Changelog

@github-actions github-actions bot added the Changes: UI Can be reviewed or fixed by people who are knowledgeable with UI design label Sep 26, 2024
@hyphenationc
Copy link
Contributor

Well, at least now AI hostage situations will probably get fixed.

@deltanedas
Copy link
Contributor

you can use use IsAllowed in the ui as well to properly predict access

@eoineoineoin
Copy link
Contributor Author

you can use use IsAllowed in the ui as well to properly predict access

You mean put a [Dependency] on AccessReaderSystem in the APC BoundUserInterface? Interesting, didn't realize that was allowed. Will try that out tomorrow.

@eoineoineoin
Copy link
Contributor Author

you can use use IsAllowed in the ui as well to properly predict access

You mean put a [Dependency] on AccessReaderSystem in the APC BoundUserInterface? Interesting, didn't realize that was allowed. Will try that out tomorrow.

Turns out it isn't allowed, as it hits an UnregisteredDependencyException when constructing the BUI. It can be retrieved via the entity manager, though.

@metalgearsloth
Copy link
Contributor

System dependencies only work on other systems due to lifetime.

@deltanedas
Copy link
Contributor

you can use EntityManager.System to get the system

@metalgearsloth metalgearsloth merged commit 70b7747 into space-wizards:master Oct 12, 2024
11 checks passed
@lzk228
Copy link
Contributor

lzk228 commented Oct 12, 2024

you missed cl for this pr

@scrivoy
Copy link
Contributor

scrivoy commented Oct 12, 2024

hi, nice PR!
could that code also be used for looking at the power, solar, atmos or other consoles like crew monitor or something with multiple users? for me as an almost all time engineer it would be really helpful to have a look at the power with more people.
cheers!

@eoineoineoin
Copy link
Contributor Author

you missed cl for this pr

Didn't think it was worth it. Players won't notice a difference - you can't tell that someone else has the UI open, so you had to try to open it anyway. Now, it'll JustWork™ whenever they open the UI.

hi, nice PR! could that code also be used for looking at the power, solar, atmos or other consoles like crew monitor or something with multiple users? for me as an almost all time engineer it would be really helpful to have a look at the power with more people. cheers!

Took a quick look at the atmospheric alerts computer and that has the same fundamental problem in that it stores per-user state in a shared component. The code in this PR isn't really reusable - handling multiple users will differ depending on exactly what the UI wants to do. If you want to log a bug, I (or maybe somebody else) will get to it eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: UI Can be reviewed or fixed by people who are knowledgeable with UI design
Projects
None yet
6 participants