Files
fulpstation/code/__HELPERS/radio.dm
SomethingFish 6280f5cca0 November TGU (#846)
* this just fixes the dme its still pretty unfinished

* fixes bloodsuckers (and some silence stuff)

* fixed costumes and beefman its time to TEST

* fixes some stuff

* ITS DONE (?)

* it wasnt done.

* THE THINGS ARE FIXED RAAAAAAAAAAAAAH

* me when i have to FIX MAPS

* jk actually fixes the maps this time i promise

* i think this probably fixes the screenshots maybe

* it should work now (i hope)

* i think this dependency is helpful

* how

* please fix some of the errors

* fucked up the dio stand pathing

* tgedit for the simple animal freeze test

* lets see if this works

* fixed the merge conflict

* i think thats it?

* there are. a few new unit tests.

* THE NEW UNIT TESTS BROKE EVERYTHING

* fixes all this dumb shit

soooooy quien soyyyy no preciso identifiiiicación

* prison radio be gone

* brings back helio sec (lol)

* mobs aren't used anywhere anymore kill them

* fixes screenshots

* NOTHING BUT SCRAP

* whoops haha silly me

rewrites a few keys to fix corruption

* gives felinids brain damage (SPEEDMERGE)

* welcome to fulpstation

Co-authored-by: SgtHunk <68669754+SgtHunk@users.noreply.github.com>
2022-11-25 00:51:07 -03:00

36 lines
1.3 KiB
Plaintext

/// Ensure the frequency is within bounds of what it should be sending/receiving at
/proc/sanitize_frequency(frequency, free = FALSE, syndie = 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
if(. == FREQ_SYNDICATE && !syndie) // Prevents people from picking (or rounding up) into the syndie frequency
. = FREQ_COMMON
/// 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
///returns a random unused frequency between MIN_FREE_FREQ & MAX_FREE_FREQ if free = TRUE, and MIN_FREQ & MAX_FREQ if FALSE
/proc/return_unused_frequency(free = FALSE)
var/start = free ? MIN_FREE_FREQ : MIN_FREQ
var/end = free ? MAX_FREE_FREQ : MAX_FREQ
var/freq_to_check = 0
do
freq_to_check = rand(start, end)
if(!(freq_to_check % 2)) // Ensure the last digit is an odd number
freq_to_check++
while((freq_to_check == 0) || ("[freq_to_check]" in GLOB.reverseradiochannels))
return freq_to_check