mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-30 15:37:36 +01:00
NanoUI Update: Seperate UI Data into ui_data() proc
This commit changes how NanoUI's live data updating system works. Previously, data for the template was directly gathered in the ui_interact proc. Now, it is seperated into the proc `ui_data`. To players, this does absolutely nothing. To coders, this opens up the potential for a much more complicated and fancy graphical updating system in the future, because the data is available on-demand without ever having to call nanomanager.try_update_ui.
This commit is contained in:
@@ -113,6 +113,16 @@
|
||||
repeat = 0
|
||||
|
||||
/datum/song/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
if(!instrumentObj)
|
||||
return
|
||||
|
||||
ui = nanomanager.try_update_ui(user, instrumentObj, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, instrumentObj, ui_key, "song.tmpl", instrumentObj.name, 700, 500)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/datum/song/ui_data(mob/user, datum/topic_state/state = default_state)
|
||||
var/data[0]
|
||||
|
||||
data["lines"] = lines
|
||||
@@ -125,15 +135,7 @@
|
||||
data["minTempo"] = world.tick_lag
|
||||
data["maxTempo"] = 600
|
||||
|
||||
if(!instrumentObj)
|
||||
return
|
||||
|
||||
ui = nanomanager.try_update_ui(user, instrumentObj, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, instrumentObj, ui_key, "song.tmpl", instrumentObj.name, 700, 500)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
return data
|
||||
|
||||
/datum/song/Topic(href, href_list)
|
||||
if(!in_range(instrumentObj, usr) || (issilicon(usr) && instrumentObj.loc != usr) || !isliving(usr) || !usr.canmove || usr.restrained())
|
||||
@@ -294,6 +296,9 @@
|
||||
|
||||
song.ui_interact(user, ui_key, ui, force_open)
|
||||
|
||||
/obj/structure/piano/ui_data(mob/user, datum/topic_state/state = default_state)
|
||||
return song.ui_data(user, state)
|
||||
|
||||
/obj/structure/piano/Topic(href, href_list)
|
||||
song.Topic(href, href_list)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user