mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-23 05:07:51 +01:00
Configuration Controller (#7857)
This commit is contained in:
@@ -461,16 +461,16 @@ Extracted to its own procedure for easier logic handling with paper bundles.
|
||||
if (istype(fax, /obj/item/weapon/paper))
|
||||
var/obj/item/weapon/paper/P = fax
|
||||
var/text = "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[P.info][P.stamps]</BODY></HTML>";
|
||||
file("[config.fax_export_dir]/fax_[faxid].html") << text;
|
||||
file("[CONFIG_GET(string/fax_export_dir)]/fax_[faxid].html") << text; // CHOMPEdit
|
||||
else if (istype(fax, /obj/item/weapon/photo))
|
||||
var/obj/item/weapon/photo/H = fax
|
||||
fcopy(H.img, "[config.fax_export_dir]/photo_[faxid].png")
|
||||
fcopy(H.img, "[CONFIG_GET(string/fax_export_dir)]/photo_[faxid].png") // CHOMPEdit
|
||||
var/text = "<html><head><title>[H.name]</title></head>" \
|
||||
+ "<body style='overflow:hidden;margin:0;text-align:center'>" \
|
||||
+ "<img src='photo_[faxid].png'>" \
|
||||
+ "[H.scribble ? "<br>Written on the back:<br><i>[H.scribble]</i>" : ""]"\
|
||||
+ "</body></html>"
|
||||
file("[config.fax_export_dir]/fax_[faxid].html") << text
|
||||
file("[CONFIG_GET(string/fax_export_dir)]/fax_[faxid].html") << text // CHOMPEdit
|
||||
else if (istype(fax, /obj/item/weapon/paper_bundle))
|
||||
var/obj/item/weapon/paper_bundle/B = fax
|
||||
var/data = ""
|
||||
@@ -479,7 +479,7 @@ Extracted to its own procedure for easier logic handling with paper bundles.
|
||||
var/page_faxid = export_fax(pageobj)
|
||||
data += "<a href='fax_[page_faxid].html'>Page [page] - [pageobj.name]</a><br>"
|
||||
var/text = "<html><head><title>[B.name]</title></head><body>[data]</body></html>"
|
||||
file("[config.fax_export_dir]/fax_[faxid].html") << text
|
||||
file("[CONFIG_GET(string/fax_export_dir)]/fax_[faxid].html") << text // CHOMPEdit
|
||||
return faxid
|
||||
|
||||
|
||||
@@ -488,16 +488,16 @@ Extracted to its own procedure for easier logic handling with paper bundles.
|
||||
* Call the chat webhook to transmit a notification of an admin fax to the admin chat.
|
||||
*/
|
||||
/obj/machinery/photocopier/faxmachine/proc/message_chat_admins(var/mob/sender, var/faxname, var/obj/item/sent, var/faxid, font_colour="#006100")
|
||||
if (config.chat_webhook_url)
|
||||
if (CONFIG_GET(string/chat_webhook_url)) // CHOMPEdit
|
||||
spawn(0)
|
||||
var/query_string = "type=fax"
|
||||
query_string += "&key=[url_encode(config.chat_webhook_key)]"
|
||||
query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" // CHOMPEdit
|
||||
query_string += "&faxid=[url_encode(faxid)]"
|
||||
query_string += "&color=[url_encode(font_colour)]"
|
||||
query_string += "&faxname=[url_encode(faxname)]"
|
||||
query_string += "&sendername=[url_encode(sender.name)]"
|
||||
query_string += "&sentname=[url_encode(sent.name)]"
|
||||
world.Export("[config.chat_webhook_url]?[query_string]")
|
||||
world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") // CHOMPEdit
|
||||
|
||||
|
||||
|
||||
@@ -506,13 +506,12 @@ Extracted to its own procedure for easier logic handling with paper bundles.
|
||||
* Call the chat webhook to transmit a notification of a job request
|
||||
*/
|
||||
/obj/machinery/photocopier/faxmachine/proc/message_chat_rolerequest(var/font_colour="#006100", var/role_to_ping, var/reason, var/jobname)
|
||||
if(config.chat_webhook_url)
|
||||
if(CONFIG_GET(string/chat_webhook_url)) // CHOMPEdit
|
||||
spawn(0)
|
||||
var/query_string = "type=rolerequest"
|
||||
query_string += "&key=[url_encode(config.chat_webhook_key)]"
|
||||
query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" // CHOMPEdit
|
||||
query_string += "&ping=[url_encode(role_to_ping)]"
|
||||
query_string += "&color=[url_encode(font_colour)]"
|
||||
query_string += "&reason=[url_encode(reason)]"
|
||||
query_string += "&job=[url_encode(jobname)]"
|
||||
world.Export("[config.chat_webhook_url]?[query_string]")
|
||||
|
||||
world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") // CHOMPEdit
|
||||
|
||||
@@ -56,18 +56,18 @@ var/global/last_fax_role_request
|
||||
* Call the chat webhook to transmit a notification of an admin fax to the admin chat.
|
||||
*/
|
||||
/obj/machinery/photocopier/faxmachine/proc/message_chat_admins(var/mob/sender, var/faxname, var/obj/item/sent, var/faxid, font_colour="#006100")
|
||||
if(config.discord_faxes_disabled) //CHOMPEdit
|
||||
if(CONFIG_GET(flag/discord_faxes_disabled)) //CHOMPEdit
|
||||
return
|
||||
if (config.chat_webhook_url)
|
||||
if (CONFIG_GET(string/chat_webhook_url)) // CHOMPEdit
|
||||
spawn(0)
|
||||
var/query_string = "type=fax"
|
||||
query_string += "&key=[url_encode(config.chat_webhook_key)]"
|
||||
query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]"
|
||||
query_string += "&faxid=[url_encode(faxid)]"
|
||||
query_string += "&color=[url_encode(font_colour)]"
|
||||
query_string += "&faxname=[url_encode(faxname)]"
|
||||
query_string += "&sendername=[url_encode(sender.name)]"
|
||||
query_string += "&sentname=[url_encode(sent.name)]"
|
||||
world.Export("[config.chat_webhook_url]?[query_string]")
|
||||
world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") // CHOMPEdit
|
||||
//YW EDIT //CHOMPEdit also
|
||||
var/idlen = length(faxid) + 1
|
||||
if (istype(sent, /obj/item/weapon/paper_bundle))
|
||||
@@ -76,39 +76,39 @@ var/global/last_fax_role_request
|
||||
var/faxids = "FAXMULTIID: [faxid]_0"
|
||||
var/contents = ""
|
||||
|
||||
if((!config.nodebot_enabled) && config.discord_faxes_autoprint)
|
||||
var/faxmsg = return_file_text("[config.fax_export_dir]/fax_[faxid]_0.html")
|
||||
if((!config.nodebot_enabled) && CONFIG_GET(flag/discord_faxes_autoprint)) // CHOMPEdit
|
||||
var/faxmsg = return_file_text("[CONFIG_GET(string/fax_export_dir)]/fax_[faxid]_0.html") // CHOMPEdit
|
||||
contents += "\nFAX: ```[strip_html_properly(faxmsg)]```"
|
||||
|
||||
for(var/page = 1, page <= B.pages.len, page++)
|
||||
var/curid = "[faxid]_[page]"
|
||||
faxids+= "|[curid]"
|
||||
if((!config.nodebot_enabled) && config.discord_faxes_autoprint)
|
||||
var/faxmsg = return_file_text("[config.fax_export_dir]/fax_[curid].html")
|
||||
if((!config.nodebot_enabled) && CONFIG_GET(flag/discord_faxes_autoprint)) // CHOMPEdit
|
||||
var/faxmsg = return_file_text("[CONFIG_GET(string/fax_export_dir)]/fax_[curid].html") // CHOMPEdit
|
||||
contents += "\nFAX PAGE [page]: ```[strip_html_properly(faxmsg)]```"
|
||||
|
||||
world.TgsTargetedChatBroadcast("MULTIFAX: [sanitize(faxname)] / [sanitize(sent.name)] - SENT BY: [sanitize(sender.name)] - [faxids] [contents]", TRUE)
|
||||
world.TgsTargetedChatBroadcast("MULTIFAX: [sanitize(faxname)] / [sanitize(sent.name)] - SENT BY: [sanitize(sender.name)] - [faxids] [contents]", TRUE)
|
||||
else
|
||||
var/contents = ""
|
||||
if((!config.nodebot_enabled) && config.discord_faxes_autoprint)
|
||||
var/faxmsg = return_file_text("[config.fax_export_dir]/fax_[faxid].html")
|
||||
if((!config.nodebot_enabled) && CONFIG_GET(flag/discord_faxes_autoprint)) // CHOMPEdit
|
||||
var/faxmsg = return_file_text("[CONFIG_GET(string/fax_export_dir)]/fax_[faxid].html") // CHOMPEdit
|
||||
contents += "\nFAX: ```[strip_html_properly(faxmsg)]```"
|
||||
world.TgsTargetedChatBroadcast("FAX: [sanitize(faxname)] / [sanitize(sent.name)] - SENT BY: [sanitize(sender.name)] - FAXID: **[sanitize(faxid)]** [contents]", TRUE)
|
||||
world.TgsTargetedChatBroadcast("FAX: [sanitize(faxname)] / [sanitize(sent.name)] - SENT BY: [sanitize(sender.name)] - FAXID: **[sanitize(faxid)]** [contents]", TRUE)
|
||||
//YW EDIT END
|
||||
|
||||
/**
|
||||
* Call the chat webhook to transmit a notification of a job request
|
||||
*/
|
||||
/obj/machinery/photocopier/faxmachine/proc/message_chat_rolerequest(var/font_colour="#006100", var/role_to_ping, var/reason, var/jobname)
|
||||
if(config.chat_webhook_url)
|
||||
if(CONFIG_GET(string/chat_webhook_url)) // CHOMPEdit
|
||||
spawn(0)
|
||||
var/query_string = "type=rolerequest"
|
||||
query_string += "&key=[url_encode(config.chat_webhook_key)]"
|
||||
query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" // CHOMPEdit
|
||||
query_string += "&ping=[url_encode(role_to_ping)]"
|
||||
query_string += "&color=[url_encode(font_colour)]"
|
||||
query_string += "&reason=[url_encode(reason)]"
|
||||
query_string += "&job=[url_encode(jobname)]"
|
||||
world.Export("[config.chat_webhook_url]?[query_string]")
|
||||
world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") // CHOMPEdit
|
||||
|
||||
//
|
||||
// Overrides/additions to stock defines go here, as well as hooks. Sort them by
|
||||
@@ -198,4 +198,4 @@ var/global/last_fax_role_request
|
||||
|
||||
message_chat_rolerequest(message_color, ping_name, reason, role)
|
||||
last_fax_role_request = world.time
|
||||
to_chat(L, "<span class='notice'>Your request was transmitted.</span>")
|
||||
to_chat(L, "<span class='notice'>Your request was transmitted.</span>")
|
||||
|
||||
Reference in New Issue
Block a user