mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Convert to using Mediamanager lobby music
Update the JSON!
This commit is contained in:
@@ -10,8 +10,6 @@ var/global/datum/controller/gameticker/ticker
|
||||
var/event_time = null
|
||||
var/event = 0
|
||||
|
||||
var/login_music // music played in pregame lobby
|
||||
|
||||
var/list/datum/mind/minds = list()//The people in the game. Used for objective tracking.
|
||||
|
||||
var/Bible_icon_state // icon_state the chaplain has chosen for his bible
|
||||
@@ -34,15 +32,6 @@ var/global/datum/controller/gameticker/ticker
|
||||
var/round_end_announced = 0 // Spam Prevention. Announce round end only once.
|
||||
|
||||
/datum/controller/gameticker/proc/pregame()
|
||||
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?
|
||||
do
|
||||
pregame_timeleft = 180
|
||||
world << "<B><FONT color='blue'>Welcome to the pre-game lobby!</FONT></B>"
|
||||
|
||||
@@ -157,9 +157,11 @@ var/const/FALLOFF_SOUNDS = 0.5
|
||||
src << S
|
||||
|
||||
/client/proc/playtitlemusic()
|
||||
if(!ticker || !ticker.login_music) return
|
||||
if(!ticker || !all_lobby_tracks.len || !media) 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
|
||||
var/datum/track/T = pick(all_lobby_tracks)
|
||||
media.push_music(T.url, world.time, 0.85)
|
||||
to_chat(src,"<span class='notice'>Lobby music: <b>[T.title]</b> by <b>[T.artist]</b>.")
|
||||
|
||||
/proc/get_rand_frequency()
|
||||
return rand(32000, 55000) //Frequency stuff only works with 45kbps oggs.
|
||||
|
||||
@@ -60,10 +60,13 @@ var/list/_client_preferences_by_type
|
||||
key = "SOUND_LOBBY"
|
||||
|
||||
/datum/client_preference/play_lobby_music/toggled(var/mob/preference_mob, var/enabled)
|
||||
if(!preference_mob.client || !preference_mob.client.media)
|
||||
return
|
||||
|
||||
if(enabled)
|
||||
preference_mob << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1)
|
||||
preference_mob.client.playtitlemusic()
|
||||
else
|
||||
preference_mob << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1)
|
||||
preference_mob.client.media.stop_music()
|
||||
|
||||
/datum/client_preference/play_ambiance
|
||||
description ="Play ambience"
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
var/artist // Song's creator
|
||||
var/duration // Song length in deciseconds
|
||||
var/secret // Show up in regular playlist or secret playlist?
|
||||
var/lobby // Be one of the choices for lobby music?
|
||||
|
||||
/datum/track/New(var/url, var/title, var/duration, var/artist = "", var/secret = 0)
|
||||
/datum/track/New(var/url, var/title, var/duration, var/artist = "", var/secret = 0, var/lobby = 0)
|
||||
src.url = url
|
||||
src.title = title
|
||||
src.artist = artist
|
||||
src.duration = duration
|
||||
src.secret = secret
|
||||
src.lobby = lobby
|
||||
|
||||
/datum/track/proc/display()
|
||||
var str = "\"[title]\""
|
||||
@@ -29,6 +31,7 @@
|
||||
|
||||
// Global list holding all configured jukebox tracks
|
||||
var/global/list/all_jukebox_tracks = list()
|
||||
var/global/list/all_lobby_tracks = list()
|
||||
|
||||
// Read the jukebox configuration file on system startup.
|
||||
/hook/startup/proc/load_jukebox_tracks()
|
||||
@@ -53,5 +56,8 @@ var/global/list/all_jukebox_tracks = list()
|
||||
if(istext(entry["artist"]))
|
||||
T.artist = entry["artist"]
|
||||
T.secret = entry["secret"] ? 1 : 0
|
||||
T.lobby = entry["lobby"] ? 1 : 0
|
||||
all_jukebox_tracks += T
|
||||
if(T.lobby)
|
||||
all_lobby_tracks += T
|
||||
return 1
|
||||
|
||||
@@ -16,16 +16,12 @@
|
||||
#define MP_DEBUG(x)
|
||||
#endif
|
||||
|
||||
// Set up player on login to a mob.
|
||||
// This means they get a new media manager every time they switch mobs!
|
||||
// Is this wasteful? Granted switching mobs doesn't happen very often so maybe its fine.
|
||||
// TODO - While this direct override might technically be faster, probably better code to use observer or hooks ~Leshana
|
||||
/mob/Login()
|
||||
// Set up player on login.
|
||||
/client/New()
|
||||
. = ..()
|
||||
ASSERT(src.client)
|
||||
src.client.media = new /datum/media_manager(src.client)
|
||||
src.client.media.open()
|
||||
src.client.media.update_music()
|
||||
media = new /datum/media_manager(src)
|
||||
media.open()
|
||||
media.update_music()
|
||||
|
||||
// Stop media when the round ends. I guess so it doesn't play forever or something (for some reason?)
|
||||
/hook/roundend/proc/stop_all_media()
|
||||
|
||||
@@ -118,8 +118,8 @@
|
||||
var/mob/observer/dead/observer = new()
|
||||
|
||||
spawning = 1
|
||||
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS cant last forever yo
|
||||
|
||||
if(client.media)
|
||||
client.media.stop_music() // MAD JAMS cant last forever yo
|
||||
|
||||
observer.started_as_observer = 1
|
||||
close_spawn_windows()
|
||||
@@ -455,7 +455,8 @@
|
||||
else
|
||||
client.prefs.copy_to(new_character)
|
||||
|
||||
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS cant last forever yo
|
||||
if(client && client.media)
|
||||
client.media.stop_music() // MAD JAMS cant last forever yo
|
||||
|
||||
if(mind)
|
||||
mind.active = 0 //we wish to transfer the key manually
|
||||
|
||||
Reference in New Issue
Block a user