mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Allows fluff computers to have admin-specified HTML content (#20797)
* Makes fluff computers not fluff * Fixes up
This commit is contained in:
@@ -41,6 +41,9 @@
|
||||
/datum/browser/proc/add_stylesheet(name, file)
|
||||
stylesheets[name] = file
|
||||
|
||||
/datum/browser/proc/remove_stylesheets()
|
||||
stylesheets = list()
|
||||
|
||||
/datum/browser/proc/add_script(name, file)
|
||||
scripts[name] = file
|
||||
|
||||
|
||||
@@ -4,12 +4,49 @@
|
||||
#define DENY_TOO_OLD 1
|
||||
|
||||
/obj/machinery/computer/fluff
|
||||
|
||||
var/window_data = "" //HTML to display to users
|
||||
var/window_width = 300
|
||||
var/window_height = 300
|
||||
var/allow_silicons = TRUE
|
||||
|
||||
|
||||
var/deny_type = DENY_ACCESS_DENIED
|
||||
|
||||
/obj/machinery/computer/fluff/attack_ai(mob/user)
|
||||
return attack_hand(user)
|
||||
if(isAdminGhost(user))
|
||||
|
||||
//Some shitty-ass documentation here
|
||||
to_chat(user, "The following Topic() tags are handled: <b>notify_admin</b> (sends a notification to all admins), <b>notify_user</b> (displays a message to the user), <b>shutoff</b> (turns off the computer and erases all HTML). \ref\[src\] is added automatically to links. Keep HTML tags lowercase unless you don't want your links processed.")
|
||||
to_chat(user, "Link format: \<a href='notify_admin=Button pressed;shutoff=1'\>Button!\</a\>")
|
||||
|
||||
var/new_window_data = input("Input new data to be displayed on this computer.", "Custom computer crafting", window_data) as null|message
|
||||
if(isnull(new_window_data))
|
||||
return
|
||||
var/new_window_width = input("Input new window width", "Custom computer crafting", window_width) as null|num
|
||||
var/new_window_height = input("Input new window height", "Custom computer crafting", window_height) as null|num
|
||||
|
||||
//Fix all links so that they actually call Topic() on this computer
|
||||
//To prevent this replacetext from fucking up already fixed links, the 'a' tag is replaced with an uppercase 'A'. The case-sensitive replacetext will not touch it afterwards
|
||||
window_data = replacetextEx(new_window_data, "<a href='", "<A href='?src=\ref[src];")
|
||||
|
||||
window_width = new_window_width
|
||||
window_height = new_window_height
|
||||
|
||||
message_admins("[key_name(usr)] has modified the custom computer [src] ([formatJumpTo(src)])")
|
||||
log_admin("[key_name(usr)] has set the custom computer [src] ([formatJumpTo(src)]) to display: [window_data]")
|
||||
|
||||
if(allow_silicons)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/fluff/attack_hand(mob/user)
|
||||
if(window_data)
|
||||
var/datum/browser/popup = new(user, "customcomp", "[src]", window_width, window_height, src)
|
||||
popup.remove_stylesheets()
|
||||
popup.set_content(window_data)
|
||||
popup.open()
|
||||
return
|
||||
|
||||
switch(deny_type)
|
||||
if(DENY_ACCESS_DENIED)
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
@@ -20,6 +57,21 @@
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The buttons don't seem to do anything.</span>")
|
||||
|
||||
/obj/machinery/computer/fluff/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(href_list["notify_admin"])
|
||||
message_admins("Incoming notification from the custom computer '[src]' [formatJumpTo(src)] (sent by [key_name(usr)]): [href_list["notify_admin"]]")
|
||||
|
||||
if(href_list["notify_user"])
|
||||
to_chat(usr, "[bicon(src)][href_list["notify_user"]]")
|
||||
|
||||
if(href_list["shutoff"])
|
||||
window_data = " "
|
||||
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/computer/fluff/emag(mob/user)
|
||||
if(user)
|
||||
to_chat(user, "<span class='notice'>You hold the cryptographic sequencer up to the ID scanner. Nothing happens.</span>")
|
||||
|
||||
Reference in New Issue
Block a user