Decl Music and Ported Music + Licenses (#8221)

* Decl music + ported music

* Bugfixes and not

* unit test

* debug shit + some fixes

* More Changes

* Removes some unused/extra songs in case it was a file size issue

* Nuke crash-prone songs

* Add cynosure defines

* It Just Works Now + Finished Headphone code/sprites

* requested tweaks/debug removal

* recheck dme
This commit is contained in:
Cerebulon
2022-03-13 03:45:36 +00:00
committed by GitHub
parent 65db4f5a98
commit 474a8c43cf
62 changed files with 662 additions and 98 deletions

View File

@@ -28,8 +28,6 @@ SUBSYSTEM_DEF(ticker)
var/last_restart_notify // world.time of last restart warning.
var/delay_end = FALSE // If set, the round will not restart on its own.
var/login_music // music played in pregame lobby
var/list/datum/mind/minds = list() // The people in the game. Used for objective tracking.
// TODO - I am sure there is a better place these can go.
@@ -51,15 +49,6 @@ SUBSYSTEM_DEF(ticker)
var/global/datum/controller/subsystem/ticker/ticker
/datum/controller/subsystem/ticker/PreInit()
global.ticker = src // TODO - Remove this! Change everything to point at SSticker intead
login_music = pick(\
/*'sound/music/halloween/skeletons.ogg',\
'sound/music/halloween/halloween.ogg',\
'sound/music/halloween/ghosts.ogg'*/
'sound/music/space.ogg',\
'sound/music/traitor.ogg',\
'sound/music/title2.ogg',\
'sound/music/clouds.s3m',\
'sound/music/space_oddity.ogg') //Ground Control to Major Tom, this song is cool, what's going on?
/datum/controller/subsystem/ticker/Initialize()
pregame_timeleft = config.pregame_time

View File

@@ -0,0 +1,25 @@
/decl/music_track
var/artist
var/title
var/album
var/decl/license/license
var/song
var/url // Remember to include http:// or https:// or BYOND will be sad
var/volume = 70
/decl/music_track/Initialize()
. = ..()
license = GET_DECL(license)
/decl/music_track/proc/play_to(var/listener)
to_chat(listener, "<span class='good'>Now Playing:</span>")
to_chat(listener, "<span class='good'>[title][artist ? " by [artist]" : ""][album ? " ([album])" : ""]</span>")
if(url)
to_chat(listener, url)
to_chat(listener, "<span class='good'>License: <a href='[license.url]'>[license.name]</a></span>")
listener << sound(song, repeat = 1, wait = 0, volume = volume, channel = 1)
// No VV editing anything about music tracks
/decl/music_track/VV_static()
return ..() + vars

View File

@@ -0,0 +1,295 @@
/datum/track
var/title
var/track
/datum/track/New(_title, _track)
title = _title
track = _track
/datum/track/proc/GetTrack()
if(ispath(track, /decl/music_track))
var/decl/music_track/music_track = GET_DECL(track)
return music_track.song
return track // Allows admins to continue their adminbus simply by overriding the track var
//Track List
/decl/music_track/absconditus
artist = "Zhay Tee"
title = "Absconditus"
album = "Minerva: Metastasis OST"
song = 'sound/music/traitor.ogg'
license = /decl/license/cc_by_nc_sa_3_0
url = "https://bandcamp.zhaytee.net/track/absconditus"
/decl/music_track/ambispace
artist = "Alstroemeria Records"
title = "Bad Apple!! (slowed down)"
song = 'sound/ambience/ambispace.ogg'
license = /decl/license/grandfathered
/decl/music_track/chasing_time
artist = "Dexter Britain"
title = "Chasing Time"
album = "Creative Commons Vol. 1"
song = 'sound/music/chasing_time.ogg'
license = /decl/license/cc_by_nc_sa_3_0
url = "http://www.dexterbritain.co.uk"
/decl/music_track/clouds_of_fire
artist = "Hector/dMk"
title = "Clouds of Fire"
song = 'sound/music/clouds.s3m'
license = /decl/license/grandfathered
url = "https://modarchive.org/index.php?request=view_by_moduleid&query=73980"
/decl/music_track/comet_haley
artist = "Stellardrone"
title = "Comet Halley"
album = "Light Years"
song = 'sound/music/comet_haley.ogg'
license = /decl/license/cc_by_3_0
url = "http://freemusicarchive.org/music/Stellardrone/Light_Years_1227/07_Comet_Halley"
/decl/music_track/df_theme
artist = "Beyond Quality"
title = "Dwarf Fortress Main Theme"
song = 'sound/ambience/song_game.ogg'
license = /decl/license/grandfathered
/decl/music_track/digit_one
artist = "Kelly Bailey"
title = "Half-Life 2 - Tracking Device"
song = 'sound/music/1.ogg'
license = /decl/license/grandfathered
/decl/music_track/dilbert
title = "Robocop.mp3"
album = "Dehumanize Yourself and Face to Bloodshed"
artist = "CBoyardee"
song = 'sound/music/title2.ogg'
license = /decl/license/grandfathered
/decl/music_track/elibao
artist = "Earthcrusher"
title = "Every Light is Blinking at Once"
song = 'sound/music/elibao.ogg'
license = /decl/license/cc_by_nc_sa_3_0
url = "https://soundcloud.com/alexanderdivine/every-light-is-blinking-at-once"
/decl/music_track/endless_space
artist = "SolusLunes"
title = "Endless Space"
song = 'sound/music/space.ogg'
license = /decl/license/cc_by_3_0
url = "https://www.newgrounds.com/audio/listen/67583"
/decl/music_track/epicintro2015
artist = "Sascha Ende"
title = "Epic Intro 2015"
song = 'sound/music/epic2015.ogg'
license = /decl/license/cc_by_4_0
url = "https://filmmusic.io/song/323-epic-intro-2015/"
/decl/music_track/floating
artist = "Floating"
title = "Unknown"
song = 'sound/music/main.ogg'
license = /decl/license/grandfathered
/decl/music_track/hull_rupture
artist = "Mikazu"
title = "Hull Rupture"
song = 'sound/music/hull_rupture.ogg'
license = /decl/license/cc_by_nc_3_0
url = "https://soundcloud.com/mikazu-1/baystation-12-hull-rupture"
/decl/music_track/human
artist = "Borrtex"
title = "Human"
album = "Creation"
song = 'sound/music/human.ogg'
license = /decl/license/cc_by_nc_3_0
url = "http://freemusicarchive.org/music/Borrtex/Creation/Borrtex_11_Human"
/decl/music_track/lasers
artist = "Earthcrusher"
title = "Lasers Rip Apart The Bulkhead"
song = 'sound/music/lasers_rip_apart_the_bulkhead.ogg'
license = /decl/license/cc_by_nc_sa_3_0
url = "https://soundcloud.com/alexanderdivine/lasers-rip-apart-the-bulkhead"
/decl/music_track/level3_mod
artist = "X-CEED"
title = "Flip-Flap"
song = 'sound/music/title1.ogg'
license = /decl/license/grandfathered
url = "https://aminet.net/package/mods/xceed/Flipflap"
/decl/music_track/marhaba
artist = "Ian Alex Mac"
title = "Marhaba"
album = "Cues"
song = 'sound/music/marhaba.ogg'
license = /decl/license/cc_by_3_0
url = "http://freemusicarchive.org/music/Ian_Alex_Mac/Cues/Marhaba"
/decl/music_track/lysendraa
artist = "TALES"
title = "Memories Of Lysendraa"
album = "The Seskian Wars"
song = 'sound/music/lysendraa.ogg'
license = /decl/license/cc_by_nc_nd_4_0
url = "http://freemusicarchive.org/music/TALES/The_Seskian_Wars/8-Memories_Of_Lysendraa"
/decl/music_track/misanthropic_corridors
artist = "Mikazu"
title = "Misanthropic Corridors"
song = 'sound/music/misanthropic_corridors.ogg'
license = /decl/license/cc_by_sa_3_0
url = "https://soundcloud.com/mikazu-1/baystation-12-misanthropic-corridors"
/decl/music_track/one_loop
artist = "Swedish House Mafia"
title = "One (abridged loop)"
song = 'sound/misc/TestLoop1.ogg'
license = /decl/license/grandfathered
/decl/music_track/pwmur
artist = "Earthcrusher"
title = "Phoron will make us rich"
song = 'sound/music/pwmur.ogg'
license = /decl/license/cc_by_nc_sa_3_0
url = "https://soundcloud.com/alexanderdivine/phoron-will-make-us-rich"
/decl/music_track/rimward_cruise
artist = "Mikazu"
title = "Rimward Cruise"
song = 'sound/music/rimward_cruise.ogg'
license = /decl/license/cc_by_sa_3_0
url = "https://soundcloud.com/mikazu-1/baystation-12-rimward-cruise"
/decl/music_track/salutjohn
artist = "Quimorucru"
title = "Salut John"
song = 'sound/music/salutjohn.ogg'
album = "Un m<>chant party"
license = /decl/license/cc_by_nc_nd_4_0
url = "http://freemusicarchive.org/music/Quimorucru/Un_mchant_party/Quimorucru_-_Un_mchant_party__Compilation__-_20_Salut_John"
/decl/music_track/space_oddity
artist = "Chris Hadfield"
title = "Space Oddity"
song = 'sound/music/space_oddity.ogg'
license = /decl/license/grandfathered
/decl/music_track/thunderdome
artist = "MashedByMachines"
title = "THUNDERDOME (a.k.a. -Sector11)"
song = 'sound/music/THUNDERDOME.ogg'
license = /decl/license/cc_by_nc_sa_3_0
url = "https://www.newgrounds.com/audio/listen/312622"
/decl/music_track/treacherous_voyage
artist = "Jon Luc Hefferman"
title = "Treacherous Voyage"
album = "Eilean Mor"
song = 'sound/music/treacherous_voyage.ogg'
license = /decl/license/cc_by_nc_3_0
url = "http://freemusicarchive.org/music/Jon_Luc_Hefferman/20170730112628534/Treacherous_Voyage"
/decl/music_track/voidsent
artist = "Mikazu"
title = "Voidsent"
song = 'sound/music/voidsent.ogg'
license = /decl/license/cc_by_sa_3_0
url = "https://soundcloud.com/mikazu-1/baystation-12-voidsent"
/decl/music_track/wake
artist = "Ryan Little"
title = "Wake"
song = 'sound/music/wake.ogg'
license = /decl/license/cc_by_nc_nd_4_0
url = "http://freemusicarchive.org/music/Ryan_Little/~/Ryan_Little_-_Wake"
/decl/music_track/inorbit
artist = "Chronox"
title = "In Orbit"
song = 'sound/music/europa/Chronox_-_03_-_In_Orbit.ogg'
license = /decl/license/cc_by_4_0
url = "freemusicarchive.org/music/Chronox_2/Voyager/Chronox_-_02_-_In_Orbit"
/decl/music_track/martiancowboy
artist = "Kevin MacLeod"
title = "Martian Cowboy"
song = 'sound/music/europa/Martian Cowboy.ogg'
license = /decl/license/cc_by_3_0
url = "https://incompetech.com/music/royalty-free/index.html?isrc=usuan1100349"
/decl/music_track/monument
artist = "Six Umbrellas"
title = "Monument"
song = 'sound/music/europa/Six_Umbrellas_-_05_-_Monument.ogg'
license = /decl/license/cc_by_sa_4_0
url = "https://sixumbrellas.bandcamp.com/album/the-psychedelic-and"
/decl/music_track/asfarasitgets
artist = "A Drop A Day"
title = "As Far As It Gets"
song = 'sound/music/europa/asfarasitgets.ogg'
license = /decl/license/cc_by_sa_4_0
url = "https://ghyti.bandcamp.com/"
/decl/music_track/eighties
artist = "A Drop A Day"
title = "80s All Over Again"
song = 'sound/music/europa/80salloveragain.ogg'
license = /decl/license/cc_by_sa_4_0
url = "https://ghyti.bandcamp.com/"
/decl/music_track/wildencounters
artist = "A Drop A Day"
title = "Wild Encounters"
song = 'sound/music/europa/WildEncounters.ogg'
license = /decl/license/cc_by_sa_4_0
url = "https://ghyti.bandcamp.com/"
/decl/music_track/torn
artist = "Macamoto"
title = "Torn"
song = 'sound/music/europa/Macamoto_-_05_-_Torn.ogg'
license = /decl/license/cc_by_nc_sa_3_0
url = "https://macamoto.bandcamp.com/track/torn"
/decl/music_track/nebula
artist = "Pulse Emitter"
title = "Nebula"
song = 'sound/music/europa/Pulse_Emitter_-_04_-_Nebula.ogg'
license = /decl/license/cc_by_nc_sa_3_0
url = "https://pulseemitter.bandcamp.com/track/nebula"
/decl/music_track/stellartransit
artist = "Serithi"
title = "Stellar Transit"
song = 'sound/ambience/space/space_serithi.ogg'
license = /decl/license/cc_by_sa_3_0
url = "https://www.byond.com/members/Serithi"
/decl/music_track/clown
artist = "Unknown"
title = "Clown"
song = 'sound/music/clown.ogg'
license = /decl/license/grandfathered
/decl/music_track/spaceasshole
artist = "Chris Remo"
title = "Space Asshole"
song = 'sound/music/space_asshole.ogg'
license = /decl/license/grandfathered
url = "https://idlethumbs.bandcamp.com/"
/decl/music_track/russianrapdisco
artist = "Unknown"
title = "Russkiy rep Diskoteka"
song = 'sound/music/russianrapdisco.ogg'
license = /decl/license/grandfathered

View File

@@ -0,0 +1,54 @@
GLOBAL_LIST_INIT(music_tracks, list(
"Beyond" = /decl/music_track/ambispace,
"Clouds of Fire" = /decl/music_track/clouds_of_fire,
"Stage Three" = /decl/music_track/dilbert,
"Asteroids" = /decl/music_track/df_theme,
"Floating" = /decl/music_track/floating,
"Endless Space" = /decl/music_track/endless_space,
"Fleet Party Theme" = /decl/music_track/one_loop,
"Scratch" = /decl/music_track/level3_mod,
"Absconditus" = /decl/music_track/absconditus,
"Lasers Rip Apart the Bulkhead" = /decl/music_track/lasers,
"Maschine Klash" = /decl/music_track/digit_one,
"Comet Halley" = /decl/music_track/comet_haley,
"Human" = /decl/music_track/human,
"Memories of Lysendraa" = /decl/music_track/lysendraa,
"Marhaba" = /decl/music_track/marhaba,
"Space Oddity" = /decl/music_track/space_oddity,
"Treacherous Voyage" = /decl/music_track/treacherous_voyage,
"Wake" = /decl/music_track/wake,
"Phoron Will Make Us Rich" = /decl/music_track/pwmur,
"Every Light is Blinking at Once" = /decl/music_track/elibao,
"In Orbit" = /decl/music_track/inorbit,
"Martian Cowboy" = /decl/music_track/martiancowboy,
"Monument" = /decl/music_track/monument,
"As Far As It Gets" = /decl/music_track/asfarasitgets,
"80s All Over Again" = /decl/music_track/eighties,
"Wild Encounters" = /decl/music_track/wildencounters,
"Torn" = /decl/music_track/torn,
"Nebula" = /decl/music_track/nebula,
"Stellar Transit" = /decl/music_track/stellartransit
))
GLOBAL_LIST_INIT(jukebox_secret_tracks, list(
"Clown" = /decl/music_track/clown,
"THUNDERDOME" = /decl/music_track/thunderdome,
"Space Asshole" = /decl/music_track/spaceasshole,
"Russkiy rep Diskoteka" = /decl/music_track/russianrapdisco,
))
/proc/setup_music_tracks(var/list/tracks)
. = list()
var/track_list = LAZYLEN(tracks) ? tracks : GLOB.music_tracks
for(var/track_name in track_list)
var/track_path = track_list[track_name]
. += new/datum/track(track_name, track_path)
/proc/setup_secret_music_tracks(var/list/tracks)
. = list()
var/track_list = LAZYLEN(tracks) ? tracks : GLOB.jukebox_secret_tracks
for(var/track_name in track_list)
var/track_path = track_list[track_name]
. += new/datum/track(track_name, track_path)

View File

@@ -0,0 +1,37 @@
/decl/license
var/name
var/url
var/attribution_mandatory = TRUE
/decl/license/cc_by_3_0
name = "CC BY 3.0"
url = "https://creativecommons.org/licenses/by/3.0/"
/decl/license/cc_by_4_0
name = "CC BY 4.0"
url = "https://creativecommons.org/licenses/by/4.0/"
/decl/license/cc_by_sa_4_0
name = "CC BY-SA 4.0"
url = "https://creativecommons.org/licenses/by-sa/4.0/"
/decl/license/cc_by_nc_3_0
name = "CC BY-BC 3.0"
url = "https://creativecommons.org/licenses/by-nc/3.0/"
/decl/license/cc_by_sa_3_0
name = "CC BY-SA 3.0"
url = "https://creativecommons.org/licenses/by-sa/3.0/"
/decl/license/cc_by_nc_sa_3_0
name = "CC BY-NC-SA 3.0"
url = "https://creativecommons.org/licenses/by-nc-sa/3.0/"
/decl/license/cc_by_nc_nd_4_0
name = "CC BY-NC-ND 4.0"
url = "https://creativecommons.org/licenses/by-nc-nd/4.0/"
/decl/license/grandfathered
name = "Grandfathered In"
url = "https://en.wikipedia.org/wiki/Grandfather_clause"
attribution_mandatory = FALSE

View File

@@ -1,11 +1,3 @@
/datum/track
var/title
var/sound
/datum/track/New(var/title_name, var/audio)
title = title_name
sound = audio
/obj/machinery/media/jukebox/
name = "space jukebox"
desc = "Filled with songs both past and present!"
@@ -29,36 +21,24 @@
var/freq = 0
var/datum/track/current_track
var/list/datum/track/tracks = list(
new/datum/track("Beyond", 'sound/ambience/ambispace.ogg'),
new/datum/track("Clouds of Fire", 'sound/music/clouds.s3m'),
new/datum/track("D`Bert", 'sound/music/title2.ogg'),
new/datum/track("D`Fort", 'sound/ambience/song_game.ogg'),
new/datum/track("Floating", 'sound/music/main.ogg'),
new/datum/track("Endless Space", 'sound/music/space.ogg'),
new/datum/track("Part A", 'sound/misc/TestLoop1.ogg'),
new/datum/track("Scratch", 'sound/music/title1.ogg'),
new/datum/track("Trai`Tor", 'sound/music/traitor.ogg'),
new/datum/track("Stellar Transit", 'sound/ambience/space/space_serithi.ogg'),
)
var/list/datum/track/tracks
// Only visible if hacked
var/list/datum/track/secret_tracks = list(
new/datum/track("Clown", 'sound/music/clown.ogg'),
new/datum/track("Space Asshole", 'sound/music/space_asshole.ogg'),
new/datum/track("Thunderdome", 'sound/music/THUNDERDOME.ogg'),
new/datum/track("Russkiy rep Diskoteka", 'sound/music/russianrapdisco.ogg')
)
var/list/datum/track/secret_tracks
/obj/machinery/media/jukebox/Initialize()
. = ..()
default_apply_parts()
wires = new/datum/wires/jukebox(src)
tracks = setup_music_tracks(tracks)
secret_tracks = setup_secret_music_tracks(secret_tracks)
update_icon()
/obj/machinery/media/jukebox/Destroy()
StopPlaying()
qdel(wires)
QDEL_NULL_LIST(tracks)
current_track = null
wires = null
return ..()
@@ -144,7 +124,7 @@
if(emagged)
playsound(src, 'sound/items/AirHorn.ogg', 100, 1)
for(var/mob/living/carbon/M in ohearers(6, src))
if(M.get_ear_protection() >= 2)
if(M.get_sound_volume_multiplier() < 0.2)
continue
M.SetSleeping(0)
M.stuttering += 20
@@ -260,11 +240,11 @@
var/area/main_area = get_area(src)
if(freq)
var/sound/new_song = sound(current_track.sound, channel = 1, repeat = 1, volume = 25)
var/sound/new_song = sound(current_track.GetTrack(), channel = 1, repeat = 1, volume = 25)
new_song.frequency = freq
main_area.forced_ambience = list(new_song)
else
main_area.forced_ambience = list(current_track.sound)
main_area.forced_ambience = list(current_track.GetTrack())
for(var/mob/living/M in mobs_in_area(main_area))
if(M.mind)

View File

@@ -82,6 +82,7 @@
pressure_factor = max(pressure_factor, 0.15) //touching the source of the sound
S.volume *= pressure_factor
S.volume *= get_sound_volume_multiplier()
//End Atmosphere affecting sound
//Don't bother with doing anything below.
@@ -122,9 +123,10 @@
return rand(32000, 55000) //Frequency stuff only works with 45kbps oggs.
/client/proc/playtitlemusic()
if(!ticker || !ticker.login_music) return
if(is_preference_enabled(/datum/client_preference/play_lobby_music))
src << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS
if(!using_map.lobby_track)
using_map.lobby_track = using_map.get_lobby_track()
using_map.lobby_track.play_to(src)
/proc/get_sfx(soundin)
if(istext(soundin))

View File

@@ -61,7 +61,7 @@ var/list/_client_preferences_by_type
/datum/client_preference/play_lobby_music/toggled(var/mob/preference_mob, var/enabled)
if(enabled)
preference_mob << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1)
using_map.lobby_track.play_to(preference_mob)
else
preference_mob << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1)

