|
7 | 7 | icon_screen = "explosive" |
8 | 8 | light_color = "#a91515" |
9 | 9 | initial_access = list(access_armory) |
10 | | - var/screen = 0 // 0 - No Access Denied, 1 - Access allowed |
| 10 | + var/locked = FALSE |
11 | 11 |
|
12 | 12 | /obj/machinery/computer/prisoner/interface_interact(user) |
13 | 13 | interact(user) |
14 | 14 | return TRUE |
15 | 15 |
|
16 | 16 | /obj/machinery/computer/prisoner/interact(var/mob/user) |
17 | | - var/dat |
| 17 | + var/dat = list() |
18 | 18 | dat += "<B>Prisoner Implant Manager System</B><BR>" |
19 | | - if(screen == 0) |
| 19 | + if(locked) |
20 | 20 | dat += "<HR><A href='byond://?src=\ref[src];lock=1'>Unlock Console</A>" |
21 | | - else if(screen == 1) |
| 21 | + else |
22 | 22 | dat += "<HR>Chemical Implants<BR>" |
23 | | - var/turf/Tr = null |
24 | | - for(var/obj/item/implant/chem/C in global.chem_implants) |
25 | | - Tr = get_turf(C) |
26 | | - if((Tr) && !LEVELS_ARE_Z_CONNECTED(Tr.z, src.z)) continue // Out of range |
27 | | - if(!C.implanted) continue |
28 | | - dat += "[C.imp_in.name] | Remaining Units: [C.reagents.total_volume] | Inject: " |
29 | | - dat += "<A href='byond://?src=\ref[src];inject1=\ref[C]'>(<font color=red>(1)</font>)</A>" |
30 | | - dat += "<A href='byond://?src=\ref[src];inject5=\ref[C]'>(<font color=red>(5)</font>)</A>" |
31 | | - dat += "<A href='byond://?src=\ref[src];inject10=\ref[C]'>(<font color=red>(10)</font>)</A><BR>" |
| 23 | + for(var/obj/item/implant/chem/chem_implant in global.chem_implants) |
| 24 | + var/turf/implant_turf = get_turf(chem_implant) |
| 25 | + if(implant_turf && !LEVELS_ARE_Z_CONNECTED(implant_turf.z, src.z)) |
| 26 | + continue // Out of range |
| 27 | + if(!chem_implant.implanted) |
| 28 | + continue |
| 29 | + dat += "[chem_implant.imp_in.name] | Remaining Units: [chem_implant.reagents.total_volume] | Inject: " |
| 30 | + dat += "<A href='byond://?src=\ref[src];inject=\ref[chem_implant];amount=1'>(<font color=red>(1)</font>)</A>" |
| 31 | + dat += "<A href='byond://?src=\ref[src];inject=\ref[chem_implant];amount=5'>(<font color=red>(5)</font>)</A>" |
| 32 | + dat += "<A href='byond://?src=\ref[src];inject=\ref[chem_implant];amount=10'>(<font color=red>(10)</font>)</A><BR>" |
32 | 33 | dat += "********************************<BR>" |
33 | 34 | dat += "<HR>Tracking Implants<BR>" |
34 | | - for(var/obj/item/implant/tracking/T in global.tracking_implants) |
35 | | - Tr = get_turf(T) |
36 | | - if((Tr) && !LEVELS_ARE_Z_CONNECTED(Tr.z, src.z)) continue // Out of range |
37 | | - if(!T.implanted) continue |
38 | | - var/loc_display = "Space" |
39 | | - var/mob/living/M = T.imp_in |
40 | | - if(!isspaceturf(M.loc)) |
41 | | - var/turf/mob_loc = get_turf(M) |
42 | | - loc_display = mob_loc.loc |
43 | | - if(T.malfunction) |
| 35 | + for(var/obj/item/implant/tracking/tracking_implant in global.tracking_implants) |
| 36 | + var/turf/implant_turf = get_turf(tracking_implant) |
| 37 | + if(implant_turf && !LEVELS_ARE_Z_CONNECTED(implant_turf.z, src.z)) |
| 38 | + continue // Out of range |
| 39 | + if(!tracking_implant.implanted) |
| 40 | + continue |
| 41 | + var/area/tracked_area = get_area(tracking_implant) |
| 42 | + var/loc_display = tracked_area.proper_name |
| 43 | + if(tracking_implant.malfunction) |
44 | 44 | loc_display = pick(teleportlocs) |
45 | | - dat += "ID: [T.id] | Location: [loc_display]<BR>" |
46 | | - dat += "<A href='byond://?src=\ref[src];warn=\ref[T]'>(<font color=red><i>Message Holder</i></font>)</A> |<BR>" |
| 45 | + dat += "ID: [tracking_implant.id] | Location: [loc_display]<BR>" |
| 46 | + dat += "<A href='byond://?src=\ref[src];warn=\ref[tracking_implant]'>(<font color=red><i>Message Holder</i></font>)</A> |<BR>" |
47 | 47 | dat += "********************************<BR>" |
48 | 48 | dat += "<HR><A href='byond://?src=\ref[src];lock=1'>Lock Console</A>" |
49 | 49 |
|
50 | | - show_browser(user, dat, "window=computer;size=400x500") |
| 50 | + show_browser(user, JOINTEXT(dat), "window=computer;size=400x500") |
51 | 51 | onclose(user, "computer") |
52 | 52 |
|
53 | 53 | /obj/machinery/computer/prisoner/OnTopic(mob/user, href_list) |
54 | 54 | if((. = ..())) |
55 | 55 | return |
56 | | - . = TOPIC_REFRESH |
57 | 56 |
|
58 | | - if(href_list["inject1"]) |
59 | | - var/obj/item/implant/I = locate(href_list["inject1"]) |
60 | | - if(I) I.activate(1) |
61 | | - |
62 | | - else if(href_list["inject5"]) |
63 | | - var/obj/item/implant/I = locate(href_list["inject5"]) |
64 | | - if(I) I.activate(5) |
65 | | - |
66 | | - else if(href_list["inject10"]) |
67 | | - var/obj/item/implant/I = locate(href_list["inject10"]) |
68 | | - if(I) I.activate(10) |
| 57 | + if(href_list["inject"]) |
| 58 | + var/obj/item/implant/chem/chem_implant = locate(href_list["inject"]) |
| 59 | + if(!chem_implant) |
| 60 | + return TOPIC_REFRESH // evidently their copy of the UI is out of date |
| 61 | + if(!istype(chem_implant)) // exists but is not a chem implant |
| 62 | + // warn that this is likely an href hacking attempt |
| 63 | + PRINT_STACK_TRACE("Possible HREF hacking attempt, chem implant inject called on non-chem-implant!") |
| 64 | + message_admins("Possible HREF hacking attempt, chem implant inject called on [href_list["inject"]] by [user] (ckey [(user.ckey)])!") |
| 65 | + return TOPIC_HANDLED |
| 66 | + var/amount_to_inject = clamp(text2num(href_list["amount"]), 1, 10) // don't let href hacking give more than 10 units at once |
| 67 | + chem_implant.activate(amount_to_inject) |
| 68 | + return TOPIC_HANDLED |
69 | 69 |
|
70 | 70 | else if(href_list["lock"]) |
71 | 71 | if(allowed(user)) |
72 | | - screen = !screen |
| 72 | + locked = !locked |
| 73 | + return TOPIC_REFRESH |
73 | 74 | else |
74 | 75 | to_chat(user, "Unauthorized Access.") |
| 76 | + return TOPIC_HANDLED |
75 | 77 |
|
76 | 78 | else if(href_list["warn"]) |
77 | 79 | var/warning = sanitize(input(user,"Message:","Enter your message here!","")) |
78 | | - if(!warning) return TOPIC_HANDLED |
79 | | - var/obj/item/implant/I = locate(href_list["warn"]) |
80 | | - if(I?.imp_in) |
81 | | - var/mob/living/victim = I.imp_in |
82 | | - to_chat(victim, "<span class='notice'>You hear a voice in your head saying: '[warning]'</span>") |
| 80 | + if(!warning) |
| 81 | + return TOPIC_HANDLED |
| 82 | + var/obj/item/implant/tracking/tracker = locate(href_list["warn"]) |
| 83 | + if(!tracker) |
| 84 | + return TOPIC_REFRESH // evidently their copy of the UI is out of date |
| 85 | + if(!istype(tracker)) // exists but is not a tracking implant |
| 86 | + // warn that this is likely an href hacking attempt |
| 87 | + PRINT_STACK_TRACE("Possible HREF hacking attempt, tracking implant warn called on non-tracking-implant!") |
| 88 | + message_admins("Possible HREF hacking attempt, tracking implant warn called on [href_list["warn"]] by [user] (ckey [(user.ckey)])!") |
| 89 | + return TOPIC_HANDLED |
| 90 | + to_chat(tracker.imp_in, SPAN_NOTICE("You hear a voice in your head saying: '[warning]'")) |
| 91 | + return TOPIC_HANDLED |
| 92 | + return TOPIC_NOACTION |
0 commit comments