Skip to content

Commit

Permalink
Fix consume bugs (CleverRaven#40975)
Browse files Browse the repository at this point in the history
* fixes water heater issue
* consume, remove ability to consume crafts and fix consuming liquids
  • Loading branch information
Ramza13 authored May 31, 2020
1 parent 62ef415 commit 61a8f11
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,9 @@ time_duration Character::get_consume_time( const item &it )
{
const int charges = std::max( it.charges, 1 );
int volume = units::to_milliliter( it.volume() ) / charges;
if( 0 == volume && it.type ) {
volume = units::to_milliliter( it.type->volume );
}
time_duration time = time_duration::from_seconds( std::max( ( volume /
5 ), 1 ) ); //Default 5 mL (1 tablespoon) per second
float consume_time_modifier = 1;//only for food and drinks
Expand Down
2 changes: 1 addition & 1 deletion src/crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ bool player::check_eligible_containers_for_crafting( const recipe &rec, int batc

if( charges_to_store > 0 ) {
if( !query_yn(
_( "You don't have anything in which to store %s and may have to pour it out or consume it as soon as it is prepared! Proceed?" ),
_( "You don't have anything in which to store %s and may have to pour it out as soon as it is prepared! Proceed?" ),
prod.tname() ) ) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/handle_liquid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ static bool get_liquid_target( item &liquid, item *const source, const int radiu
menu.text = string_format( pgettext( "liquid", "What to do with the %s?" ), liquid_name );
}
std::vector<std::function<void()>> actions;

if( g->u.can_consume( liquid ) && !source_mon ) {
if( g->u.can_consume( liquid ) && !source_mon && ( source_veh || source_pos ) ) {
if( g->u.can_consume_for_bionic( liquid ) ) {
menu.addentry( -1, true, 'e', _( "Fuel bionic with it" ) );
} else {
Expand Down Expand Up @@ -334,6 +333,7 @@ static bool perform_liquid_transfer( item &liquid, const tripoint *const source_
switch( target.dest_opt ) {
case LD_CONSUME:
g->u.assign_activity( player_activity( consume_activity_actor( liquid, false ) ) );
liquid.charges--;
transfer_ok = true;
break;
case LD_ITEM: {
Expand Down
1 change: 1 addition & 0 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3186,6 +3186,7 @@ void iexamine::keg( player &p, const tripoint &examp )
return; // They didn't actually drink
}
p.assign_activity( player_activity( consume_activity_actor( drink, false ) ) );
drink.charges--;
if( drink.charges == 0 ) {
add_msg( _( "You squeeze the last drops of %1$s from the %2$s." ),
drink_tname, keg_name );
Expand Down

0 comments on commit 61a8f11

Please sign in to comment.