mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-05 23:12:26 +00:00
Adds NanoUI for multiple computers.
This commit is contained in:
@@ -30,62 +30,60 @@
|
||||
"Snow Field" = "snowfield", \
|
||||
"Theatre" = "theatre", \
|
||||
"Meeting Hall" = "meetinghall", \
|
||||
"Courtroom" = "courtroom" \
|
||||
"Courtroom" = "courtroom", \
|
||||
"Turn Off" = "turnoff" \
|
||||
)
|
||||
var/list/restricted_programs = list("Atmospheric Burn Simulation" = "burntest", "Wildlife Simulation" = "wildlifecarp")
|
||||
var/current_program = "turnoff"
|
||||
|
||||
/obj/machinery/computer/HolodeckControl/attack_ai(var/mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/HolodeckControl/attack_hand(var/mob/user as mob)
|
||||
|
||||
if(..())
|
||||
return
|
||||
user.set_machine(src)
|
||||
var/dat
|
||||
|
||||
dat += "<B>Holodeck Control System</B><BR>"
|
||||
dat += "<HR>Current Loaded Programs:<BR>"
|
||||
for(var/prog in supported_programs)
|
||||
dat += "<A href='?src=\ref[src];program=[supported_programs[prog]]'>([prog])</A><BR>"
|
||||
ui_interact(user)
|
||||
|
||||
dat += "<BR>"
|
||||
dat += "<A href='?src=\ref[src];program=turnoff'>(Turn Off)</A><BR>"
|
||||
/**
|
||||
* Display the NanoUI window for the Holodeck Computer.
|
||||
*
|
||||
* See NanoUI documentation for details.
|
||||
*/
|
||||
/obj/machinery/computer/HolodeckControl/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
user.set_machine(src)
|
||||
|
||||
dat += "<BR>"
|
||||
dat += "Please ensure that only holographic weapons are used in the holodeck if a combat simulation has been loaded.<BR>"
|
||||
var/list/data = list()
|
||||
var/program_list[0]
|
||||
var/restricted_program_list[0]
|
||||
|
||||
for(var/P in supported_programs)
|
||||
program_list[++program_list.len] = list("name" = P, "program" = supported_programs[P])
|
||||
|
||||
for(var/P in restricted_programs)
|
||||
restricted_program_list[++restricted_program_list.len] = list("name" = P, "program" = restricted_programs[P])
|
||||
|
||||
data["supportedPrograms"] = program_list
|
||||
data["restrictedPrograms"] = restricted_program_list
|
||||
data["currentProgram"] = current_program
|
||||
if(issilicon(user))
|
||||
dat += "<BR>"
|
||||
if(safety_disabled)
|
||||
if (emagged)
|
||||
dat += "<font color=red><b>ERROR</b>: Cannot re-enable Safety Protocols.</font><BR>"
|
||||
else
|
||||
dat += "<A href='?src=\ref[src];AIoverride=1'>(<font color=green>Re-Enable Safety Protocols?</font>)</A><BR>"
|
||||
else
|
||||
dat += "<A href='?src=\ref[src];AIoverride=1'>(<font color=red>Override Safety Protocols?</font>)</A><BR>"
|
||||
|
||||
dat += "<BR>"
|
||||
|
||||
if(safety_disabled)
|
||||
for(var/prog in restricted_programs)
|
||||
dat += "<A href='?src=\ref[src];program=[restricted_programs[prog]]'>(<font color=red>Begin [prog]</font>)</A><BR>"
|
||||
dat += "Ensure the holodeck is empty before testing.<BR>"
|
||||
dat += "<BR>"
|
||||
dat += "Safety Protocols are <font color=red> DISABLED </font><BR>"
|
||||
data["isSilicon"] = 1
|
||||
else
|
||||
dat += "Safety Protocols are <font color=green> ENABLED </font><BR>"
|
||||
|
||||
data["isSilicon"] = null
|
||||
data["safetyDisabled"] = safety_disabled
|
||||
data["emagged"] = emagged
|
||||
if(linkedholodeck.has_gravity)
|
||||
dat += "Gravity is <A href='?src=\ref[src];gravity=1'><font color=green>(ON)</font></A><BR>"
|
||||
data["gravity"] = 1
|
||||
else
|
||||
dat += "Gravity is <A href='?src=\ref[src];gravity=1'><font color=blue>(OFF)</font></A><BR>"
|
||||
|
||||
user << browse(dat, "window=computer;size=400x500")
|
||||
onclose(user, "computer")
|
||||
|
||||
return
|
||||
data["gravity"] = null
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "holodeck.tmpl", src.name, 400, 500)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
//ui.set_auto_update(5)
|
||||
|
||||
/obj/machinery/computer/HolodeckControl/Topic(href, href_list)
|
||||
if(..())
|
||||
@@ -97,6 +95,7 @@
|
||||
var/prog = href_list["program"]
|
||||
if(prog in holodeck_programs)
|
||||
loadProgram(holodeck_programs[prog])
|
||||
current_program = href_list["program"]
|
||||
|
||||
else if(href_list["AIoverride"])
|
||||
if(!issilicon(usr))
|
||||
@@ -118,8 +117,8 @@
|
||||
toggleGravity(linkedholodeck)
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
nanomanager.update_uis(src)
|
||||
|
||||
/obj/machinery/computer/HolodeckControl/emag_act(var/remaining_charges, var/mob/user as mob)
|
||||
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
|
||||
@@ -132,7 +131,6 @@
|
||||
user << "Warning. Automatic shutoff and derezing protocols have been corrupted. Please call [company_name] maintenance and do not use the simulator."
|
||||
log_game("[key_name(usr)] emagged the Holodeck Control Computer")
|
||||
return 1
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/computer/HolodeckControl/proc/update_projections()
|
||||
|
||||
@@ -41,54 +41,37 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
|
||||
/obj/machinery/photocopier/faxmachine/attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
|
||||
var/dat = "Fax Machine<BR>"
|
||||
ui_interact(user)
|
||||
|
||||
var/scan_name
|
||||
/**
|
||||
* Display the NanoUI window for the fax machine.
|
||||
*
|
||||
* See NanoUI documentation for details.
|
||||
*/
|
||||
/obj/machinery/photocopier/faxmachine/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
user.set_machine(src)
|
||||
|
||||
var/list/data = list()
|
||||
if(scan)
|
||||
scan_name = scan.name
|
||||
data["scanName"] = scan.name
|
||||
else
|
||||
scan_name = "--------"
|
||||
|
||||
dat += "Confirm Identity: <a href='byond://?src=\ref[src];scan=1'>[scan_name]</a><br>"
|
||||
|
||||
if(authenticated)
|
||||
dat += "<a href='byond://?src=\ref[src];logout=1'>{Log Out}</a>"
|
||||
data["scanName"] = null
|
||||
data["bossName"] = boss_name
|
||||
data["authenticated"] = authenticated
|
||||
data["copyItem"] = copyitem
|
||||
if(copyitem)
|
||||
data["copyItemName"] = copyitem.name
|
||||
else
|
||||
dat += "<a href='byond://?src=\ref[src];auth=1'>{Log In}</a>"
|
||||
data["copyItemName"] = null
|
||||
data["cooldown"] = sendcooldown
|
||||
data["destination"] = destination
|
||||
|
||||
dat += "<hr>"
|
||||
|
||||
if(authenticated)
|
||||
dat += "<b>Logged in to:</b> [boss_name] Quantum Entanglement Network<br><br>"
|
||||
|
||||
if(copyitem)
|
||||
dat += "<a href='byond://?src=\ref[src];remove=1'>Remove Item</a><br><br>"
|
||||
|
||||
if(sendcooldown)
|
||||
dat += "<b>Transmitter arrays realigning. Please stand by.</b><br>"
|
||||
|
||||
else
|
||||
|
||||
dat += "<a href='byond://?src=\ref[src];send=1'>Send</a><br>"
|
||||
dat += "<b>Currently sending:</b> [copyitem.name]<br>"
|
||||
dat += "<b>Sending to:</b> <a href='byond://?src=\ref[src];dept=1'>[destination]</a><br>"
|
||||
|
||||
else
|
||||
if(sendcooldown)
|
||||
dat += "Please insert paper to send via secure connection.<br><br>"
|
||||
dat += "<b>Transmitter arrays realigning. Please stand by.</b><br>"
|
||||
else
|
||||
dat += "Please insert paper to send via secure connection.<br><br>"
|
||||
|
||||
else
|
||||
dat += "Proper authentication is required to use this device.<br><br>"
|
||||
|
||||
if(copyitem)
|
||||
dat += "<a href ='byond://?src=\ref[src];remove=1'>Remove Item</a><br>"
|
||||
|
||||
user << browse(dat, "window=copier")
|
||||
onclose(user, "copier")
|
||||
return
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "fax.tmpl", src.name, 400, 500)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(10) //this machine is so unimportant let's not have it update that often.
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/Topic(href, href_list)
|
||||
if(href_list["send"])
|
||||
@@ -108,7 +91,6 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
|
||||
usr.put_in_hands(copyitem)
|
||||
usr << "<span class='notice'>You take \the [copyitem] out of \the [src].</span>"
|
||||
copyitem = null
|
||||
updateUsrDialog()
|
||||
|
||||
if(href_list["scan"])
|
||||
if (scan)
|
||||
@@ -140,7 +122,7 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
|
||||
if(href_list["logout"])
|
||||
authenticated = 0
|
||||
|
||||
updateUsrDialog()
|
||||
nanomanager.update_uis(src)
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/sendfax(var/destination)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
|
||||
@@ -30,24 +30,32 @@
|
||||
/obj/machinery/photocopier/attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
|
||||
var/dat = "Photocopier<BR><BR>"
|
||||
if(copyitem)
|
||||
dat += "<a href='byond://?src=\ref[src];remove=1'>Remove Item</a><BR>"
|
||||
if(toner)
|
||||
dat += "<a href='byond://?src=\ref[src];copy=1'>Copy</a><BR>"
|
||||
dat += "Printing: [copies] copies."
|
||||
dat += "<a href='byond://?src=\ref[src];min=1'>-</a> "
|
||||
dat += "<a href='byond://?src=\ref[src];add=1'>+</a><BR><BR>"
|
||||
else if(toner)
|
||||
dat += "Please insert something to copy.<BR><BR>"
|
||||
ui_interact(user)
|
||||
|
||||
/**
|
||||
* Display the NanoUI window for the photocopier.
|
||||
*
|
||||
* See NanoUI documentation for details.
|
||||
*/
|
||||
/obj/machinery/photocopier/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
user.set_machine(src)
|
||||
|
||||
var/list/data = list()
|
||||
data["copyItem"] = copyitem
|
||||
data["toner"] = toner
|
||||
data["copies"] = copies
|
||||
data["maxCopies"] = maxcopies
|
||||
if(istype(user,/mob/living/silicon))
|
||||
dat += "<a href='byond://?src=\ref[src];aipic=1'>Print photo from database</a><BR><BR>"
|
||||
dat += "Current toner level: [toner]"
|
||||
if(!toner)
|
||||
dat +="<BR>Please insert a new toner cartridge!"
|
||||
user << browse(dat, "window=copier")
|
||||
onclose(user, "copier")
|
||||
return
|
||||
data["isSilicon"] = 1
|
||||
else
|
||||
data["isSilicon"] = null
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "photocopier.tmpl", src.name, 400, 500)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(10)
|
||||
|
||||
/obj/machinery/photocopier/Topic(href, href_list)
|
||||
if(href_list["copy"])
|
||||
@@ -72,22 +80,18 @@
|
||||
break
|
||||
|
||||
use_power(active_power_usage)
|
||||
updateUsrDialog()
|
||||
else if(href_list["remove"])
|
||||
if(copyitem)
|
||||
copyitem.loc = usr.loc
|
||||
usr.put_in_hands(copyitem)
|
||||
usr << "<span class='notice'>You take \the [copyitem] out of \the [src].</span>"
|
||||
copyitem = null
|
||||
updateUsrDialog()
|
||||
else if(href_list["min"])
|
||||
if(copies > 1)
|
||||
copies--
|
||||
updateUsrDialog()
|
||||
else if(href_list["add"])
|
||||
if(copies < maxcopies)
|
||||
copies++
|
||||
updateUsrDialog()
|
||||
else if(href_list["aipic"])
|
||||
if(!istype(usr,/mob/living/silicon)) return
|
||||
if(stat & (BROKEN|NOPOWER)) return
|
||||
@@ -109,7 +113,8 @@
|
||||
p.desc += " - Copied by [tempAI.name]"
|
||||
toner -= 5
|
||||
sleep(15)
|
||||
updateUsrDialog()
|
||||
|
||||
nanomanager.update_uis(src)
|
||||
|
||||
/obj/machinery/photocopier/attackby(obj/item/O as obj, mob/user as mob)
|
||||
if(istype(O, /obj/item/weapon/paper) || istype(O, /obj/item/weapon/photo) || istype(O, /obj/item/weapon/paper_bundle))
|
||||
@@ -119,7 +124,6 @@
|
||||
O.loc = src
|
||||
user << "<span class='notice'>You insert \the [O] into \the [src].</span>"
|
||||
flick(insert_anim, src)
|
||||
updateUsrDialog()
|
||||
else
|
||||
user << "<span class='notice'>There is already something in \the [src].</span>"
|
||||
else if(istype(O, /obj/item/device/toner))
|
||||
@@ -129,7 +133,6 @@
|
||||
var/obj/item/device/toner/T = O
|
||||
toner += T.toner_amount
|
||||
qdel(O)
|
||||
updateUsrDialog()
|
||||
else
|
||||
user << "<span class='notice'>This cartridge is not yet ready for replacement! Use up the rest of the toner.</span>"
|
||||
else if(istype(O, /obj/item/weapon/wrench))
|
||||
|
||||
Reference in New Issue
Block a user