fix: electrosense CBM's voltmeter can be used in advanced deconstruction #5744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.