From dd1613f6c431ec004436984102c768dd0fb5cd7e Mon Sep 17 00:00:00 2001 From: d3athrow Date: Tue, 1 Apr 2014 13:53:07 -0500 Subject: [PATCH] you can set the volume of the jukebox now, preferences tab -> set volume Conflicts: code/modules/media/mediamanager.dm --- code/modules/client/preferences.dm | 2 ++ code/modules/client/preferences_savefile.dm | 14 ++++++++++- code/modules/media/mediamanager.dm | 26 +++++++++++++++++---- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 4fabaeca814..4d30a43305f 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -126,6 +126,8 @@ datum/preferences // Whether or not to use randomized character slots var/randomslot = 0 + // jukebox volume + var/volume = 100 /datum/preferences/New(client/C) b_type = pick(4;"O-", 36;"O+", 3;"A-", 28;"A+", 1;"B-", 20;"B+", 1;"AB-", 5;"AB+") if(istype(C)) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 8fc9a62fce6..12149c5e3c1 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -58,7 +58,7 @@ S["UI_style_color"] >> UI_style_color S["UI_style_alpha"] >> UI_style_alpha S["randomslot"] >> randomslot - + S["volume"] >> volume //Sanitize ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor)) lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog)) @@ -70,6 +70,7 @@ UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color)) UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha)) randomslot = sanitize_integer(randomslot, 0, 1, initial(randomslot)) + volume = sanitize_integer(volume, 0, 100, initial(volume)) return 1 /datum/preferences/proc/save_preferences() @@ -91,6 +92,17 @@ S["UI_style_color"] << UI_style_color S["UI_style_alpha"] << UI_style_alpha S["randomslot"] << randomslot + S["volume"] << volume + return 1 + +//saving volume changes +/datum/preferences/proc/save_volume() + if(!path) return 0 + var/savefile/S = new /savefile(path) + if(!S) return 0 + S.cd = "/" + + S["volume"] << volume return 1 /datum/preferences/proc/load_save(dir) diff --git a/code/modules/media/mediamanager.dm b/code/modules/media/mediamanager.dm index c8d4e9b8f10..5838dd9084a 100644 --- a/code/modules/media/mediamanager.dm +++ b/code/modules/media/mediamanager.dm @@ -85,7 +85,7 @@ function SetMusic(url, time, volume) { proc/update_music() var/targetURL = "" var/targetStartTime = 0 - var/targetVolume = 25 + //var/targetVolume = volume if (!owner) //testing("owner is null") @@ -104,8 +104,26 @@ function SetMusic(url, time, volume) { //else // testing("M is not playing or null.") - if (url != targetURL || abs(targetStartTime - start_time) > 1 || targetVolume != volume) + if (url != targetURL || abs(targetStartTime - start_time) > 1) url = targetURL start_time = targetStartTime - volume = targetVolume - send_update() \ No newline at end of file + //volume = targetVolume + send_update() + + proc/update_volume(var/value) + volume = value + send_update() + +/client/verb/change_volume() + set name = "Set Volume" + set category = "Preferences" + set desc = "Set jukebox volume" + if(!media || !istype(media)) + usr << "You have no media datum to change, if you're not in the lobby tell an admin." + return + var/value = input("Choose your Jukebox volume.", "Jukebox volume", media.volume) + value = round(max(0, min(100, value))) + media.update_volume(value) + if(prefs) + prefs.volume = value + prefs.save_volume()