mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-24 04:28:12 +01:00
Merge pull request #9062 from ShadowLarkens/tgui_finale
NanoUI Goes To Brazil
This commit is contained in:
@@ -17,8 +17,10 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
|
||||
active_power_usage = 200
|
||||
circuit = /obj/item/weapon/circuitboard/fax
|
||||
|
||||
var/obj/item/weapon/card/id/scan = null // identification
|
||||
var/authenticated = 0
|
||||
var/obj/item/weapon/card/id/scan = null
|
||||
var/authenticated = null
|
||||
var/rank = null
|
||||
|
||||
var/sendcooldown = 0 // to avoid spamming fax messages
|
||||
var/department = "Unknown" // our department
|
||||
var/destination = null // the department we're sending to
|
||||
@@ -33,91 +35,101 @@ 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)
|
||||
|
||||
ui_interact(user)
|
||||
tgui_interact(user)
|
||||
|
||||
/**
|
||||
* 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)
|
||||
/obj/machinery/photocopier/faxmachine/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "Fax", name)
|
||||
ui.open()
|
||||
|
||||
var/list/data = list()
|
||||
if(scan)
|
||||
data["scanName"] = scan.name
|
||||
else
|
||||
data["scanName"] = null
|
||||
data["bossName"] = using_map.boss_name
|
||||
/obj/machinery/photocopier/faxmachine/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
|
||||
var/list/data = ..()
|
||||
data["scan"] = scan ? scan.name : null
|
||||
data["authenticated"] = authenticated
|
||||
data["rank"] = rank
|
||||
data["isAI"] = isAI(user)
|
||||
data["isRobot"] = isrobot(user)
|
||||
|
||||
data["bossName"] = using_map.boss_name
|
||||
data["copyItem"] = copyitem
|
||||
if(copyitem)
|
||||
data["copyItemName"] = copyitem.name
|
||||
else
|
||||
data["copyItemName"] = null
|
||||
data["cooldown"] = sendcooldown
|
||||
data["destination"] = destination
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "fax.tmpl", src.name, 500, 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.
|
||||
return data
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/Topic(href, href_list)
|
||||
if(href_list["send"])
|
||||
if(copyitem)
|
||||
if (destination in admin_departments)
|
||||
send_admin_fax(usr, destination)
|
||||
else
|
||||
sendfax(destination)
|
||||
/obj/machinery/photocopier/faxmachine/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
if (sendcooldown)
|
||||
spawn(sendcooldown) // cooldown time
|
||||
sendcooldown = 0
|
||||
|
||||
else if(href_list["remove"])
|
||||
if(copyitem)
|
||||
if(get_dist(usr, src) >= 2)
|
||||
to_chat(usr, "\The [copyitem] is too far away for you to remove it.")
|
||||
return
|
||||
copyitem.loc = usr.loc
|
||||
usr.put_in_hands(copyitem)
|
||||
to_chat(usr, "<span class='notice'>You take \the [copyitem] out of \the [src].</span>")
|
||||
copyitem = null
|
||||
|
||||
if(href_list["scan"])
|
||||
if (scan)
|
||||
if(ishuman(usr))
|
||||
scan.loc = usr.loc
|
||||
if(!usr.get_active_hand())
|
||||
switch(action)
|
||||
if("scan")
|
||||
if(scan)
|
||||
scan.forceMove(loc)
|
||||
if(ishuman(usr) && !usr.get_active_hand())
|
||||
usr.put_in_hands(scan)
|
||||
scan = null
|
||||
else
|
||||
scan.loc = src.loc
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if(istype(I, /obj/item/weapon/card/id))
|
||||
usr.drop_item()
|
||||
I.forceMove(src)
|
||||
scan = I
|
||||
return TRUE
|
||||
if("login")
|
||||
var/login_type = text2num(params["login_type"])
|
||||
if(login_type == LOGIN_TYPE_NORMAL && istype(scan))
|
||||
if(check_access(scan))
|
||||
authenticated = scan.registered_name
|
||||
rank = scan.assignment
|
||||
else if(login_type == LOGIN_TYPE_AI && isAI(usr))
|
||||
authenticated = usr.name
|
||||
rank = "AI"
|
||||
else if(login_type == LOGIN_TYPE_ROBOT && isrobot(usr))
|
||||
authenticated = usr.name
|
||||
var/mob/living/silicon/robot/R = usr
|
||||
rank = "[R.modtype] [R.braintype]"
|
||||
return TRUE
|
||||
if("logout")
|
||||
if(scan)
|
||||
scan.forceMove(loc)
|
||||
if(ishuman(usr) && !usr.get_active_hand())
|
||||
usr.put_in_hands(scan)
|
||||
scan = null
|
||||
else
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if (istype(I, /obj/item/weapon/card/id) && usr.unEquip(I))
|
||||
I.loc = src
|
||||
scan = I
|
||||
authenticated = 0
|
||||
authenticated = null
|
||||
return TRUE
|
||||
if("remove")
|
||||
if(copyitem)
|
||||
if(get_dist(usr, src) >= 2)
|
||||
to_chat(usr, "\The [copyitem] is too far away for you to remove it.")
|
||||
return
|
||||
copyitem.forceMove(loc)
|
||||
usr.put_in_hands(copyitem)
|
||||
to_chat(usr, "<span class='notice'>You take \the [copyitem] out of \the [src].</span>")
|
||||
copyitem = null
|
||||
|
||||
if(href_list["dept"])
|
||||
var/lastdestination = destination
|
||||
destination = input(usr, "Which department?", "Choose a department", "") as null|anything in (alldepartments + admin_departments)
|
||||
if(!destination) destination = lastdestination
|
||||
if(!authenticated)
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("send")
|
||||
if(copyitem)
|
||||
if (destination in admin_departments)
|
||||
send_admin_fax(usr, destination)
|
||||
else
|
||||
sendfax(destination)
|
||||
|
||||
if(href_list["auth"])
|
||||
if ( (!( authenticated ) && (scan)) )
|
||||
if (check_access(scan))
|
||||
authenticated = 1
|
||||
if (sendcooldown)
|
||||
spawn(sendcooldown) // cooldown time
|
||||
sendcooldown = 0
|
||||
|
||||
if(href_list["logout"])
|
||||
authenticated = 0
|
||||
if("dept")
|
||||
var/lastdestination = destination
|
||||
destination = input(usr, "Which department?", "Choose a department", "") as null|anything in (alldepartments + admin_departments)
|
||||
if(!destination)
|
||||
destination = lastdestination
|
||||
|
||||
SSnanoui.update_uis(src)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/attackby(obj/item/O as obj, mob/user as mob)
|
||||
if(O.is_multitool() && panel_open)
|
||||
|
||||
@@ -33,33 +33,71 @@
|
||||
/obj/machinery/photocopier/attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
|
||||
ui_interact(user)
|
||||
tgui_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["assPresent"] = has_buckled_mobs()
|
||||
data["toner"] = toner
|
||||
data["copies"] = copies
|
||||
data["maxCopies"] = maxcopies
|
||||
if(istype(user,/mob/living/silicon))
|
||||
data["isSilicon"] = 1
|
||||
else
|
||||
data["isSilicon"] = null
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "photocopier.tmpl", src.name, 300, 250)
|
||||
ui.set_initial_data(data)
|
||||
/obj/machinery/photocopier/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, "Photocopier", name)
|
||||
ui.open()
|
||||
ui.set_auto_update(10)
|
||||
|
||||
/obj/machinery/photocopier/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
|
||||
var/list/data = ..()
|
||||
|
||||
data["has_item"] = copyitem || has_buckled_mobs() // VOREStation Edit: Ass copying
|
||||
data["isAI"] = issilicon(user)
|
||||
data["can_AI_print"] = (toner >= 5)
|
||||
data["has_toner"] = !!toner
|
||||
data["current_toner"] = toner
|
||||
data["max_toner"] = 40
|
||||
data["num_copies"] = copies
|
||||
data["max_copies"] = maxcopies
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/photocopier/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("make_copy")
|
||||
addtimer(CALLBACK(src, .proc/copy_operation, usr), 0)
|
||||
. = TRUE
|
||||
if("remove")
|
||||
if(copyitem)
|
||||
copyitem.loc = usr.loc
|
||||
usr.put_in_hands(copyitem)
|
||||
to_chat(usr, "<span class='notice'>You take \the [copyitem] out of \the [src].</span>")
|
||||
copyitem = null
|
||||
else if(has_buckled_mobs())
|
||||
to_chat(buckled_mobs[1], "<span class='notice'>You feel a slight pressure on your ass.</span>") // It can't eject your asscheeks, but it'll try.
|
||||
. = TRUE
|
||||
if("set_copies")
|
||||
copies = clamp(text2num(params["num_copies"]), 1, maxcopies)
|
||||
. = TRUE
|
||||
if("ai_photo")
|
||||
if(!issilicon(usr))
|
||||
return
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
if(toner >= 5)
|
||||
var/mob/living/silicon/tempAI = usr
|
||||
var/obj/item/device/camera/siliconcam/camera = tempAI.aiCamera
|
||||
|
||||
if(!camera)
|
||||
return
|
||||
var/obj/item/weapon/photo/selection = camera.selectpicture()
|
||||
if (!selection)
|
||||
return
|
||||
|
||||
var/obj/item/weapon/photo/p = photocopy(selection)
|
||||
if (p.desc == "")
|
||||
p.desc += "Copied by [tempAI.name]"
|
||||
else
|
||||
p.desc += " - Copied by [tempAI.name]"
|
||||
toner -= 5
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/photocopier/proc/copy_operation(var/mob/user)
|
||||
if(copying)
|
||||
@@ -104,51 +142,6 @@
|
||||
use_power(active_power_usage)
|
||||
copying = FALSE
|
||||
|
||||
/obj/machinery/photocopier/Topic(href, href_list)
|
||||
if(href_list["copy"])
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
addtimer(CALLBACK(src, .proc/copy_operation, usr), 0)
|
||||
|
||||
else if(href_list["remove"])
|
||||
if(copyitem)
|
||||
copyitem.loc = usr.loc
|
||||
usr.put_in_hands(copyitem)
|
||||
to_chat(usr, "<span class='notice'>You take \the [copyitem] out of \the [src].</span>")
|
||||
copyitem = null
|
||||
else if(has_buckled_mobs())
|
||||
to_chat(buckled_mobs[1], "<span class='notice'>You feel a slight pressure on your ass.</span>") // It can't eject your asscheeks, but it'll try.
|
||||
return TOPIC_REFRESH
|
||||
else if(href_list["min"])
|
||||
if(copies > 1)
|
||||
copies--
|
||||
else if(href_list["add"])
|
||||
if(copies < maxcopies)
|
||||
copies++
|
||||
else if(href_list["aipic"])
|
||||
if(!istype(usr,/mob/living/silicon)) return
|
||||
if(stat & (BROKEN|NOPOWER)) return
|
||||
|
||||
if(toner >= 5)
|
||||
var/mob/living/silicon/tempAI = usr
|
||||
var/obj/item/device/camera/siliconcam/camera = tempAI.aiCamera
|
||||
|
||||
if(!camera)
|
||||
return
|
||||
var/obj/item/weapon/photo/selection = camera.selectpicture()
|
||||
if (!selection)
|
||||
return
|
||||
|
||||
var/obj/item/weapon/photo/p = photocopy(selection)
|
||||
if (p.desc == "")
|
||||
p.desc += "Copied by [tempAI.name]"
|
||||
else
|
||||
p.desc += " - Copied by [tempAI.name]"
|
||||
toner -= 5
|
||||
sleep(15)
|
||||
|
||||
SSnanoui.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))
|
||||
if(!copyitem)
|
||||
|
||||
Reference in New Issue
Block a user