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

Jsonify radiation widget #55079

Merged
merged 3 commits into from
Feb 5, 2022
Merged

Conversation

dseguin
Copy link
Member

@dseguin dseguin commented Feb 4, 2022

Summary

None

Purpose of change

This marks the beginning of the Great Widget Migration, where text widget functions will be migrated to conditional clauses, a.k.a. purely JSON definitions.

Describe the solution

  1. Create conditional clauses for each state of the radiation badge
  2. Remove or migrate obsolete display functions related to the old radiation badge widget

For other areas using display::rad_badge_color_name, I've moved that function to output.cpp since it's more of a general thing now and no longer serves a purpose for drawing widgets.

Describe alternatives you've considered

Testing

Radiation badge unit tests are still working as before.

Also, manual testing:

Player rads Widget text
(no badge) radbadge_none
0 radbadge_0
1 radbadge_1
31 radbadge_31
61 radbadge_61
121 radbadge_121
241 radbadge_241

Additional context

Since individual items can't be tracked with conditions (not sure if that's even possible given how it works), I'm tracking the player's rads instead of the rads on the badge itself. It shouldn't make much of a difference since the player has to be wearing/wielding the badge for it to show up in the sidebar.

@wapcaplet
Copy link
Contributor

I can see that it would be complicated trying to get a stored item value like radiation out of an NPC talker condition...

The badge itself only accumulates radiation when it's being worn, as I learned when implementing #53915. Having the sidebar show personal radiation (but only while wearing the badge) may be a little unrealistic, but probably more useful to the player.

Without testing it, I would guess there's a chance of a discrepancy between sidebar badge color and the displayed color on the description of the badge itself - if the character is exposed to radiation for a while before unwrapping and wearing the badge, their personal radiation would be higher than the badge's.

@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 labels Feb 4, 2022
@Maleclypse Maleclypse added Controls / Input Keyboard, mouse, keybindings, input UI, etc. Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs and removed json-styled JSON lint passed, label assigned by github actions labels Feb 4, 2022
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Feb 4, 2022
@dseguin
Copy link
Member Author

dseguin commented Feb 4, 2022

Without testing it, I would guess there's a chance of a discrepancy between sidebar badge color and the displayed color on the description of the badge itself - if the character is exposed to radiation for a while before unwrapping and wearing the badge, their personal radiation would be higher than the badge's.

That's true, and also if they choose to expose the badge to radiation (ex: via the irradiation plant), the badge info would show much more radiation than the widget Edit: I just checked and this is, in fact, not true :P (my mistake). I figured that 90% of use cases would just involve wearing the badge normally and decided it was enough of an edge case to stick to player rads.

Example:

No rads, player just unwrapped a badge
green_green

200 rads, player just unwrapped a badge
green_red

Player unwraps the badge and then gets exposed to 200 rads
red_red

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 4, 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` Controls / Input Keyboard, mouse, keybindings, input UI, etc. 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 [Markdown] Markdown issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants