mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 15:14:27 +01:00
you can set the volume of the jukebox now, preferences tab -> set volume
Conflicts: code/modules/media/mediamanager.dm
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
//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()
|
||||
|
||||
Reference in New Issue
Block a user