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

[Magiclysm] Extend custom sidebar to include mana, max mana, and mana graph #54314

Merged
merged 4 commits into from
Jan 13, 2022

Conversation

wapcaplet
Copy link
Contributor

@wapcaplet wapcaplet commented Jan 12, 2022

Summary

Mods "[Magiclysm] Extend custom sidebar to include mana, max mana, and mana graph"

Purpose of change

Enable the custom sidebar to display mana level, but only when Magiclysm mod is enabled.

Fix #54297

Describe the solution

  • Allow widget::load to read an "extends" object's nested "widgets"
  • Implement a max_mana widget variable (since max mana is indeed variable)
  • Add data/mods/Magiclysm/ui/sidebar.json with mana widgets, layouts, and sidebar extensions

Describe alternatives you've considered

The generic_factory seems like it natively supports the use of "extends" and "delete", but I couldn't get it to work without adding an explicit "extends" handler inside widget::load. I expect there's a cleaner and more generalized way to do this, and would be thrilled if anyone can tell me how. Done, thanks @anothersimulacrum for digging up the deets.

Testing

Additional context

Positioned mana sections of custom sidebar at the top for easier screenshotting:

image

How the new widget sections appear in the sidebar:

image

The graph is the first one to use the "pool" method of symbol filling - notice how the full bar depletes from # to =, then down to - and finally .:

image

image

image

image

Nearly out of mana:

image

Recharged some mana, then cast synaptic stimulation - maximum mana increased:

image

A few examples with both "Mana Graph" and "Mana Pool":

image

image

image

@wapcaplet wapcaplet added Info / User Interface Game - player communication, menus, etc. Mods: Magiclysm Anything to do with the Magiclysm mod labels Jan 12, 2022
src/widget.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Jan 12, 2022
This allows "extend" from generic_factory to work out of the box.
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Jan 12, 2022
@wapcaplet wapcaplet added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON labels Jan 12, 2022
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 12, 2022
@wapcaplet wapcaplet marked this pull request as ready for review January 12, 2022 21:37
@wapcaplet wapcaplet requested a review from KorGgenT as a code owner January 12, 2022 21:37
@wapcaplet wapcaplet marked this pull request as draft January 12, 2022 22:16
Defines widgets and sidebar layouts to add these sidebar sections when
Magiclysm is enabled:

- Current/Max Mana: Showing current and maximum mana numbers
- Mana Graph: Showing a 25-character graph of current mana
- Mana Pool: Same graph, but using the "pool" fill style

All widgets include color-coding, going from light blue to yellow, light
red, and red as mana diminishes.
@wapcaplet wapcaplet marked this pull request as ready for review January 13, 2022 00:15
@kevingranade
Copy link
Member

Neat you reinvented sparklines.

@kevingranade kevingranade merged commit 79d3795 into CleverRaven:master Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Mods: Magiclysm Anything to do with the Magiclysm mod
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The custom sidebar does not show mana
2 participants