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

feat(content): new voltmeter/bionic scanner CBM #4107

Merged
merged 6 commits into from
Jan 20, 2024

Conversation

chaosvolt
Copy link
Member

Purpose of change

This adds that other CBM idea I mentioned earlier. Along the way however, while looking into how power drain for it works, I found myself kinda not really liking how it worked. In particular, it's not really feasible to have the "it dumps power for each CBM detected until it runs out, then deactivates midway through" thing work right in CBM form, far as I could tell.

Describe the solution

C++ changes:

  1. In bionics.cpp, added a section to Character::activate_bionic that calls the use action effects of a voltmeter when a new bionic, shown below, is activated.
  2. Also in bionics.cpp, added a section to Character::process_bionic that mimics the effect of an active bionic scanner if a certain sister bionic is in use.
  3. In character.cpp, set Character::sees_with_specials so having the electrosense CBM active works for seeing electric zeds.
  4. In iuse.cpp, removed the whole "consume a full kj of power for each CBM detected" feature from iuse::note_bionics, on the basis that the device is already active and scanning already, and it flags which bodies have already been scanned either way. Plus it's a good way to just abruptly drain the entire battery on a single pile of bodies.

JSON changes:

  1. Added electrosense CBM. A combination bionic, one function does everything a voltmeter does, while the other is toggled on and off to gain the scanning effects that detect bionics and detect robots.
  2. Changed description of bionic scanner and gave the active version power draw, to make it draw power steadily while in use instead of taking big chunks out when it finds CBMs.
  3. Added electrosense CBM to the following itemgroups: bionics, bionics_mil, bionics_op, bionics_op2_utl, bionics_tech, and science.
  4. Misc: Made description of voltmeter state more clearly what it does.
  5. Added the new cbm to radio tower technician profession in Aftershock.

Describe alternatives you've considered

Rigging the voltmeter half of the CBM to not take charges at all, or else having it access charges_per_use of the voltmeter and using that, would be nice but it needs act_cost to be able to activate at all.

Testing

  1. Checked affected JSON for syntax and lint errors.
  2. Compiled and load-tested.
  3. Spawned in and installed electrosense CBM and a basic powergen setup.
  4. Activated the voltmeter component, it correctly brings up the menu for a voltmeter and does all the expected stuff.
  5. Toggled the scanner component on, it scans bodies as expected and I can see turrets through walls.
  6. Checked affected C++ files for astyle.

Additional context

Checklist

@github-actions github-actions bot added src changes related to source code. JSON related to game datas in JSON format. mods PR changes related to mods. labels Jan 14, 2024
@Admiral-Daala1541
Copy link

Does the mutation equivalent to the electrosense cbm get this as well? In regards to detecting electric enemies as well as robots?

@chaosvolt
Copy link
Member Author

Does the mutation equivalent to the electrosense cbm get this as well? In regards to detecting electric enemies as well as robots?

That's its main effect yeah, any enemies with the specific flags. Doesn't do the bionic scanning thing, which could be interesting as a mutation property but the way it's implemented is fucking agony to wrangle code-wise XD

@scarf005 scarf005 self-requested a review January 20, 2024 06:43
@scarf005 scarf005 self-assigned this Jan 20, 2024
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
image
image

LGTM

@scarf005 scarf005 merged commit 38c6f90 into cataclysmbnteam:main Jan 20, 2024
12 checks passed
@chaosvolt chaosvolt deleted the bionic-scanner-cbm branch January 20, 2024 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON related to game datas in JSON format. mods PR changes related to mods. src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants