mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Adds NanoUI for multiple computers.
This commit is contained in:
@@ -22,62 +22,51 @@
|
||||
add_fingerprint(user)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
interact(user)
|
||||
ui_interact(user)
|
||||
|
||||
|
||||
/obj/machinery/computer/operating/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
interact(user)
|
||||
|
||||
|
||||
/obj/machinery/computer/operating/interact(mob/user)
|
||||
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=op")
|
||||
return
|
||||
ui_interact(user)
|
||||
|
||||
/**
|
||||
* Display the NanoUI window for the operating computer.
|
||||
*
|
||||
* See NanoUI documentation for details.
|
||||
*/
|
||||
/obj/machinery/computer/operating/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
user.set_machine(src)
|
||||
var/dat = "<HEAD><TITLE>Operating Computer</TITLE><META HTTP-EQUIV='Refresh' CONTENT='10'></HEAD><BODY>\n"
|
||||
dat += "<A HREF='?src=\ref[user];mach_close=op'>Close</A><br><br>" //| <A HREF='?src=\ref[user];update=1'>Update</A>"
|
||||
if(src.table && (src.table.check_victim()))
|
||||
src.victim = src.table.victim
|
||||
dat += {"
|
||||
<B>Patient Information:</B><BR>
|
||||
<BR>
|
||||
<B>Name:</B> [src.victim.real_name]<BR>
|
||||
<B>Age:</B> [src.victim.age]<BR>
|
||||
<B>Blood Type:</B> [src.victim.b_type]<BR>
|
||||
<BR>
|
||||
<B>Health:</B> [src.victim.health]<BR>
|
||||
<B>Brute Damage:</B> [src.victim.getBruteLoss()]<BR>
|
||||
<B>Toxins Damage:</B> [src.victim.getToxLoss()]<BR>
|
||||
<B>Fire Damage:</B> [src.victim.getFireLoss()]<BR>
|
||||
<B>Suffocation Damage:</B> [src.victim.getOxyLoss()]<BR>
|
||||
<B>Patient Status:</B> [src.victim.stat ? "Non-Responsive" : "Stable"]<BR>
|
||||
<B>Heartbeat rate:</B> [victim.get_pulse(GETPULSE_TOOL)]<BR>
|
||||
"}
|
||||
else
|
||||
src.victim = null
|
||||
dat += {"
|
||||
<B>Patient Information:</B><BR>
|
||||
<BR>
|
||||
<B>No Patient Detected</B>
|
||||
"}
|
||||
user << browse(dat, "window=op")
|
||||
onclose(user, "op")
|
||||
|
||||
var/list/data = list()
|
||||
var/list/victim_ui = list()
|
||||
|
||||
if(table && (table.check_victim()))
|
||||
victim = table.victim
|
||||
|
||||
victim_ui = list("real_name" = victim.real_name, "age" = victim.age, "b_type" = victim.b_type, "health" = victim.health,
|
||||
"brute" = victim.getBruteLoss(), "tox" = src.victim.getToxLoss(), "burn" = victim.getFireLoss(), "oxy" = victim.getOxyLoss(),
|
||||
"stat" = (victim.stat ? "Non-Responsive" : "Stable"), "pulse" = victim.get_pulse(GETPULSE_TOOL))
|
||||
else
|
||||
victim = null
|
||||
victim_ui = null
|
||||
|
||||
data["table"] = table
|
||||
data["victim"] = victim_ui
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "operating.tmpl", src.name, 380, 400)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(5)
|
||||
|
||||
/obj/machinery/computer/operating/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
|
||||
usr.set_machine(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/computer/operating/process()
|
||||
if(..())
|
||||
src.updateDialog()
|
||||
src.add_fingerprint(usr)
|
||||
nanomanager.update_uis(src)
|
||||
Reference in New Issue
Block a user