This simplifies the code and makes the experience of examining contents
easier without the reagent dispenser UI, as well as adding the possibility
for dispensers to have items of heterogeneous sizes in them, which would
allow configuring reagent dispensers to accept smaller containers such
as beakers or vials in order to allow for more types of smaller quantities
of reagents, or other flexibilities brought by using a standard storage
component.
* Add ENERGYWATTHOURS() loc function
Takes in joules (energy), displays as watt-hours.
* Add simple OnOffButton control
* Re-add Inset style class
This was sloppily removed at some point?? Whatever, I need it.
* Add helper functions for setting title/guidebook IDs on FancyWindow
Reagent dispenser uses these, more in the next commits.
* Add BuiPredictionState helper
This enables me to implement coarse prediction manually in the battery UI.
Basically it's a local buffer of predicted inputs that can easily be replayed against future BUI states from the server.
* Add input coalescing infrastructure
I ran into the following problem: Robust's Slider control absolutely *spams* input events, to such a degree that it actually causes issues for the networking layer if directly passed through. For something like a slider, we just need to send the most recent value.
There is no good way for us to handle this in the control itself, as it *really* needs to happen in PreEngine. For simplicity reasons (for BUIs) I came to the conclusion it's best if it's there, as it's *before* any new states from the server can be applied. We can't just do this in Update() or something on the control as the timing just doesn't line up.
I made a content system, BuiPreTickUpdateSystem, that runs in the ModRunLevel.PreEngine phase to achieve this. It runs a method on a new IBuiPreTickUpdate interface on all open BUIs. They can then implement their own coalescing logic.
In the simplest case, this coalescing logic can just be "save the last value, and if we have any new value since the last update, send an input event." This is what the new InputCoalescer<T> type is for.
Adding new coalescing logic should be possible in the future, of course. It's all just small helpers.
* Battery interface
This adds a proper interface to batteries (SMES/substation). Players can turn IO on and off, and they can change charge and discharge rate. There's also a ton of numbers and stuff. It looks great.
This actually enables charge and discharge rates to be changed for these devices. The settings for both have been set between 5kW and 150kW.
* Oops, forgot to remove these style class defs.
* Remove some BUI boilerplate
- The disposals overrides got removed due to the helper method handling it.
- Replace window creation with CreateWindow helper.
- Fixed some stinky code which would cause exceptions.
* More
* moar
* weh
* done
* More BUIs
* More updates
* weh
* moar
* look who it is
* weh
* merge
* weh
* fixes
* Adds Support for Guidebook Buttons in UIs
* read it from the component
* the code is perfect
* moony review
---------
Co-authored-by: ike709 <ike709@github.com>
* Add limited-reagent dispensers
* Add empty versions for all dispensers
* Fix lint
* Set initial window size so all buttons are visible
* Simplify logic, add parenthesis
* Use localized name for initial labels
* Adjust button style
* Avoid touching items before MapInit
* Remove pre-labeling
* Reduce diff
* Clean up YAML
* Fix test
* Really fix test
* Document
* Adjust based on review
* Add labels for obnoxiously long bottles
---------
Co-authored-by: AWF <you@example.com>