-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Jsonize Cbm power generation #33302
Jsonize Cbm power generation #33302
Conversation
This reverts commit c435f83.
Does that include mana-powered bionics? OwO |
No not mana, not without some more code. |
src/bionics.cpp
Outdated
@@ -2096,13 +2150,23 @@ int bionic::get_quality( const quality_id &quality ) const | |||
return item( i.fake_item ).get_quality( quality ); | |||
} | |||
|
|||
bool bionic::is_muscle_powered() const | |||
{ | |||
for( const itype_id fuel : this->info().fuel_opts ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for( const itype_id fuel : this->info().fuel_opts ) { | |
for( const itype_id &fuel : info().fuel_opts ) { |
But better would be using std::find
, or maybe change fuel_opts
into a set and query it directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used std::find, I'm not too sure how to handle making fuel_opts a set
Why was the reversion to '2040 no mo' included? That seems like it would be out of this PR's scope. |
The commits say it reverts it - it is not actually reverted |
Ah, my mistake. |
Jsonize Cbm power generation
Summary
SUMMARY: Infrastructure "Jsonize Cbm power generation"
Purpose of change
Jsonize Cbm power generation, you can now specify what fuel a CBM can use, the efficiency of the conversion to bionic power and how many charges of fuel the CBM can hold.
Adresses part of #31495
Describe the solution
If player has bionic that can store fuel, it's added to the player fuel storage upon consumption.
Type and amount of fuel and CBM involved in storage are tracked using creature::value
When the bionic is activated we check if there is enought fuel for it to start and if there is enough room for more power to not waste fuel.
Every interval of time specified in
"time"
the bionic is active it addsfuel_energy * efficiency
to the power storage.The special case of muscle fuel is handled along side the code for joint torsion ratchet
Describe alternatives you've considered
Additional context
I did not remove the hardcoded bionic and did not move them to the unhardcoded system because it would break NPC usage of them.
Messing with the handling of CBMs by NPCs seems to be worth it's own PR.
This system allows for the creation of fuel storage CBM that could be alternative ways to store power.
(Which in turn could also allow mages to carry power without messing with their mana too much ...)