Now that we have a case where the voltmeter's actually being used as a tool, it'd be good to extend the voltmeter function of the electrosense CBM to be usable for that too.
As a side bonus it comes with taking us another step closer to being able to do more with JSONized bionic functions.
Describe the solution
C++ changes:
In bionics.cpp, set it so that electrosense's voltmeter uses a different fake item specified below. Nothing really changes with this in how the bionic works when activated, but good for consistency and for later plans I had in mind involving JSONization of activating bionics.
In character.cpp, updated Character::use_charges to handle charge use when drawing on electrosenses' voltmeter as a tool.
In crafting.cpp, set Character::crafting_inventory so that the check for bionic fake items looks for static fake items that lack the BIONIC_TOGGLED flag, instead of demanding the bionic can't be toggle-able AT ALL. This is needed so that the electrosense's voltmeter function still allows being activated to access the voltmeter's use action without the presence of act_cost breaking its fake_item, but as a side benefit this will allow us to assign fake items to any bionic with existing hardcoded on-activate effects if desired, and potentially allow for JSONizing on-activate bionics by one day letting them just access a fake item's use action info.
In visitable.cpp, updated visitable<Character>::charges_of and visitable<Character>::amount_of to take electrosense voltmeter into account.
JSON changes:
Defined a fake item for electrosense to use that draws from bionic power. Counts as a substitute tool for the voltmeter.
Gave the electrosense bionic's voltmeter function the integrated voltmeter as fake_item, so it can be used as one for tool purposes (like deconstructing high-voltage electronics).
Describe alternatives you've considered
Reworking voltmeters to need power to activate at some point in the future. This can probably wait until after Kheir's joule rework.
Testing
Checked affected JSON files for syntax and lint errors.
Compiled and load-tested.
Gave myself bionic power and electrosense CBM. Confirmed it still works as expected when activated, and that it counts as a voltmeter for the purpose of deconstructing a plutonium generator.
Confirmed electrosense lets me deconstruct a plutonium generated, and it drains 10 kj as expected.
Confirmed if I don't have enough bionic power I can't attempt the deconstruct, and that nothing weird happens if I leave hydraulic muscles running while I deconstruct stuff.
Re-tested as a razor boy, confirmed I still have razors for the sake of butchering and dissecting.
Tested installing a bionic blade on a normal character, confirmed that toggling it on still works and that I don't gain access to its cutting quality unless it's deployed, as before.
Checked affected C++ files for astyle.
Additional context
One thing I could follow up on this with would be taking advantage of now being able to assign fake items to activatable bionics and defining a fake item that'd allow dielectric capacitance to serve as a substitute for rubber gloves in the relevant crafting requirement, though this might require me to build up more support for charge consumption of JSONized bionic fake items.
Checklist
Required
main
so it won't cause conflict when updatingmain
branch later.Optional
Purpose of change
Now that we have a case where the voltmeter's actually being used as a tool, it'd be good to extend the voltmeter function of the electrosense CBM to be usable for that too.
As a side bonus it comes with taking us another step closer to being able to do more with JSONized bionic functions.
Describe the solution
C++ changes:
Character::use_charges
to handle charge use when drawing on electrosenses' voltmeter as a tool.Character::crafting_inventory
so that the check for bionic fake items looks for static fake items that lack theBIONIC_TOGGLED
flag, instead of demanding the bionic can't be toggle-able AT ALL. This is needed so that the electrosense's voltmeter function still allows being activated to access the voltmeter's use action without the presence ofact_cost
breaking itsfake_item
, but as a side benefit this will allow us to assign fake items to any bionic with existing hardcoded on-activate effects if desired, and potentially allow for JSONizing on-activate bionics by one day letting them just access a fake item's use action info.visitable<Character>::charges_of
andvisitable<Character>::amount_of
to take electrosense voltmeter into account.JSON changes:
fake_item
, so it can be used as one for tool purposes (like deconstructing high-voltage electronics).Describe alternatives you've considered
Reworking voltmeters to need power to activate at some point in the future. This can probably wait until after Kheir's joule rework.
Testing
Additional context
One thing I could follow up on this with would be taking advantage of now being able to assign fake items to activatable bionics and defining a fake item that'd allow dielectric capacitance to serve as a substitute for rubber gloves in the relevant crafting requirement, though this might require me to build up more support for charge consumption of JSONized bionic fake items.