-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat: in-game options, flags overhaul #506
Conversation
Added plugin for the in-game menu system Added example plugin with using custom flags
Lennard I love you this is amazing |
Just pushed a bit of code which "migrates" the old options file. I add the flags we just read under the |
Awesome - I mostly did the other options.ini file so I could switch between this and other branches, without constantly losing my stuff. But this is the way forward anyway! Great :) |
My plan for this right now is to override the IOI account portion of the options menu. This will virtually never be removed in an update or changed by mods. It also means it works everywhere. The Peacock tab is cool and all for testing, but moving it into options is better overall. EDIT: Seems like the IOI account option isn't shown in the pause menu options. We will have to override a template, shame but it has never been changed since chunk0. |
what about our evil plans to make everyone require a peacock account to use it /s |
My idea was that plugins could eventually register their own top-level entries in the menu (like the Test one) where they could do whatever they had to for their plugins, not just flags. This could obviously also work under Options :) On top of that, I think we may need two (or more) cachebuster variables to be able to control when which portion of the menu forcefully updates. In my initial implementation, whenever you do something in the UI you are always kicked back to the root of everything because the root-level also updates. But this may or may not be related to the cachebuster at all, but rather the way the ioiaccount response is handled. |
Yeah, I think the refresh of the menu is due to the One way around this is to store all the changes and do a bulk update by either pressing a "Save" button or by doing it when you exit the category.
Makes sense, we could still do this within options like you said, plugins could have their own menu with a link to a settings page within it (for flags) and then other custom pages. |
Found the issue with the enums, working on a fix. |
The last commit is not in a working state.
On top of that, I would really like to have the "Refresh UI" and cache buster data visible when PEACOCK_DEV is set, this really slows down testing changes to the UI. Also a nice excuse to extend the plugin API to be able to add this (along with the old "Test" menu option). I've pushed my enum fix either way, but this will need additional work. As for the enums: The problem is context/contextitem vs tabs/tabsitem for the controllers. Because a category can have both another category or flags, enums (as the normal options section uses them) won't work because they require a "tabs" controller. But if you set a category to always be "tabs", it won't be removed from the UI if you go a level deeper. So the best "solution" now was to add enum options as another level, rather than trying to mimic how Hitman usually handles enums. System is kinda messy, but it works. |
Just pushed
Agreed.
Yeah, menu templates get messy fast. The current system for enums is nice since it still shows the option info on the right, giving you context for what each enum does. |
What's stopping this from being merged right now? |
I can give it a test run this weekend to make sure it's functional and doesn't break backwards compatibility. |
One thing is that it should be moved into core, not a plugin. |
Update:
Why this is not ready yet (Must):
Should:
Nice to have:
|
.substring(peacockCommandPrefix.length) | ||
.split("|") | ||
|
||
commands.forEach((c) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a const-of, I somehow missed this or accidentally reverted it...
|
||
const peacockCommandPrefix = "peacock:" | ||
|
||
// LennardF1989: Do we want to consider string[] because of the use of URLSearchParams? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, no, maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with either, your call
if (command === "clear") { | ||
const commands = (args.commands as string)?.split(",") | ||
|
||
for (const c of commands) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c
clashes with outer variable, why is the linter fine with this?
I spoke to RDIL about this, he said that it should just save after every option change (like this). Sure, it's annoying, but it means any changes will be reflected instantly instead of a user forgetting to press save or something. |
Agreed, it should immediately change. I was just wondering if there is a way to not reset the menu. Afaik this happens because the email-endpoint updates the variable, so interesting to see if we can counter that by maintaining a client-side state and not sending back a status-response all the time OR simply remember where the user was in the UI and immediately jump back to that point (similar to what you do with the Freelancer tile that immediately starts it). But I was out of time yesterday. |
Since this is blocking in-game roulette's release, and we don't want users to have to use an unofficial PR branch, going to make the decision to merge this in it's current state. We can do follow-ups to improve it, but I think the current implementation is good enough:tm: to ship in an alpha state. |
Draft PR with WIP logic for an in-game options menu for Peacock (as a plugin, currently).
Also comes with extended flags.ts to feed the right information to the UI, plus logic to allow plugins to register their own flags (example included).