mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-09 07:48:55 +00:00
20 lines
637 B
Plaintext
20 lines
637 B
Plaintext
// Ensure the frequency is within bounds of what it should be sending/receiving at
|
|
/proc/sanitize_frequency(frequency, free = FALSE)
|
|
frequency = round(frequency)
|
|
if(free)
|
|
. = CLAMP(frequency, MIN_FREE_FREQ, MAX_FREE_FREQ)
|
|
else
|
|
. = CLAMP(frequency, MIN_FREQ, MAX_FREQ)
|
|
if(!(. % 2)) // Ensure the last digit is an odd number
|
|
. += 1
|
|
|
|
// Format frequency by moving the decimal.
|
|
/proc/format_frequency(frequency)
|
|
frequency = text2num(frequency)
|
|
return "[round(frequency / 10)].[frequency % 10]"
|
|
|
|
//Opposite of format, returns as a number
|
|
/proc/unformat_frequency(frequency)
|
|
frequency = text2num(frequency)
|
|
return frequency * 10
|