TGUI Fixes

This commit is contained in:
ShadowLarkens
2020-12-24 05:17:34 -08:00
parent f423794ed9
commit b2b8f068bb
6 changed files with 12 additions and 11 deletions
@@ -100,7 +100,8 @@
else
set_temperature = max(amount, 0)
if("setPower") //setting power to 0 is redundant anyways
var/new_setting = between(0, text2num(params["value"]), 100)
var/new_setting = CLAMP(text2num(params["value"]), 0, 100)
to_chat(world, "param value was [params["value"]], new_setting was [new_setting]") // DEBUG
set_power_level(new_setting)
add_fingerprint(usr)
@@ -156,10 +156,10 @@ var/global/list/default_medbay_channels = list(
log_runtime(EXCEPTION("Warning: Topic() was improperly called on radio [src] [type], with the track href and \[[href] [json_encode(href_list)]]. Please update the caller to use tgui_act."))
. = ..()
/obj/item/device/radio/tgui_interact(mob/user, datum/tgui/ui)
/obj/item/device/radio/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, "Radio", name)
ui = new(user, src, "Radio", name, parent_ui = parent_ui)
ui.open()
/obj/item/device/radio/tgui_data(mob/user)
+2 -2
View File
@@ -7,10 +7,10 @@
if(!can_use())
. = min(., STATUS_UPDATE)
/obj/item/device/pda/tgui_interact(mob/user, datum/tgui/ui)
/obj/item/device/pda/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, "Pda", "Personal Data Assistant")
ui = new(user, src, "Pda", "Personal Data Assistant", parent_ui = parent_ui)
ui.open()
/obj/item/device/pda/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
@@ -34,8 +34,8 @@ export const GasTemperatureSystem = (props, context) => {
<LabeledControls>
<LabeledControls.Item label="Power Level">
<Knob
minValue="0"
maxValue="100"
minValue={0}
maxValue={100}
stepPixelSize="1"
value={powerSetting}
onChange={(e, val) => act("setPower", { value: val })}
@@ -19,7 +19,7 @@ export const pAIInterface = (props, context) => {
<Window width={450} height={600} resizable>
<Window.Content scrollable>
<Section title="Emotion">
{emotions.map(emote => (
{!!Array.isArray(emotions) && emotions.map(emote => (
<Button
key={emote.id}
content={emote.name}
@@ -30,7 +30,7 @@ export const pAIInterface = (props, context) => {
<Section title={"Software (Available RAM: " + available_ram + ")"}>
<LabeledList>
<LabeledList.Item label="Installed">
{bought.map(app => (
{!!Array.isArray(bought) && bought.map(app => (
<Button
key={app.id}
content={app.name}
@@ -40,7 +40,7 @@ export const pAIInterface = (props, context) => {
</LabeledList.Item>
<LabeledList.Divider />
<LabeledList.Item label="Downloadable">
{not_bought.map(app => (
{!!Array.isArray(not_bought) && not_bought.map(app => (
<Button
key={app.id}
content={app.name + " (" + app.ram + ")"}
File diff suppressed because one or more lines are too long