diff --git a/data/json/bionics.json b/data/json/bionics.json index 87b1afe875a8..ffdcc0dfc933 100644 --- a/data/json/bionics.json +++ b/data/json/bionics.json @@ -851,8 +851,10 @@ "name": { "str": "Radiation Scrubber System" }, "description": "A system of advanced piezomechanical blood filters have been surgically implanted throughout your body, allowing you to purge yourself of absorbed radiation at the cost of some bionic power.", "occupied_bodyparts": [ [ "torso", 5 ], [ "arm_l", 1 ], [ "arm_r", 1 ], [ "leg_l", 2 ], [ "leg_r", 2 ] ], - "flags": [ "BIONIC_NPC_USABLE" ], - "act_cost": "4500 J" + "flags": [ "BIONIC_TOGGLED", "BIONIC_NPC_USABLE" ], + "act_cost": "10 kJ", + "react_cost": "10 J", + "time": 1 }, { "id": "bio_railgun", @@ -1175,6 +1177,48 @@ "time": 1, "flags": [ "BIONIC_TOGGLED", "BIONIC_POWER_SOURCE", "BIONIC_NPC_USABLE" ] }, + { + "id": "bio_reactor", + "type": "bionic", + "name": { "str": "Micro Reactor" }, + "description": "This stripped down mini-reactor generates impressive amounts of bionic power but slowly irradiates the user.", + "occupied_bodyparts": [ [ "torso", 55 ] ], + "encumbrance": [ [ "torso", 5 ] ], + "fuel_options": [ "plut_cell" ], + "fuel_capacity": 10000, + "fuel_efficiency": 1, + "fuel_multiplier": 2500, + "time": 1, + "flags": [ "BIONIC_TOGGLED", "BIONIC_POWER_SOURCE", "BIONIC_NPC_USABLE" ], + "included_bionics": [ "bio_reactoroverride" ], + "available_upgrades": [ "bio_advreactor" ] + }, + { + "id": "bio_advreactor", + "type": "bionic", + "name": { "str": "Advanced Micro Reactor" }, + "description": "This stripped down mini-reactor has been heavily modified and is more efficient and safer than the base model.", + "occupied_bodyparts": [ [ "torso", 55 ] ], + "encumbrance": [ [ "torso", 5 ] ], + "fuel_options": [ "plut_cell" ], + "fuel_capacity": 12000, + "fuel_efficiency": 1.25, + "fuel_multiplier": 3000, + "time": 1, + "flags": [ "BIONIC_TOGGLED", "BIONIC_POWER_SOURCE", "BIONIC_NPC_USABLE" ], + "included_bionics": [ "bio_reactoroverride" ], + "upgraded_bionic": "bio_reactor" + }, + { + "id": "bio_reactoroverride", + "type": "bionic", + "name": { "str": "Micro Reactor Safety Override" }, + "description": "Disables the radiation safety protocols allowing for much higher energy production.", + "time": 1, + "act_cost": "10 J", + "react_cost": "10 J", + "flags": [ "BIONIC_TOGGLED" ] + }, { "id": "bio_syringe", "type": "bionic", diff --git a/data/json/itemgroups/bionics.json b/data/json/itemgroups/bionics.json index 040682837741..24fba1842077 100644 --- a/data/json/itemgroups/bionics.json +++ b/data/json/itemgroups/bionics.json @@ -95,7 +95,8 @@ [ "afs_bio_missiles", 10 ], [ "afs_bio_linguistic_coprocessor", 10 ], [ "afs_bio_dopamine_stimulators", 10 ], - [ "bio_blaster", 5 ] + [ "bio_blaster", 5 ], + [ "bio_reactor", 10 ] ] }, { @@ -358,7 +359,8 @@ [ "bio_ods", 10 ], [ "bio_weight", 15 ], [ "afs_bio_missiles", 10 ], - [ "afs_bio_dopamine_stimulators", 15 ] + [ "afs_bio_dopamine_stimulators", 15 ], + [ "bio_reactor", 10 ] ] }, { @@ -418,7 +420,9 @@ [ "bio_teleport", 4 ], [ "bio_probability_travel", 4 ], [ "afs_bio_linguistic_coprocessor", 10 ], - [ "afs_bio_dopamine_stimulators", 10 ] + [ "afs_bio_dopamine_stimulators", 10 ], + [ "bio_reactor", 10 ], + [ "bio_reactor_upgrade", 10 ] ] }, { diff --git a/data/json/items/bionics.json b/data/json/items/bionics.json index c070435f622d..0ce601fe89c8 100644 --- a/data/json/items/bionics.json +++ b/data/json/items/bionics.json @@ -769,6 +769,44 @@ "weight": "600 g", "difficulty": 7 }, + { + "id": "bio_reactor", + "copy-from": "bionic_general_npc_usable", + "type": "BIONIC_ITEM", + "name": { "str": "Internal Microreactor CBM" }, + "description": "This stripped down mini-reactor will generate impressive amounts of bionic power, but may not be the safest thing to install. Once active, it cannot be shut down and will slowly contaminate the user's body with radiation.", + "price": 900000, + "difficulty": 11 + }, + { + "id": "bio_advreactor", + "copy-from": "bionic_general_npc_usable", + "type": "BIONIC_ITEM", + "name": { "str": "Advanced Microreactor CBM" }, + "description": "This module upgrades a pre-installed microreactor with enhanced maximum yield and limited automatic radiation scrubbing capabilities.", + "price": 900000, + "difficulty": 13 + }, + { + "id": "bio_reactoroverride", + "copy-from": "bionic_general_npc_usable", + "type": "BIONIC_ITEM", + "name": { "str": "Micro Reactor Safety Override CBM" }, + "description": "Disables the radiation safety protocols allowing for much higher energy production.", + "price": 900000, + "difficulty": 13 + }, + { + "id": "bio_reactor_upgrade", + "bionic_id": "bio_advreactor", + "copy-from": "bionic_general_npc_usable", + "type": "BIONIC_ITEM", + "name": { "str": "Microreactor Upgrade CBM" }, + "description": "A kit for upgrading a pre-installed microreactor with enhanced maximum yield and limited automatic radiation scrubbing capabilities.", + "price": 250000, + "difficulty": 11, + "is_upgrade": true + }, { "id": "bio_recycler", "copy-from": "bionic_general_npc_usable", diff --git a/data/json/obsoletion/items.json b/data/json/obsoletion/items.json index 1b029a72e138..b6525feff233 100644 --- a/data/json/obsoletion/items.json +++ b/data/json/obsoletion/items.json @@ -421,45 +421,6 @@ "relative": { "reload": 2 }, "magazines": [ [ "flammable", [ "aux_pressurized_tank", "pressurized_tank" ] ] ] }, - { - "id": "bio_advreactor", - "copy-from": "bionic_general_npc_usable", - "type": "BIONIC_ITEM", - "name": { "str": "Advanced Microreactor CBM" }, - "description": "This module upgrades a pre-installed microreactor with enhanced maximum yield and limited automatic radiation scrubbing capabilities.", - "price": 900000, - "difficulty": 13 - }, - { - "id": "bio_plut_filter", - "copy-from": "bionic_general_npc_usable", - "type": "BIONIC_ITEM", - "name": { "str": "Plutonium Filter CBM" }, - "description": "A system of tanks and filters that are connected to a microreactor to extract plutonium from radioactive slurry.", - "price": 60000, - "weight": "1000 g", - "difficulty": 6 - }, - { - "id": "bio_reactor", - "copy-from": "bionic_general_npc_usable", - "type": "BIONIC_ITEM", - "name": { "str": "Internal Microreactor CBM" }, - "description": "This stripped down mini-reactor will generate impressive amounts of bionic power, but may not be the safest thing to install. Once active, it cannot be shut down and will slowly contaminate the user's body with radiation.", - "price": 900000, - "difficulty": 11 - }, - { - "id": "bio_reactor_upgrade", - "bionic_id": "bio_advreactor", - "copy-from": "bionic_general_npc_usable", - "type": "BIONIC_ITEM", - "name": { "str": "Microreactor Upgrade CBM" }, - "description": "A kit for upgrading a pre-installed microreactor with enhanced maximum yield and limited automatic radiation scrubbing capabilities.", - "price": 250000, - "difficulty": 11, - "is_upgrade": true - }, { "id": "v29_cheap", "type": "GUN", diff --git a/data/json/obsoletion/uncategorized.json b/data/json/obsoletion/uncategorized.json index 6933b72211bf..d52e81ea6cb2 100644 --- a/data/json/obsoletion/uncategorized.json +++ b/data/json/obsoletion/uncategorized.json @@ -1,43 +1,4 @@ [ - { - "id": "bio_advreactor", - "type": "bionic", - "name": { "str": "Advanced Microreactor System" }, - "description": "This stripped down mini-reactor is more efficient and safer than the base model due to integrated radiation cleansers. There is no way to shut it down once active, but you can toggle additional fuel intake.", - "occupied_bodyparts": [ [ "torso", 55 ] ], - "flags": [ "BIONIC_POWER_SOURCE", "BIONIC_TOGGLED", "BIONIC_NPC_USABLE" ], - "included_bionics": [ "bio_plutdump" ], - "upgraded_bionic": "bio_reactor" - }, - { - "id": "bio_plut_filter", - "type": "bionic", - "name": { "str": "Plutonium Filter" }, - "description": "This set of tanks and filters allows you to extract plutonium from radioactive slurry.", - "occupied_bodyparts": [ [ "torso", 10 ] ], - "flags": [ "BIONIC_TOGGLED", "BIONIC_NPC_USABLE" ], - "act_cost": 1, - "react_cost": 1, - "time": 12 - }, - { - "id": "bio_plutdump", - "type": "bionic", - "name": { "str": "Plutonium Purger" }, - "included": true, - "description": "Triggers an emergency reactor fuel purge that ejects all fuel from your reactor.", - "act_cost": 1 - }, - { - "id": "bio_reactor", - "type": "bionic", - "name": { "str": "Microreactor System" }, - "description": "This stripped down mini-reactor generates impressive amounts of bionic power. There is no way to shut it down, but you can toggle additional fuel intake. Irradiates your body when active.", - "occupied_bodyparts": [ [ "torso", 55 ] ], - "flags": [ "BIONIC_POWER_SOURCE", "BIONIC_TOGGLED", "BIONIC_NPC_USABLE" ], - "available_upgrades": [ "bio_advreactor" ], - "included_bionics": [ "bio_plutdump" ] - }, { "id": "bio_furnace", "type": "bionic", diff --git a/doc/JSON_INFO.md b/doc/JSON_INFO.md index b3493701e667..01d74a8c296b 100644 --- a/doc/JSON_INFO.md +++ b/doc/JSON_INFO.md @@ -509,6 +509,7 @@ This section describes each json file and their contents. Each json has their ow | is_remote_fueled | (_optional_) If true this bionic allows you to plug your power banks to an external power source (solar backpack, UPS, vehicle etc) via a cable. (default: `false`) | fuel_capacity | (_optional_) Volume of fuel this bionic can store. | fuel_efficiency | (_optional_) Fraction of fuel energy converted into power. (default: `0`) +| fuel_multiplier | (_optional_) Multiplies the amount of fuel when loading into the bionic (default: `1`) | passive_fuel_efficiency | (_optional_) Fraction of fuel energy passively converted into power. Useful for CBM using PERPETUAL fuel like `muscle`, `wind` or `sun_light`. (default: `0`) | exothermic_power_gen | (_optional_) If true this bionic emits heat when producing power. (default: `false`) | coverage_power_gen_penalty | (_optional_) Fraction of coverage diminishing fuel_efficiency. Float between 0.0 and 1.0. (default: `nullopt`) diff --git a/src/bionics.cpp b/src/bionics.cpp index c947cbe1a5e0..74da981615a0 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -166,7 +166,6 @@ static const bionic_id bio_magnet( "bio_magnet" ); static const bionic_id bio_meteorologist( "bio_meteorologist" ); static const bionic_id bio_nanobots( "bio_nanobots" ); static const bionic_id bio_painkiller( "bio_painkiller" ); -static const bionic_id bio_plutdump( "bio_plutdump" ); static const bionic_id bio_power_storage( "bio_power_storage" ); static const bionic_id bio_power_storage_mkII( "bio_power_storage_mkII" ); static const bionic_id bio_probability_travel( "bio_probability_travel" ); @@ -303,6 +302,7 @@ void bionic_data::load( const JsonObject &jsobj, const std::string src ) assign( jsobj, "fuel_options", fuel_opts, strict ); assign( jsobj, "fuel_capacity", fuel_capacity, strict, 0 ); assign( jsobj, "fuel_efficiency", fuel_efficiency, strict, 0.0f ); + assign( jsobj, "fuel_multiplier", fuel_multiplier, strict, 0 ); assign( jsobj, "passive_fuel_efficiency", passive_fuel_efficiency, strict, 0.0f ); assign( jsobj, "coverage_power_gen_penalty", coverage_power_gen_penalty, strict ); assign( jsobj, "exothermic_power_gen", exothermic_power_gen, strict ); @@ -756,13 +756,6 @@ bool Character::activate_bionic( bionic &bio, bool eff_only ) } else if( bio.id == bio_geiger ) { add_msg_activate(); add_msg_if_player( m_info, _( "Your radiation level: %d" ), get_rad() ); - } else if( bio.id == bio_radscrubber ) { - add_msg_activate(); - if( get_rad() > 4 ) { - mod_rad( -5 ); - } else { - set_rad( 0 ); - } } else if( bio.id == bio_adrenaline ) { add_msg_activate(); if( has_effect( effect_adrenaline ) ) { @@ -965,17 +958,6 @@ bool Character::activate_bionic( bionic &bio, bool eff_only ) } else { bio.powered = g->remoteveh() != nullptr || !get_value( "remote_controlling" ).empty(); } - } else if( bio.id == bio_plutdump ) { - if( query_yn( - _( "WARNING: Purging all fuel is likely to result in radiation! Purge anyway?" ) ) ) { - add_msg_activate(); - slow_rad += ( tank_plut + reactor_plut ); - tank_plut = 0; - reactor_plut = 0; - } else { - refund_power(); - return false; - } } else if( bio.info().is_remote_fueled ) { std::vector cables = items_with( []( const item & it ) { return it.has_flag( flag_CABLE_SPOOL ); @@ -1748,6 +1730,17 @@ void Character::process_bionic( bionic &bio ) } } else if( bio.id == afs_bio_dopamine_stimulators ) { add_morale( MORALE_FEELING_GOOD, 20, 20, 30_minutes, 20_minutes, true ); + } else if( bio.id == bio_radscrubber ) { + if( calendar::once_every( 10_minutes ) ) { + const units::energy trigger_cost = bio.info().power_trigger; + + if( get_rad() > 0 && bio.energy_stored >= trigger_cost ) { + add_msg_if_player( m_good, _( "Your %s completed a scrubbing cycle." ), bio.info().name ); + + mod_rad( std::max( -10, -get_rad() ) ); + mod_power_level( -trigger_cost ); + } + } } } diff --git a/src/bionics.h b/src/bionics.h index 8667e35596ac..cdec78b23aca 100644 --- a/src/bionics.h +++ b/src/bionics.h @@ -69,6 +69,8 @@ struct bionic_data { int fuel_capacity = 0; /**Fraction of fuel energy converted to bionic power*/ float fuel_efficiency = 0.0f; + /**Multiplies the amount of fuel when loading into the bionic storage*/ + int fuel_multiplier = 1; /**Fraction of fuel energy passively converted to bionic power*/ float passive_fuel_efficiency = 0.0f; /**Fraction of coverage diminishing fuel_efficiency*/ diff --git a/src/character.cpp b/src/character.cpp index c1ac81167140..afb5bd1a21e0 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -2006,6 +2006,15 @@ std::vector Character::get_fuel_available( const bionic_id &bio ) cons return stored_fuels; } +int Character::get_fuel_type_available( const itype_id &fuel ) const +{ + int amount_stored = 0; + if( !get_value( fuel.str() ).empty() ) { + amount_stored = std::stoi( get_value( fuel.str() ) ); + } + return amount_stored; +} + int Character::get_fuel_capacity( const itype_id &fuel ) const { int amount_stored = 0; diff --git a/src/character.h b/src/character.h index 3e27722128e5..cb0fd068f52f 100644 --- a/src/character.h +++ b/src/character.h @@ -968,6 +968,8 @@ class Character : public Creature, public visitable /**Return list of available fuel for this bionic*/ std::vector get_fuel_available( const bionic_id &bio ) const; /**Return available space to store specified fuel*/ + int get_fuel_type_available( const itype_id &fuel ) const; + /**Return available space to store specified fuel*/ int get_fuel_capacity( const itype_id &fuel ) const; /**Return total space to store specified fuel*/ int get_total_fuel_capacity( const itype_id &fuel ) const; @@ -1888,7 +1890,6 @@ class Character : public Creature, public visitable */ ret_val will_eat( const item &food, bool interactive = false ) const; /** Determine character's capability of recharging their CBMs. */ - bool can_feed_reactor_with( const item &it ) const; bool can_feed_furnace_with( const item &it ) const; rechargeable_cbm get_cbm_rechargeable_with( const item &it ) const; int get_acquirable_energy( const item &it, rechargeable_cbm cbm ) const; @@ -1898,7 +1899,6 @@ class Character : public Creature, public visitable * Recharge CBMs whenever possible. * @return true when recharging was successful. */ - bool feed_reactor_with( item &it ); bool feed_furnace_with( item &it ); bool fuel_bionic_with( item &it ); /** Used to apply stimulation modifications from food and medication **/ diff --git a/src/consumption.cpp b/src/consumption.cpp index eadee9875ef9..5bfb47fa0f53 100644 --- a/src/consumption.cpp +++ b/src/consumption.cpp @@ -55,10 +55,8 @@ static const skill_id skill_survival( "survival" ); static const mtype_id mon_player_blob( "mon_player_blob" ); -static const bionic_id bio_advreactor( "bio_advreactor" ); static const bionic_id bio_digestion( "bio_digestion" ); static const bionic_id bio_furnace( "bio_furnace" ); -static const bionic_id bio_reactor( "bio_reactor" ); static const bionic_id bio_syringe( "bio_syringe" ); static const bionic_id bio_taste_blocker( "bio_taste_blocker" ); @@ -1258,53 +1256,6 @@ bool Character::consume_effects( item &food ) return true; } -bool Character::can_feed_reactor_with( const item &it ) const -{ - static const std::set acceptable = {{ - ammotype( "reactor_slurry" ), - ammotype( "plutonium" ) - } - }; - - if( !it.is_ammo() || can_eat( it ).success() ) { - return false; - } - - if( !has_active_bionic( bio_reactor ) && !has_active_bionic( bio_advreactor ) ) { - return false; - } - - return std::any_of( acceptable.begin(), acceptable.end(), [ &it ]( const ammotype & elem ) { - return it.ammo_type() == elem; - } ); -} - -bool Character::feed_reactor_with( item &it ) -{ - if( !can_feed_reactor_with( it ) ) { - return false; - } - - const auto iter = plut_charges.find( it.typeId() ); - const int max_amount = iter != plut_charges.end() ? iter->second : 0; - const int amount = std::min( get_acquirable_energy( it, rechargeable_cbm::reactor ), max_amount ); - - if( amount >= PLUTONIUM_CHARGES * 10 && - !query_yn( _( "That is a LOT of plutonium. Are you sure you want that much?" ) ) ) { - return false; - } - - add_msg_player_or_npc( _( "You add your %s to your reactor's tank." ), - _( " pours %s into their reactor's tank." ), - it.tname() ); - - // TODO: Encapsulate - tank_plut += amount; - it.charges -= 1; - mod_moves( -250 ); - return true; -} - bool Character::can_feed_furnace_with( const item &it ) const { if( !it.flammable() || it.has_flag( flag_RADIOACTIVE ) || can_eat( it ).success() ) { @@ -1388,16 +1339,20 @@ bool Character::fuel_bionic_with( item &it ) } const bionic_id bio = get_most_efficient_bionic( get_bionic_fueled_with( it ) ); - - const int loadable = std::min( it.charges, get_fuel_capacity( it.typeId() ) ); const std::string str_loaded = get_value( it.typeId().str() ); + + const int fuel_multiplier = get_bionic_state( bio ).info().fuel_multiplier; + + int loadable = std::min( it.charges * fuel_multiplier, get_fuel_capacity( it.typeId() ) ); int loaded = 0; + if( !str_loaded.empty() ) { loaded = std::stoi( str_loaded ); } const std::string new_charge = std::to_string( loadable + loaded ); + loadable = std::ceil( loadable / fuel_multiplier ); it.charges -= loadable; // Type and amount of fuel set_value( it.typeId().str(), new_charge ); @@ -1415,10 +1370,6 @@ bool Character::fuel_bionic_with( item &it ) rechargeable_cbm Character::get_cbm_rechargeable_with( const item &it ) const { - if( can_feed_reactor_with( it ) ) { - return rechargeable_cbm::reactor; - } - if( can_feed_furnace_with( it ) ) { return rechargeable_cbm::furnace; } @@ -1560,7 +1511,6 @@ bool Character::consume_item( item &target ) } if( consume_med( comest ) || eat( comest ) || - feed_reactor_with( comest ) || feed_furnace_with( comest ) || fuel_bionic_with( comest ) ) { diff --git a/src/npcmove.cpp b/src/npcmove.cpp index a7816aab4453..353706afb2be 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -72,9 +72,6 @@ static const activity_id ACT_PULP( "ACT_PULP" ); -static const ammotype ammo_reactor_slurry( "reactor_slurry" ); -static const ammotype ammo_plutonium( "plutonium" ); - static const skill_id skill_firstaid( "firstaid" ); static const bionic_id bio_ads( "bio_ads" ); @@ -1725,18 +1722,6 @@ bool npc::recharge_cbm() } } - if( use_bionic_by_id( bio_reactor ) || use_bionic_by_id( bio_advreactor ) ) { - const std::function reactor_filter = []( const item & it ) { - return it.is_ammo() && ( it.ammo_type() == ammo_plutonium || - it.ammo_type() == ammo_reactor_slurry ); - }; - if( consume_cbm_items( reactor_filter ) ) { - return true; - } else { - complain_about( "need_radioactives", 3_hours, "", false ); - } - } - return false; } diff --git a/src/suffer.cpp b/src/suffer.cpp index 9d4f0bbfee00..faa9ef34403e 100644 --- a/src/suffer.cpp +++ b/src/suffer.cpp @@ -57,7 +57,6 @@ #include "units.h" #include "weather.h" -static const bionic_id bio_advreactor( "bio_advreactor" ); static const bionic_id bio_dis_acid( "bio_dis_acid" ); static const bionic_id bio_dis_shock( "bio_dis_shock" ); static const bionic_id bio_drain( "bio_drain" ); @@ -67,9 +66,10 @@ static const bionic_id bio_glowy( "bio_glowy" ); static const bionic_id bio_itchy( "bio_itchy" ); static const bionic_id bio_leaky( "bio_leaky" ); static const bionic_id bio_noise( "bio_noise" ); -static const bionic_id bio_plut_filter( "bio_plut_filter" ); static const bionic_id bio_power_weakness( "bio_power_weakness" ); static const bionic_id bio_reactor( "bio_reactor" ); +static const bionic_id bio_advreactor( "bio_advreactor" ); +static const bionic_id bio_reactoroverride( "bio_reactoroverride" ); static const bionic_id bio_shakes( "bio_shakes" ); static const bionic_id bio_sleepy( "bio_sleepy" ); static const bionic_id bio_spasm( "bio_spasm" ); @@ -1148,80 +1148,50 @@ void Character::suffer_from_radiation() mod_rad( -5 ); } - if( !reactor_plut && !tank_plut && !slow_rad ) { - return; - } - // Microreactor CBM and supporting bionics - if( has_bionic( bio_reactor ) || has_bionic( bio_advreactor ) ) { - //first do the filtering of plutonium from storage to reactor - if( tank_plut > 0 ) { - int plut_trans; - if( has_active_bionic( bio_plut_filter ) ) { - plut_trans = tank_plut * 0.025; - } else { - plut_trans = tank_plut * 0.005; + // Microreactor CBM + const itype_id &plut_cell = item( "plut_cell" ).typeId(); + if( get_fuel_type_available( plut_cell ) > 0 ) { + if( calendar::once_every( 60_minutes ) ) { + int rad_mod = 0; + rad_mod += has_bionic( bio_reactor ) ? 3 : 0; + rad_mod += has_bionic( bio_advreactor ) ? 2 : 0; + + if( rad_mod > 1 ) { + mod_rad( rad_mod ); } - if( plut_trans < 1 ) { - plut_trans = 1; + } + + bool powered_reactor = false; + + if( has_bionic( bio_reactor ) ) { + if( get_bionic_state( bio_reactor ).powered ) { + powered_reactor = true; + } else { + mod_power_level( 50_J ); } - tank_plut -= plut_trans; - reactor_plut += plut_trans; - } - //leaking radiation, reactor is unshielded, but still better than a simple tank - slow_rad += ( ( tank_plut * 0.1 ) + ( reactor_plut * 0.01 ) ); - //begin power generation - if( reactor_plut > 0 ) { - int power_gen = 0; - if( has_bionic( bio_advreactor ) ) { - if( ( reactor_plut * 0.05 ) > 2000 ) { - power_gen = 2000; - } else { - power_gen = reactor_plut * 0.05; - if( power_gen < 1 ) { - power_gen = 1; - } - } - slow_rad += ( power_gen * 3 ); - while( slow_rad >= 50 ) { - if( power_gen >= 1 ) { - slow_rad -= 50; - power_gen -= 1; - reactor_plut -= 1; - } else { - break; - } - } - } else if( has_bionic( bio_reactor ) ) { - if( ( reactor_plut * 0.025 ) > 500 ) { - power_gen = 500; - } else { - power_gen = reactor_plut * 0.025; - if( power_gen < 1 ) { - power_gen = 1; - } - } - slow_rad += ( power_gen * 3 ); + } + + if( has_bionic( bio_advreactor ) ) { + if( get_bionic_state( bio_advreactor ).powered ) { + powered_reactor = true; + } else { + mod_power_level( 100_J ); } - reactor_plut -= power_gen; - while( power_gen >= 250 ) { - apply_damage( nullptr, bodypart_id( "torso" ), 1 ); - mod_pain( 1 ); - add_msg_if_player( m_bad, - _( "Your chest burns as your power systems overload!" ) ); - mod_power_level( 50_kJ ); - power_gen -= 60; // ten units of power lost due to short-circuiting into you + } + + if( has_bionic( bio_reactoroverride ) && powered_reactor ) { + if( get_bionic_state( bio_reactoroverride ).powered ) { + int current_fuel_stock = std::stoi( get_value( plut_cell.str() ) ); + + current_fuel_stock -= 50; + + set_value( plut_cell.str(), std::to_string( current_fuel_stock ) ); + update_fuel_storage( plut_cell ); + + mod_power_level( 40_kJ ); + mod_rad( 2 ); } - mod_power_level( units::from_kilojoule( power_gen ) ); } - } else { - slow_rad += ( reactor_plut + tank_plut ) * 40; - //plutonium in body without any kind of container. Not good at all. - reactor_plut *= 0.6; - tank_plut *= 0.6; - } - while( slow_rad >= 1000 ) { - mod_rad( 1 ); - slow_rad -= 1000; } } diff --git a/tests/bionics_test.cpp b/tests/bionics_test.cpp index 90647e19cf62..97a65c2b26a3 100644 --- a/tests/bionics_test.cpp +++ b/tests/bionics_test.cpp @@ -71,26 +71,6 @@ TEST_CASE( "bionics", "[bionics] [item]" ) CHECK( !dummy.has_power() ); REQUIRE( dummy.has_max_power() ); - SECTION( "bio_advreactor" ) { - give_and_activate_bionic( dummy, bionic_id( "bio_advreactor" ) ); - - static const std::list always = { - "plut_cell", // solid - "plut_slurry" // uncontained liquid! not shown in game menu - }; - for( auto it : always ) { - test_consumable_charges( dummy, it, true, true ); - } - - static const std::list never = { - "light_atomic_battery_cell", // TOOLMOD, no ammo actually - "rm13_armor" // TOOL_ARMOR - }; - for( auto it : never ) { - test_consumable_ammo( dummy, it, false, false ); - } - } - SECTION( "bio_batteries" ) { give_and_activate_bionic( dummy, bionic_id( "bio_batteries" ) );