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

feat: in-game options, flags overhaul #506

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

LennardF1989
Copy link
Member

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).

Added plugin for the in-game menu system
Added example plugin with using custom flags
@RDIL
Copy link
Member

RDIL commented Aug 11, 2024

Lennard I love you this is amazing

@AnthonyFuller
Copy link
Contributor

AnthonyFuller commented Aug 20, 2024

Just pushed a bit of code which "migrates" the old options file. I add the flags we just read under the peacock section. From my testing it seems like it works. It will be for v8 anyway, so breaking changes are allowed.

@LennardF1989
Copy link
Member Author

Just pushed a bit of code which "migrates" the old options file. I add the flags we just read under the peacock section. From my testing it seems like it works. It will be for v8 anyway, so breaking changes are allowed.

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 :)

@AnthonyFuller AnthonyFuller changed the title In-game options menu feat: in-game options, flags overhaul Aug 20, 2024
@AnthonyFuller
Copy link
Contributor

AnthonyFuller commented Aug 20, 2024

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.

@RDIL
Copy link
Member

RDIL commented Aug 21, 2024

what about our evil plans to make everyone require a peacock account to use it /s

@LennardF1989
Copy link
Member Author

LennardF1989 commented Aug 21, 2024

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.

@AnthonyFuller
Copy link
Contributor

Yeah, I think the refresh of the menu is due to the submit-email forcing it.

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.

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 :)

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.

@LennardF1989
Copy link
Member Author

Found the issue with the enums, working on a fix.

@LennardF1989
Copy link
Member Author

LennardF1989 commented Aug 21, 2024

The last commit is not in a working state.

  • The index.json tries to look for options.json, but it does not exist.
  • The logic of the old hub.json is not reimplemented, so the peacock:getAllFlags is never executed and thus populated.
  • Hitman crashes upon load if the first issue mentioned is fixed and the second is not.

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.

@AnthonyFuller
Copy link
Contributor

AnthonyFuller commented Aug 21, 2024

Just pushed options.json, webstorm wasn't tracking it so I didn't realise I hadn't pushed it.

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).

Agreed.

System is kinda messy, but it works.

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.

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.

3 participants