jukebox
Jukebox datum
Plays music to nearby mobs when hosted in a movable or a turf.
Vars | |
active_song_sound | Current song datum playing |
---|---|
listeners | Assoc list of all mobs listening to the jukebox to their sound status. |
parent | Atom that hosts the jukebox. Can be a turf or a movable. |
requires_range_check | Whether the jukebox requires a connect_range component to check for new listeners |
selection | Current song track selected |
songs | List of /datum/tracks we can play. Set via get_songs(). |
sound_loops | Whether the music loops when done. If FALSE, you must handle ending music yourself. |
sound_range | Range at which the sound plays to players, can also be a view "XxY" string |
volume | Volume of the songs played. Also serves as the max volume. Do not set directly, use set_new_volume() instead. |
x_cutoff | How far away horizontally from the jukebox can you be before you stop hearing it |
z_cutoff | How far away vertically from the jukebox can you be before you stop hearing it |
Procs | |
check_new_listener | Check for new mobs entering the jukebox's range. |
deregister_listener | Deregisters the passed mob as a listener to the jukebox, stopping the music. |
get_active_listeners | Helper to get all mobs currently, ACTIVELY listening to the jukebox. |
get_ui_data | Returns a set of general data relating to the jukebox for use in TGUI. |
init_songs | Initializes the track list. |
listener_deaf | Updates the sound's mute status when the mob's deafness updates. |
listener_deleted | Deregisters mobs on deletion. |
listener_login | Allows mobs who are clientless when the music starts to hear it when they log in. |
listener_moved | Updates the sound's position on mob movement. |
load_songs_from_config | Loads the config sounds once, and returns a copy of them. |
on_enter_area | When the jukebox enters a new area entirely, we need to update the environment to the new area's. |
on_moved | When the jukebox moves, we need to update all listeners. |
parent_delete | When our parent is deleted, we should go too. |
register_listener | Registers the passed mob as a new listener to the jukebox. |
set_new_environment | Sets the sound's environment to a new value. Then updates any mobs listening to it. |
set_new_volume | Sets the sound's volume to a new value. Then updates any mobs listening to it. |
set_sound_range | Sets the sound's range to a new value. This can be a number or a view size string "XxY". Then updates any mobs listening to it. |
set_volume_to_max | Sets volume to the maximum possible value, the initial volume value. |
start_music | Helper to kickstart the music for all mobs in hearing range of the jukebox. |
unlisten_all | Helper to stop the music for all mobs listening to the music. |
unmute_listener | Unmutes the passed mob's sound from the passed reason. |
update_all | Helper to update all mobs currently listening to the music. |
update_listener | Updates the passed mob's sound in according to their position and status. |
Var Details
active_song_sound
Current song datum playing
listeners
Assoc list of all mobs listening to the jukebox to their sound status.
parent
Atom that hosts the jukebox. Can be a turf or a movable.
requires_range_check
Whether the jukebox requires a connect_range component to check for new listeners
selection
Current song track selected
songs
List of /datum/tracks we can play. Set via get_songs().
sound_loops
Whether the music loops when done. If FALSE, you must handle ending music yourself.
sound_range
Range at which the sound plays to players, can also be a view "XxY" string
volume
Volume of the songs played. Also serves as the max volume. Do not set directly, use set_new_volume() instead.
x_cutoff
How far away horizontally from the jukebox can you be before you stop hearing it
z_cutoff
How far away vertically from the jukebox can you be before you stop hearing it
Proc Details
check_new_listener
Check for new mobs entering the jukebox's range.
deregister_listener
Deregisters the passed mob as a listener to the jukebox, stopping the music.
get_active_listeners
Helper to get all mobs currently, ACTIVELY listening to the jukebox.
get_ui_data
Returns a set of general data relating to the jukebox for use in TGUI.
Returns
- A list of UI data
init_songs
Initializes the track list.
By default, this loads all tracks from the config datum.
Returns
- An assoc list of track names to /datum/track. Track names must be unique.
listener_deaf
Updates the sound's mute status when the mob's deafness updates.
listener_deleted
Deregisters mobs on deletion.
listener_login
Allows mobs who are clientless when the music starts to hear it when they log in.
listener_moved
Updates the sound's position on mob movement.
load_songs_from_config
Loads the config sounds once, and returns a copy of them.
on_enter_area
When the jukebox enters a new area entirely, we need to update the environment to the new area's.
on_moved
When the jukebox moves, we need to update all listeners.
parent_delete
When our parent is deleted, we should go too.
register_listener
Registers the passed mob as a new listener to the jukebox.
set_new_environment
Sets the sound's environment to a new value. Then updates any mobs listening to it.
set_new_volume
Sets the sound's volume to a new value. Then updates any mobs listening to it.
set_sound_range
Sets the sound's range to a new value. This can be a number or a view size string "XxY". Then updates any mobs listening to it.
set_volume_to_max
Sets volume to the maximum possible value, the initial volume value.
start_music
Helper to kickstart the music for all mobs in hearing range of the jukebox.
unlisten_all
Helper to stop the music for all mobs listening to the music.
unmute_listener
Unmutes the passed mob's sound from the passed reason.
Arguments
- mob/listener - The mob to unmute.
- reason - The reason to unmute them for. Can be a combination of MUTE_DEAF, MUTE_PREF, MUTE_RANGE.
update_all
Helper to update all mobs currently listening to the music.
update_listener
Updates the passed mob's sound in according to their position and status.