Improve the bureaucracy system (#61323)

Adds a blank printing system.

Virtually every Space Station 13 server has its own system of bureaucracy. As a rule, it is some kind of Wiki page with markup tags and a few sample forms. And that's usually the end of it. With stamps and a filing system in place, people rarely use them. This PR takes it upon itself to remedy this situation by introducing form standards into the game itself and adding the ability to print them.

Co-authored-by: twilightwanderer <twilightwanderer@users.noreply.github.com>
Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
This commit is contained in:
twilightwanderer
2021-11-18 21:53:18 +03:00
committed by GitHub
parent cef269dea3
commit 4a5eacf34a
3 changed files with 924 additions and 4 deletions
+41 -1
View File
@@ -43,6 +43,8 @@
var/color_mode = PHOTO_COLOR
/// Indicates whether the printer is currently busy copying or not.
var/busy = FALSE
/// Variable needed to determine the selected category of forms on Photocopier.js
var/category
/obj/machinery/photocopier/Initialize(mapload)
. = ..()
@@ -59,7 +61,18 @@
var/list/data = list()
data["has_item"] = !copier_empty()
data["num_copies"] = num_copies
try
var/list/blanks = json_decode(file2text("config/blanks.json"))
if (blanks != null)
data["blanks"] = blanks
data["category"] = category
data["forms_exist"] = TRUE
else
data["forms_exist"] = FALSE
catch()
data["forms_exist"] = FALSE
if(photo_copy)
data["is_photo"] = TRUE
data["color_mode"] = color_mode
@@ -160,6 +173,27 @@
if("set_copies")
num_copies = clamp(text2num(params["num_copies"]), 1, MAX_COPIES_AT_ONCE)
return TRUE
// Changes the forms displayed on Photocopier.js when you switch categories
if("choose_category")
category = params["category"]
return TRUE
// Called when you press print blank
if("print_blank")
if(busy)
to_chat(usr, span_warning("[src] is currently busy copying something. Please wait until it is finished."))
return FALSE
if (toner_cartridge.charges - PAPER_TONER_USE < 0)
to_chat(usr, span_warning("There is not enough toner in [src] to print the form, please replace the cartridge."))
return FALSE
do_copy_loop(CALLBACK(src, .proc/make_blank_print), usr)
var/obj/item/paper/printblank = new /obj/item/paper (loc)
var/printname = params["name"]
var/list/printinfo
for(var/infoline as anything in params["info"])
printinfo += infoline
printblank.name = printname
printblank.info = printinfo
return printblank
/**
* Determines if the photocopier has enough toner to create `num_copies` amount of copies of the currently inserted item.
@@ -266,6 +300,12 @@
give_pixel_offset(copied_doc)
toner_cartridge.charges -= DOCUMENT_TONER_USE
/**
* The procedure is called when printing a blank to write off toner consumption.
*/
/obj/machinery/photocopier/proc/make_blank_print()
toner_cartridge.charges -= PAPER_TONER_USE
/**
* Handles the copying of an ass photo.
*