Skip to content

Commit

Permalink
Goo canister will correctly consume charges on use (#3138)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vollch authored Sep 14, 2023
1 parent 44e46b5 commit a3164da
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3437,7 +3437,6 @@ int iuse::teleport( player *p, item *it, bool, const tripoint & )

int iuse::can_goo( player *p, item *it, bool, const tripoint & )
{
it->convert( itype_canister_empty );
int tries = 0;
tripoint goop;
goop.z = p->posz();
Expand All @@ -3447,6 +3446,7 @@ int iuse::can_goo( player *p, item *it, bool, const tripoint & )
tries++;
} while( g->m.impassable( goop ) && tries < 10 );
if( tries == 10 ) {
add_msg( _( "Nothing happens." ) );
return 0;
}
if( monster *const mon_ptr = g->critter_at<monster>( goop ) ) {
Expand Down Expand Up @@ -3481,10 +3481,13 @@ int iuse::can_goo( player *p, item *it, bool, const tripoint & )
add_msg( m_warning, _( "A nearby splatter of goo forms into a goo pit." ) );
}
g->m.trap_set( goop, tr_goo );
} else {
return 0;
}
}
if( it->charges <= it->type->charges_to_use() ) {
it->charges = 0;
it->convert( itype_canister_empty );
return 0;
}
return it->type->charges_to_use();
}

Expand Down

0 comments on commit a3164da

Please sign in to comment.