ItemRadio is the base class for radios: items that let the character who keeps one in
their hotbar speak and listen on a frequency.
A radio can be turned on and off and retuned through its item menu. A derived item may
set frequency, the frequency its instances are tuned to until a player changes it
(100.1 by default).
Summary
Methods
change_frequency(actor)shared
Asks the player to enter a new frequency for the radio.
get_frequency()shared
Returns the frequency the radio is tuned to.
is_enabled()shared
Checks whether the radio is turned on.
on_toggle(_actor)shared
Turns the radio on or off.
set_frequency(frequency)shared
Tunes the radio to a frequency and plays the tuning sound.
Methods
Asks the player to enter a new frequency for the radio. Called on the server when the
frequency button of the item menu is pressed; the answer is checked by
Communications.tune_radio before the radio is retuned.
Parameters
- actor Player player changing the frequency
Returns the frequency the radio is tuned to.
Returns
- Number frequency, the item's default or 100.1 if it was never set
Checks whether the radio is turned on.
Returns
- Boolean whether the radio is enabled, true by default
Turns the radio on or off.
Parameters
- _actor Player player toggling the radio
Tunes the radio to a frequency and plays the tuning sound.
Parameters
- frequency Number new frequency