#!/usr/bin/env bash
#
# How kindly a telephone is scored, in semitones, when phone-scoring is on.
#
# Numbers as words because a request may only ever carry one word (machine.py),
# and four of them because the game's own scale stops at two: `one` is what it
# calls Medium and is no help at all, `two` is its Easy, and three and four are
# past anything upstream offers - which a room full of telephones may well
# want, and which is a thing to settle by singing rather than by arguing.
#
# Nothing restarts: the microphone bridge reads this within a second, and it
# never changes what a song already in progress is being scored by.

set -euo pipefail
ARCHSTAR_ACTIONS_LIB="${ARCHSTAR_ACTIONS_LIB:-/usr/lib/archstar-actions/lib/common.sh}"
# shellcheck source=/dev/null
source "${ARCHSTAR_ACTIONS_LIB}"

value="${1:-}"
require_one_of "${value}" one two three four

remember_setting phone-tolerance "${value}"

printf 'a telephone is scored within %s semitone(s) of the note\n' "${value}"
