From a3164da11634993ffb0c614eafe42474412a0314 Mon Sep 17 00:00:00 2001 From: Vollch Date: Thu, 14 Sep 2023 18:03:04 +0300 Subject: [PATCH] Goo canister will correctly consume charges on use (#3138) --- src/iuse.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/iuse.cpp b/src/iuse.cpp index c5f48622ceb6..b5888d3586ba 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -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(); @@ -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( goop ) ) { @@ -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(); }