Skip to content

Commit

Permalink
Improve the bureaucracy system (#61323)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Co-authored-by: tralezab <[email protected]>
Co-authored-by: Aleksej Komarov <[email protected]>
  • Loading branch information
4 people authored Nov 18, 2021
1 parent cef269d commit 4a5eacf
Show file tree
Hide file tree
Showing 3 changed files with 924 additions and 4 deletions.
42 changes: 41 additions & 1 deletion code/modules/paperwork/photocopier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
. = ..()
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*
Expand Down
Loading

0 comments on commit 4a5eacf

Please sign in to comment.