View File

@@ -7,12 +7,12 @@
/datum/gear/ears/headphones
display_name = "headphones"
path = /obj/item/clothing/ears/earmuffs/headphones
path = /obj/item/clothing/head/headphones
/datum/gear/ears/circuitry
display_name = "earwear, circuitry (empty)"
path = /obj/item/clothing/ears/circuitry
/datum/gear/ears/earrings
display_name = "earring selection"

View File

@@ -24,6 +24,7 @@
*/
var/list/sprite_sheets_refit = null
var/ear_protection = 0
var/volume_multiplier = 1
var/blood_sprite_state
var/index //null by default, if set, will change which dmi it uses

View File

@@ -7,35 +7,7 @@
icon_state = "earmuffs"
item_state_slots = list(slot_r_hand_str = "earmuffs", slot_l_hand_str = "earmuffs")
slot_flags = SLOT_EARS | SLOT_TWOEARS
ear_protection = 2
/obj/item/clothing/ears/earmuffs/headphones
name = "headphones"
desc = "Unce unce unce unce."
var/headphones_on = 0
icon_state = "headphones_off"
item_state_slots = list(slot_r_hand_str = "headphones", slot_l_hand_str = "headphones")
slot_flags = SLOT_EARS | SLOT_TWOEARS
/obj/item/clothing/ears/earmuffs/headphones/verb/togglemusic()
set name = "Toggle Headphone Music"
set category = "Object"
set src in usr
if(!istype(usr, /mob/living)) return
if(usr.stat) return
var/base_icon = copytext(icon_state,1,(length(icon_state) - 3 + headphones_on))
if(headphones_on)
icon_state = "[base_icon]_off"
headphones_on = 0
to_chat(usr, "<span class='notice'>You turn the music off.</span>")
else
icon_state = "[base_icon]_on"
headphones_on = 1
to_chat(usr, "<span class='notice'>You turn the music on.</span>")
update_clothing_icon()
volume_multiplier = 0.1
/*
Skrell tentacle wear

View File

@@ -0,0 +1,105 @@
/obj/item/clothing/head/headphones
name = "headphones"
desc = "It's probably not in accordance with company policy to listen to music on the job... but fuck it."
icon_state = "headphones"
volume_multiplier = 0.5
slot_flags = SLOT_HEAD|SLOT_EARS
body_parts_covered = SLOT_HEAD|SLOT_EARS
gender = PLURAL
var/headphones_on = 0
var/sound_channel
var/current_track
var/music_volume = 50
/obj/item/clothing/head/headphones/Initialize()
. = ..()
sound_channel = open_sound_channel()
/obj/item/clothing/head/headphones/update_icon()
..()
icon_state = initial(icon_state)
if(headphones_on)
icon_state = "[icon_state]_on"
update_clothing_icon()
/obj/item/clothing/head/headphones/verb/togglemusic()
set name = "Toggle Headphone Music"
set category = "Object"
set src in usr
if(!istype(usr, /mob/living)) return
if(usr.incapacitated()) return
toggle(usr)
/obj/item/clothing/head/headphones/proc/toggle(mob/user)
if(headphones_on)
headphones_on = 0
to_chat(user, "<span class='notice'>You turn the music off.</span>")
volume_multiplier = initial(volume_multiplier)
stop_music(user)
else
headphones_on = 1
to_chat(user, "<span class='notice'>You turn the music on.</span>")
volume_multiplier = 0.1
play_music(user)
update_icon()
/obj/item/clothing/head/headphones/attack_self(mob/user)
..()
interact(user)
/obj/item/clothing/head/headphones/equipped(mob/user)
. = ..()
if(headphones_on)
play_music(user)
/obj/item/clothing/head/headphones/dropped(mob/user)
. = ..()
stop_music(user)
/obj/item/clothing/head/headphones/proc/play_music(mob/user)
if(!user || !user.client)
return
if(current_track)
var/decl/music_track/track = GET_DECL(GLOB.music_tracks[current_track])
user << sound(null, channel = sound_channel)
user << sound(track.song, repeat = 1, wait = 0, volume = music_volume, channel = sound_channel)
/obj/item/clothing/head/headphones/proc/stop_music(mob/user)
if(!user || !user.client)
return
user << sound(null, channel = sound_channel)
/obj/item/clothing/head/headphones/interact(var/mob/user)
if(!CanInteract(user, physical_state))
return
var/list/dat = list()
dat += "<A href='?src=\ref[src];toggle=1;'>Switch [headphones_on ? "off" : "on"]</a>"
dat += "Volume: [music_volume] <A href='?src=\ref[src];vol=-10;'>-</a><A href='?src=\ref[src];vol=10;'>+</a>"
dat += "Tracks:"
for(var/track in GLOB.music_tracks)
if(track == current_track)
dat += "<span class='linkOn'>[track]</span>"
else
dat += "<A href='?src=\ref[src];track=[track];'>[track]</a>"
var/datum/browser/popup = new(user, "headphones", name, 290, 410)
popup.set_content(jointext(dat,"<br>"))
popup.open()
/obj/item/clothing/head/headphones/Topic(var/user, var/list/href_list)
if(href_list["toggle"])
toggle(usr)
interact(usr)
if(href_list["vol"])
var/adj = text2num(href_list["vol"])
music_volume = clamp(music_volume + adj, 0, 100)
if(headphones_on)
play_music(usr)
interact(usr)
if(href_list["track"])
current_track = href_list["track"]
if(headphones_on)
play_music(usr)
interact(usr)
updateUsrDialog()

View File

@@ -4,7 +4,7 @@
var/msg = "" // This is to make sure that the pieces have actually added something
var/raw_msg = ""
. = list("formatted" = "[verb], \"", "raw" = "")
for(var/datum/multilingual_say_piece/SP in message_pieces)
iteration_count++
var/piece = SP.message
@@ -15,11 +15,11 @@
if(radio)
.["formatted"] = SP.speaking.format_message_radio(piece)
.["raw"] = piece
return
return
else
.["formatted"] = SP.speaking.format_message(piece)
.["raw"] = piece
return
return
if(iteration_count == 1)
piece = capitalize(piece)
@@ -34,7 +34,7 @@
piece = pick(S.say_list.speak)
raw_msg += (piece + " ")
//HTML formatting
if(!SP.speaking) // Catch the most generic case first
piece = "<span class='message body'>[piece]</span>"
@@ -44,7 +44,7 @@
piece = SP.speaking.format_message(piece)
msg += (piece + " ")
if(msg == "")
// There is literally no content left in this message, we need to shut this shit down
.["formatted"] = "" // hear_say will suppress it
@@ -90,7 +90,7 @@
var/message = combined["formatted"]
if(message == "")
return
if(sleeping || stat == UNCONSCIOUS)
hear_sleep(message)
return FALSE
@@ -108,7 +108,7 @@
if(is_preference_enabled(/datum/client_preference/ghost_ears) && (speaker in view(src)))
message = "<b>[message]</b>"
if(is_deaf())
if(is_deaf() || get_sound_volume_multiplier() < 0.2)
if(speaker == src)
to_chat(src, "<span class='filter_say'><span class='warning'>You cannot hear yourself speak!</span></span>")
else
@@ -169,7 +169,7 @@
var/regex/R = new("\\[delimiter](.+?)\\[delimiter]","g")
var/tag = GLOB.speech_toppings[delimiter]
tagged_message = R.Replace(tagged_message,"<[tag]>$1</[tag]>")
return tagged_message
/mob/proc/hear_radio(var/list/message_pieces, var/verb = "says", var/part_a, var/part_b, var/part_c, var/mob/speaker = null, var/hard_to_hear = 0, var/vname = "")
@@ -293,4 +293,4 @@
name = speaker.voice_name
var/rendered = "<span class='game say'><span class='name'>[name]</span> [message]</span>"
to_chat(src, rendered)
to_chat(src, rendered)

View File

@@ -138,7 +138,7 @@
b_loss = b_loss/1.5
f_loss = f_loss/1.5
if (!get_ear_protection() >= 2)
if (get_sound_volume_multiplier() >= 0.2)
ear_damage += 30
ear_deaf += 120
if (prob(70) && !shielded)
@@ -148,7 +148,7 @@
b_loss += 30
if (prob(getarmor(null, "bomb")))
b_loss = b_loss/2
if (!get_ear_protection() >= 2)
if (get_sound_volume_multiplier() >= 0.2)
ear_damage += 15
ear_deaf += 60
if (prob(50) && !shielded)
@@ -1621,3 +1621,8 @@
/mob/living/carbon/human/get_mob_riding_slots()
return list(back, head, wear_suit)
/mob/living/carbon/human/get_sound_volume_multiplier()
. = ..()
for(var/obj/item/clothing/C in list(l_ear, r_ear, head))
. = min(., C.volume_multiplier)

View File

@@ -80,17 +80,12 @@
return ..()
/mob/living/carbon/human/get_ear_protection()
var/sum = 0
if(istype(l_ear, /obj/item/clothing/ears))
var/obj/item/clothing/ears/L = l_ear
sum += L.ear_protection
if(istype(r_ear, /obj/item/clothing/ears))
var/obj/item/clothing/ears/R = r_ear
sum += R.ear_protection
if(istype(head, /obj/item/clothing/head))
var/obj/item/clothing/head/H = head
sum += H.ear_protection
return sum
if (get_sound_volume_multiplier() <= 0.2)
return 2
else if (get_sound_volume_multiplier() <= 0.5)
return 1
else
return 0
/mob/living/carbon/human/get_gender()
return identifying_gender ? identifying_gender : gender

View File

@@ -1185,3 +1185,6 @@
/mob/proc/grab_ghost(force)
if(mind)
return mind.grab_ghost(force = force)
/mob/proc/get_sound_volume_multiplier()
return !ear_deaf

View File

@@ -638,3 +638,13 @@
/mob/new_player/MayRespawn()
return 1
/mob/new_player/verb/next_lobby_track()
set name = "Play Different Lobby Track"
set category = "OOC"
if(!is_preference_enabled(/datum/client_preference/play_lobby_music))
return
var/decl/music_track/new_track = using_map.get_lobby_track(using_map.lobby_track.type)
if(new_track)
new_track.play_to(src)

View File

@@ -0,0 +1,53 @@
/datum/unit_test/music_track_validate
name = "MUSIC TRACK: Validate Music Tracks"
/datum/unit_test/music_track_validate/start_test()
var/music_tracks_by_type = decls_repository.get_decls_of_subtype(/decl/music_track)
var/list/bad_tracks = list()
for(var/music_track_type in music_tracks_by_type)
var/decl/music_track/music_track = music_tracks_by_type[music_track_type]
if(!music_track.song)
log_bad("[music_track_type] - Missing song")
bad_tracks |= music_track
if(!music_track.title)
log_bad("[music_track_type] - Missing title")
bad_tracks |= music_track
if(istype(music_track.license, /decl/license))
if(music_track.license.attribution_mandatory)
if(!music_track.artist || cmptext(music_track.artist, "unknown"))
log_bad("[music_track_type] - Invalid artist")
bad_tracks |= music_track
if(!music_track.url || cmptext(music_track.url, "unknown"))
log_bad("[music_track_type] - Invalid url")
bad_tracks |= music_track
else
log_bad("[music_track_type] - Invalid license")
bad_tracks |= music_track
if(bad_tracks.len)
fail("Found [bad_tracks.len] incorrectly setup music track\s.")
else
pass("All music tracks are correctly setup.")
return 1
/datum/unit_test/jukebox_track_validate
name = "MUSIC TRACK: Validate Jukebox Tracks"
/datum/unit_test/jukebox_track_validate/start_test()
var/list/bad_boxes = list()
for(var/obj/machinery/media/jukebox/jukebox in world)
for(var/entry in jukebox.tracks)
var/datum/track/track = entry
if(!track.title || !ispath(track.track, /decl/music_track))
bad_boxes += jukebox
log_bad("Invalid jukebox track: [log_info_line(jukebox)]")
break
if(bad_boxes.len)
fail("Found [bad_boxes.len] invalid jukebox(es)")
else
pass("All jukeboxes had valid tracks.")
return 1