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

Eliminate Self-Aware trait and replace it with sidebar widgets #53802

Merged
merged 2 commits into from
Dec 29, 2021

Conversation

wapcaplet
Copy link
Contributor

@wapcaplet wapcaplet commented Dec 27, 2021

Summary

Bugfixes "Eliminate Self-Aware trait and replace it with sidebar widgets"

Purpose of change

The Self-Aware trait is kind of goofy, and of minimal utility. If taken at character creation time, it comes with an "Activate" function that simply displays the current hidden health stat. The only other thing it does is display raw hit point and pain numbers in the sidebar, and bandaging window.

Resolves #53473

Describe the solution

  • Remove the SELFAWARE mutation from all code and data
  • Remove all references to SELFAWARE from trait groups and scenarios in mods.
  • Replace one SELFAWARE instance with OPTIMISTIC, for the "Meditation" hobby.
  • Replace the trait with another one in an old regression test for Scout trait not working properly #42853 (the Self-Aware trait itself was not actually relevant here).

Replace with widgets:

  • Add hitpoint_nums_top_layout and hitpoint_nums_bottom_layout to sidebar JSON
  • Implement new widget_var variables health and health_text in widget class
  • Add health_num and health_text, which players may add to their sidebars by editing sidebar.json

There is already a pain_num widget that can display numeric pain values, which was the concern with the original issue #53473

Describe alternatives you've considered

Inventing new ways to make the trait make sense and be more useful. Discarded the idea after consulting with Kevin and other developers; future development direction will make this trait not worth the effort of maintaining.

Previously considered moving it to a DEBUG_SELFAWARE mutation

Testing

Debug mutate the new DEBUG_SELFAWARE trait and see that it does what SELFAWARE has always done. No longer applicable

Save a game with a character having SELFAWARE, then load it after this patch - error message is displayed as expected, saying the unknown trait will be ignored. The error does not reoccur after saving and loading again.

Additional context

Screenshot of custom sidebar with hitpoint_nums_top_layout and hitpoint_nums_bottom_layout added just below the regular HP bars:

image

Cropped shots of the health_num and health_text widgets with different health values:

image

Existing pain_num and pain_desc added to custom sidebar:

image

image

@wapcaplet wapcaplet added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies labels Dec 27, 2021
@mkrutov
Copy link
Contributor

mkrutov commented Dec 27, 2021

Is there any ingame non-debug non-nurse way to see your exact HP on your limbs?

Asking because super-low-HP characters benefit from this trait a lot, since when difference between '|||' and '|||||' is 3 points bars don't provide any useful information at all.

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Dec 27, 2021
@nexusmrsep
Copy link
Contributor

Does this imply that health stat can now be made visible for ex. in @ menu in a textified approximation form: very bad, bad, average, good, very good?

@Terrorforge
Copy link
Contributor

Asking because super-low-HP characters benefit from this trait a lot, since when difference between '|||' and '|||||' is 3 points bars don't provide any useful information at all.

Super-high-HP characters, too. Maybe it's just my weird little brain, but I really struggle to comprehend what ||\ means on a character with 171 hit points.

But I guess if it's staying as a debug trait, you can always just turn it on.

@GuardianDll
Copy link
Member

maybe make small CBM with his effect is a good idea?

@mkrutov
Copy link
Contributor

mkrutov commented Dec 27, 2021

maybe make small CBM with his effect is a good idea?

Yes, that would be awesome.

@wapcaplet
Copy link
Contributor Author

I've added numeric versions of the graphical bodypart HP widgets for the custom moddable sidebar. I was planning to do this anyway in a future PR, but now is a good time to add them.

The HP numbers are not enabled by default, but you will be able to easily add them (or replace the graphs with numbers) by simply editing your data/json/ui/sidebar.json and adding hitpoint_nums_top_layout and hitpoint_nums_bottom_layout to the root_layout_wide widget:

  {
    "id": "root_layout_wide",
    "type": "widget",
    "style": "layout",
    "arrange": "rows",
    "widgets": [
      "hitpoint_graphs_top_layout",
      "hitpoint_graphs_bottom_layout",
      "hitpoint_nums_top_layout",
      "hitpoint_nums_bottom_layout",
      "sound_fatigue_focus_layout",
      "stamina_speed_move_layout",
      "stats_layout"
    ]
  },

This is how it renders in the "Custom" section of the wide sidebars:

image

After #51438 is completed and merged, this will be something you can add/remove/toggle/rearrange like any other sidebar section. Encumbrance, warmth, and wetness numbers are coming soon too - no "Self-Awareness" required.

@Zireael07
Copy link
Contributor

In that case, I don't think the move to a debug trait is necessary, just straightforward obsoletion.

@wapcaplet
Copy link
Contributor Author

wapcaplet commented Dec 27, 2021

Does this imply that health stat can now be made visible for ex. in @ menu in a textified approximation form: very bad, bad, average, good, very good?

No, hidden health value is not displayed directly anywhere else I'm aware of; there is only the hint when you wake up from sleep, from the health_msgs.json snippets, based on rough thresholds (+/- 10, 50, 100). I never got around to making a widget for hidden health, but it would not be too difficult to do.

Edit Indeed it was not, and why wait. Included in this pull request now are two new widgets, health_num and health_text, which you may add to your custom sidebar JSON. Here is how they are displayed:

image

@wapcaplet wapcaplet added the Info / User Interface Game - player communication, menus, etc. label Dec 27, 2021
@wapcaplet wapcaplet changed the title Obsolete Self-Aware trait and move it to a debug mutation Obsolete Self-Aware trait and add sidebar widgets to replace it Dec 27, 2021
- src: Factor out all code references to SELFAWARE trait
- data: Remove SELFAWARE from starting traits
- data: Change SELFAWARE to OPTIMISTIC for Meditation hobby
- data/mods: Remove SELFAWARE from all mods
- tests: Remove SELFAWARE from test that doesn't need it
- Implement new widget_vars `health` and `health_text`
- Add widget JSON for HP numbers, health numbers/text
@wapcaplet wapcaplet changed the title Obsolete Self-Aware trait and add sidebar widgets to replace it Eliminate Self-Aware trait and replace it with sidebar widgets Dec 28, 2021
@wapcaplet wapcaplet marked this pull request as ready for review December 28, 2021 20:30
Copy link
Member

@Maleclypse Maleclypse left a comment

Choose a reason for hiding this comment

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

Thanks for fixing mods while you were here. Those looked good. Not approving since there is more to this PR than the mod stuff I reviewed and I don't feel qualified to check those parts :)

@kevingranade kevingranade merged commit f797070 into CleverRaven:master Dec 29, 2021
@wapcaplet wapcaplet deleted the w-unaware-wolf branch December 30, 2021 00:24
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 Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Turning off the 'Self Aware' mutation does not turn off the ability to see exact Pain numbers
8 participants