diff --git a/data/json/items/generic.json b/data/json/items/generic.json index 8ac168f0eb8d4..b44fef2d75389 100644 --- a/data/json/items/generic.json +++ b/data/json/items/generic.json @@ -57,6 +57,21 @@ "flags": [ "PSEUDO", "PERPETUAL" ], "fuel": { "energy": 1 } }, + { + "type": "GENERIC", + "//": "pseudo item, used as fuel type for CBMs that are sun-powered", + "id": "sunlight", + "symbol": "?", + "color": "white", + "name": "sun light", + "name_plural": "none", + "description": "seeing this is a bug", + "stackable": true, + "price": 0, + "volume": 0, + "flags": [ "PSEUDO", "PERPETUAL" ], + "fuel": { "energy": 1 } + }, { "type": "GENERIC", "//": "pseudo item, used as fuel type for CBMs that are metabolism-powered", diff --git a/data/mods/Aftershock/player/afs_bionics.json b/data/mods/Aftershock/player/afs_bionics.json index 1d9e4eb1b0882..528fd89c8095b 100644 --- a/data/mods/Aftershock/player/afs_bionics.json +++ b/data/mods/Aftershock/player/afs_bionics.json @@ -6,7 +6,10 @@ "name": "Solar Panels", "description": "Installed on your back is a set of retractable, reinforced solar panels resembling angular butterfly wings. When in direct sunlight, they will automatically deploy and slowly recharge your power level.", "occupied_bodyparts": [ [ "TORSO", 10 ] ], - "flags": [ "BIONIC_POWER_SOURCE" ] + "fuel_options": [ "sunlight" ], + "fuel_efficiency": 1.0, + "time": 1, + "flags": [ "BIONIC_POWER_SOURCE", "BIONIC_TOGGLED" ] }, { "id": "afs_bio_precision_solderers", diff --git a/src/bionics.cpp b/src/bionics.cpp index f273797c0bac9..3086fbd8357cd 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -859,12 +859,15 @@ bool Character::burn_fuel( int b, bool start ) //in the menu if( !start ) { for( const itype_id &fuel : fuel_available ) { - const int fuel_energy = item( fuel ).fuel_energy(); + const item &tmp_fuel = item( fuel ); + const int fuel_energy = tmp_fuel.fuel_energy(); int current_fuel_stock; if( is_metabolism_powered ) { current_fuel_stock = std::max( 0.0f, get_stored_kcal() - 0.8f * get_healthy_kcal() ); + } else if( tmp_fuel.has_flag( "PERPETUAL" ) ) { + current_fuel_stock = 1; } else { current_fuel_stock = std::stoi( get_value( fuel ) ); } @@ -887,6 +890,12 @@ bool Character::burn_fuel( int b, bool start ) const units::energy power_gain = kcal_consumed * 4184_J * fuel_efficiency; mod_stored_kcal( -kcal_consumed ); mod_power_level( power_gain ); + } else if( tmp_fuel.has_flag( "PERPETUAL" ) ) { + if( fuel == itype_id( "sunlight" ) ) { + const double modifier = g->natural_light_level( pos().z ) / default_daylight_level(); + add_msg( std::to_string( fuel_energy * modifier * fuel_efficiency ) ); + mod_power_level( units::from_kilojoule( fuel_energy ) * modifier * fuel_efficiency ); + } } else { current_fuel_stock -= 1; set_value( fuel, std::to_string( current_fuel_stock ) ); diff --git a/src/player.cpp b/src/player.cpp index bbd9d08718982..3e89b22a2894e 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -2871,12 +2871,6 @@ void player::update_needs( int rate_multiplier ) mod_painkiller( -std::min( get_painkiller(), rate_multiplier ) ); } - if( g->is_in_sunlight( pos() ) ) { - if( has_bionic( bn_bio_solar ) ) { - mod_power_level( units::from_kilojoule( rate_multiplier * 25 ) ); - } - } - // Huge folks take penalties for cramming themselves in vehicles if( in_vehicle && ( has_trait( trait_HUGE ) || has_trait( trait_HUGE_OK ) ) ) { vehicle *veh = veh_pointer_or_null( g->m.veh_at( pos() ) );