mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-07-10 07:43:07 +01:00
Enable TGUI
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
var/time_died_as_mouse = null //when the client last died as a mouse
|
||||
var/datum/tooltip/tooltips = null
|
||||
var/datum/chatOutput/chatOutput
|
||||
// var/datum/volume_panel/volume_panel = null // Initialized by /client/verb/volume_panel()
|
||||
var/datum/volume_panel/volume_panel = null // Initialized by /client/verb/volume_panel()
|
||||
var/chatOutputLoadedAt
|
||||
|
||||
var/adminhelped = 0
|
||||
|
||||
@@ -62,46 +62,46 @@
|
||||
|
||||
// Neat little volume adjuster thing in case you don't wanna touch preferences by hand you lazy fuck
|
||||
// Currently unimplemented due to lack of TGUI v4
|
||||
// /datum/volume_panel
|
||||
// /datum/volume_panel/tgui_state(mob/user)
|
||||
// return GLOB.tgui_always_state
|
||||
/datum/volume_panel
|
||||
/datum/volume_panel/tgui_state(mob/user)
|
||||
return GLOB.tgui_always_state
|
||||
|
||||
// /datum/volume_panel/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
|
||||
// ui = SStgui.try_update_ui(user, src, ui)
|
||||
// if(!ui)
|
||||
// ui = new(user, src, "VolumePanel", "Volume Panel")
|
||||
// ui.open()
|
||||
/datum/volume_panel/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "VolumePanel", "Volume Panel")
|
||||
ui.open()
|
||||
|
||||
// /datum/volume_panel/tgui_data(mob/user)
|
||||
// if(!user.client || !user.client.prefs)
|
||||
// return list("error" = TRUE)
|
||||
/datum/volume_panel/tgui_data(mob/user)
|
||||
if(!user.client || !user.client.prefs)
|
||||
return list("error" = TRUE)
|
||||
|
||||
// var/list/data = ..()
|
||||
// data["volume_channels"] = user.client.prefs.volume_channels
|
||||
// return data
|
||||
var/list/data = ..()
|
||||
data["volume_channels"] = user.client.prefs.volume_channels
|
||||
return data
|
||||
|
||||
// /datum/volume_panel/tgui_act(action, params)
|
||||
// if(..())
|
||||
// return TRUE
|
||||
/datum/volume_panel/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
// if(!usr?.client?.prefs)
|
||||
// return TRUE
|
||||
if(!usr?.client?.prefs)
|
||||
return TRUE
|
||||
|
||||
// var/datum/preferences/P = usr.client.prefs
|
||||
// switch(action)
|
||||
// if("adjust_volume")
|
||||
// var/channel = params["channel"]
|
||||
// if(channel in P.volume_channels)
|
||||
// P.volume_channels["[channel]"] = clamp(params["vol"], 0, 2)
|
||||
// SScharacter_setup.queue_preferences_save(P)
|
||||
// return TRUE
|
||||
var/datum/preferences/P = usr.client.prefs
|
||||
switch(action)
|
||||
if("adjust_volume")
|
||||
var/channel = params["channel"]
|
||||
if(channel in P.volume_channels)
|
||||
P.volume_channels["[channel]"] = clamp(params["vol"], 0, 2)
|
||||
SScharacter_setup.queue_preferences_save(P)
|
||||
return TRUE
|
||||
|
||||
// /client/verb/volume_panel()
|
||||
// set name = "Volume Panel"
|
||||
// set category = "Preferences"
|
||||
// set desc = "Allows you to adjust volume levels on the fly."
|
||||
/client/verb/volume_panel()
|
||||
set name = "Volume Panel"
|
||||
set category = "Preferences"
|
||||
set desc = "Allows you to adjust volume levels on the fly."
|
||||
|
||||
// if(!volume_panel)
|
||||
// volume_panel = new(src)
|
||||
if(!volume_panel)
|
||||
volume_panel = new(src)
|
||||
|
||||
// volume_panel.tgui_interact(mob)
|
||||
volume_panel.tgui_interact(mob)
|
||||
|
||||
@@ -23,11 +23,17 @@ export const VolumePanel = (props, context) => {
|
||||
minValue={0}
|
||||
maxValue={200}
|
||||
value={volume_channels[key] * 100}
|
||||
onChange={(e, val) => act("adjust_volume", { channel: key, vol: (val / 100) })} />
|
||||
onChange={(e, val) => act("adjust_volume", {
|
||||
channel: key,
|
||||
vol: (val / 100),
|
||||
})} />
|
||||
<Button
|
||||
ml={1}
|
||||
icon="undo"
|
||||
onClick={() => act("adjust_volume", { channel: key, vol: 1 })} />
|
||||
onClick={() => act("adjust_volume", {
|
||||
channel: key,
|
||||
vol: 1,
|
||||
})} />
|
||||
</LabeledList.Item>
|
||||
))}
|
||||
</LabeledList>
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user