Skip to content

Commit

Permalink
Reworks and Reintroduced Micro Reactor & Radiation Scrubber CBM's (ca…
Browse files Browse the repository at this point in the history
…taclysmbnteam#2663)

* stops NPC using reactor override, reduces ractor override to 2 rads a turn & unused varrible cleaning

* reduces passive power gen from 500J & 1kJ to 50J & 100J
  • Loading branch information
MrLostman authored Apr 30, 2023
1 parent e6a94df commit b9c4282
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 266 deletions.
48 changes: 46 additions & 2 deletions data/json/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 7 additions & 3 deletions data/json/itemgroups/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
]
},
{
Expand Down Expand Up @@ -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 ]
]
},
{
Expand Down Expand Up @@ -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 ]
]
},
{
Expand Down
38 changes: 38 additions & 0 deletions data/json/items/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
39 changes: 0 additions & 39 deletions data/json/obsoletion/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
39 changes: 0 additions & 39 deletions data/json/obsoletion/uncategorized.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
31 changes: 12 additions & 19 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ) ) {
Expand Down Expand Up @@ -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<item *> cables = items_with( []( const item & it ) {
return it.has_flag( flag_CABLE_SPOOL );
Expand Down Expand Up @@ -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 );
}
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/bionics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down
9 changes: 9 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,15 @@ std::vector<itype_id> 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;
Expand Down
4 changes: 2 additions & 2 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,8 @@ class Character : public Creature, public visitable<Character>
/**Return list of available fuel for this bionic*/
std::vector<itype_id> 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;
Expand Down Expand Up @@ -1888,7 +1890,6 @@ class Character : public Creature, public visitable<Character>
*/
ret_val<edible_rating> 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;
Expand All @@ -1898,7 +1899,6 @@ class Character : public Creature, public visitable<Character>
* 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 **/
Expand Down
Loading

0 comments on commit b9c4282

Please sign in to comment.