-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add a new widget to display weight with the format "##.#/##.#[unit]" #77212
base: master
Are you sure you want to change the base?
Conversation
…and "##.#/##.# lb", and add the widgets to the legacy labels sidebar
Spell checker encountered unrecognized words in the in-game text added in this pull request. See below for details. Click to expand
This alert is automatically generated. You can simply disregard if this is inaccurate, or (optionally) you can also add the new words to Hints for adding a new word to the dictionary
|
I don't format goodly Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Is there any reason to have separate widgets for kg and lbs? In the settings: |
I could probably check that in the display function, I'll look into it when I get home tonight I honestly threw the imperial one in as a complete after thought |
made necessary changes to remove the code dedicated to the imperial version, and modified the metric function so it detects the users mass unit and adjusts accordingly. Also renamed all variable names to be non unit specific |
… to read users mass setting and adjust the display accordingly
Formatting Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
lbs? UPD. And it wouldn't hurt to add a space between the value and kg/lb. |
… I think it ate this space in the merge :(
Okay, I'm not good with the imperial system of measurement. Wiki says it's And it's definitely not correct to use |
Summary
Features "Add a new widget to display weight as "##.#/##.#[unit]""
Purpose of change
I felt like this was a glaring hole in the information you could display in the sidebar, considering all the random stuff you can display over there, so I fixed it.
Describe the solution
Added a new functions in display,cpp to pull current units and concat current weight with max weight, and calculate what percent of the max they are to color them appropriately, then added the requisite code to widget.cpp to call on this information.
I then added a new widgets to legacy labels sidebar to display this new information, because that's the sidebar I use. If anyone wants it added to another sidebar, speak up.
Describe alternatives you've considered
Not doing the imperial version because pounds make no sense
Testing
Additional context
I'd like to thank my gf for being patient with me while I ignored the show we were watching all day today, and I'd like to thank chatGPT for holding my hand and helping me setup the compiler in visual code, and helping me with c++ syntax because my coding experience is limited to java from 15 years ago, and lua from writing software in the minecraft computercraft mod
My head hurts
I'd also like to thank @Zenefess for giving me some guidance on how widgets work when I first thought about doing this a month or two ago
Should probably rename the existing carry_weight_text variables to denote that they handle the carry weight as a percent, because it's somewhat ambiguous