Skip to content

Commit

Permalink
Merge pull request #78432 from AlexMooney/dont_waste_weld_gas
Browse files Browse the repository at this point in the history
Prompt before oxytorch activity if you don't have enough gas
  • Loading branch information
Anton Burmistrov authored Dec 13, 2024
2 parents defbfc6 + e9fd1c4 commit a1306e0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5390,7 +5390,7 @@ std::unique_ptr<activity_actor> disassemble_activity_actor::deserialize( JsonVal
return actor.clone();
}

void oxytorch_activity_actor::start( player_activity &act, Character &/*who*/ )
void oxytorch_activity_actor::start( player_activity &act, Character &who )
{
const map &here = get_map();

Expand Down Expand Up @@ -5421,9 +5421,18 @@ void oxytorch_activity_actor::start( player_activity &act, Character &/*who*/ )
act.set_to_null();
return;
}

add_msg_debug( debugmode::DF_ACTIVITY, "%s moves_total: %d", act.id().str(), act.moves_total );
act.moves_left = act.moves_total;
if( tool->ammo_sufficient( &who, act.moves_total / 100 ) ||
query_yn(
_( "Your %1$s doesn't have enough charges to complete the job. Continue anyway?" ), tool->tname()
) ||
test_mode // In the tests, we want to check that the activity can be resumed.
) {
add_msg_debug( debugmode::DF_ACTIVITY, "%s moves_total: %d", act.id().str(), act.moves_total );
act.moves_left = act.moves_total;
} else {
act.set_to_null();
return;
}
}

void oxytorch_activity_actor::do_turn( player_activity &/*act*/, Character &who )
Expand Down

0 comments on commit a1306e0

Please sign in to comment.