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

Move bionic_data to generic_factory #40155

Merged
merged 8 commits into from
May 8, 2020
Merged

Conversation

Fris0uman
Copy link
Contributor

@Fris0uman Fris0uman commented May 4, 2020

Summary

SUMMARY: Infrastructure "Move bionic_data to generic_factory"

Purpose of change

Modernise bionic code and should enable copy-from for CBMs

Describe the solution

Move bionic_data to generic_factory
Get rid of get_bool_or_flag implementation in favor of flags
Implement flags

Describe alternatives you've considered

Testing

Instal finger laser and power bank MK II
Shoot zombies
No problem

Create an override of Air filtration system using copr-from
Replace 7 mouth protection by 70 eyes protection in env_protect
Get a CBM with 70 eyes Ep

Try again but just change the name
Spawn and install the CBM and have only the name change

Make another CBM with a new id and use copy from
The CBM has the properties of the copied from bionic

Additional context

Using clear() in load_bionic for stdd::map is not super elegant
Also just making a new CBM, in a mod, with the same id as a vanilla one without copy from seem to work without errors, I don't know if that's a problem.

src/bionics.cpp Outdated Show resolved Hide resolved
@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/bionics-json-and-inheritance-override/23543/2

@anothersimulacrum
Copy link
Member

Fixes #37476 (stale).

@mlangsdorf mlangsdorf added Bionics CBM (Compact Bionic Modules) Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels May 5, 2020
@Fris0uman Fris0uman marked this pull request as ready for review May 5, 2020 20:24
Comment on lines -2712 to -2719
void finalize_bionics()
{
for( const std::pair<const bionic_id, bionic_data> &bio : bionics ) {
if( bio.second.upgraded_bionic ) {
bionics[ bio.second.upgraded_bionic ].available_upgrades.insert( bio.first );
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How were you able to remove the finalization step without changing the bionics json? I feel like you should still need some code like this somewhere, but I don't see it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because the only thing in the repo using this is the obsolete reactor CBM. But I should probably add an entry about it to the doc though.

@kevingranade kevingranade merged commit 3ac44fc into CleverRaven:master May 8, 2020
@kevingranade kevingranade mentioned this pull request May 8, 2020
@Fris0uman Fris0uman deleted the mod_cbm branch May 13, 2020 07:49
helariII referenced this pull request in helariII/Cherry-Pick-Move-bionic_data-to-generic_factory May 23, 2021
helariII referenced this pull request in helariII/Cherry-Pick-Move-bionic_data-to-generic_factory May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bionics CBM (Compact Bionic Modules) Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants