Skip to content

Commit

Permalink
Merge pull request #77447 from Night-Pryanik/cigarette-starts-fires
Browse files Browse the repository at this point in the history
Dropped lit cigarette won't start fires if there's no flammable terrain, furniture, or items on that tile
  • Loading branch information
Maleclypse authored Oct 30, 2024
2 parents 70cffec + 9f9b8d5 commit aad7acc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13396,10 +13396,17 @@ bool item::process_litcig( map &here, Character *carrier, const tripoint &pos )
// If not carried by someone, but laying on the ground:
if( item_counter % 5 == 0 ) {
// lit cigarette can start fires
if( here.flammable_items_at( pos ) ||
here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE, pos ) ||
here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE_ASH, pos ) ) {
here.add_field( pos, fd_fire, 1 );
for( const item &i : here.i_at( pos ) ) {
if( i.typeId() == typeId() ) {
if( here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE, pos ) ||
here.has_flag( ter_furn_flag::TFLAG_FLAMMABLE_ASH, pos ) ) {
here.add_field( pos, fd_fire, 1 );
break;
}
} else if( i.flammable( 0 ) ) {
here.add_field( pos, fd_fire, 1 );
break;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ std::optional<int> iuse::smoking( Character *p, item *it, const tripoint & )
p->use_charges_if_avail( itype_fire, 1 );
cig.active = true;
p->inv->add_item( cig, false, true );
p->add_msg_if_player( m_neutral, _( "You light a %s." ), cig.tname() );
p->add_msg_if_player( m_neutral, _( "You light a %s." ), it->tname() );

// Parting messages
if( it->typeId() == itype_joint ) {
Expand Down

0 comments on commit aad7acc

Please sign in to comment.