Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions code/modules/paperwork/paper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
dog_fashion = /datum/dog_fashion/head

var/info = "" // What's prewritten on the paper. Appears first and is a special snowflake callback to how paper used to work.
var/coloroverride // A hexadecimal as a string that, if set, overrides the font color of the whole document. Used by photocopiers
var/datum/language/infolang // The language info is written in. If left NULL, info will default to being omnilingual and readable by all.
var/list/written//What's written on the paper by people. Stores /datum/langtext values, plus plaintext values that mark where fields are.
var/stamps //The (text for the) stamps on the paper.
Expand Down Expand Up @@ -66,7 +67,7 @@
if(resistance_flags & ON_FIRE)
icon_state = "paper_onfire"
return
if(info)
if(info || length(written))
icon_state = "paper_words"
return
icon_state = "paper"
Expand Down Expand Up @@ -138,7 +139,10 @@
onclose(usr, "[name]")

/obj/item/paper/proc/render_body(mob/user,links = FALSE)
var/text = info // The actual text displayed. Starts with & defaults to $info.
var/text = ""// The actual text displayed. Starts with & defaults to $info.
if(coloroverride)
text = "<font color='#[coloroverride]'>"
text += info
if(istype(infolang) && !user.has_language(infolang))
var/datum/language/paperlang = GLOB.language_datum_instances[infolang]
text = paperlang.scramble_HTML(text)
Expand All @@ -156,6 +160,8 @@
text += "<span class=\"paper_field\">" + "<font face=\"[PEN_FONT]\"><A href='?src=[REF(src)];write=[i]'>write</A></font>" + "</span>"
if(links)
text += "<span class=\"paper_field\">" + "<font face=\"[PEN_FONT]\"><A href='?src=[REF(src)];write=end'>write</A></font>" + "</span>"
if(coloroverride)
text += "</font>"
return text

/obj/item/paper/proc/clearpaper()
Expand Down Expand Up @@ -253,7 +259,7 @@
if(id == "end")
written += templist
else
written.Insert(id,templist)
written.Insert(text2num(id),templist) // text2num, otherwise it writes to the hashtable index instead of into the array
usr << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[render_body(usr,TRUE)]<HR>[stamps]</BODY><div align='right'style='position:fixed;bottom:0;font-style:bold;'><A href='?src=[REF(src)];help=1'>\[?\]</A></div></HTML>", "window=[name]") // Update the window
update_icon()

Expand Down
32 changes: 22 additions & 10 deletions code/modules/paperwork/photocopier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/*
* Photocopier
*/

/obj/machinery/photocopier
name = "photocopier"
desc = "Used to copy important documents and anatomy studies."
Expand Down Expand Up @@ -51,6 +52,10 @@
user << browse(dat, "window=copier")
onclose(user, "copier")

/obj/machinery/photocopier/proc/clearcolor(text) // Breaks all font color spans in the HTML text.
return replacetext(replacetext(text, "<font face=\"[CRAYON_FONT]\" color=", "<font face=\"[CRAYON_FONT]\" nocolor="), "<font face=\"[PEN_FONT]\" color=", "<font face=\"[PEN_FONT]\" nocolor=") //This basically just breaks the existing color tag, which we need to do because the innermost tag takes priority.


/obj/machinery/photocopier/Topic(href, href_list)
if(..())
return
Expand All @@ -66,16 +71,22 @@
copy_as_paper = 0
if(copy_as_paper)
var/obj/item/paper/c = new /obj/item/paper (loc)
if(length(copy.info) > 0) //Only print and add content if the copied doc has words on it
if(length(copy.info) || length(copy.written)) //Only print and add content if the copied doc has words on it
if(toner > 10) //lots of toner, make it dark
c.info = "<font color = #101010>"
c.coloroverride = "101010"
else //no toner? shitty copies for you!
c.info = "<font color = #808080>"
var/copied = copy.info
copied = replacetext(copied, "<font face=\"[PEN_FONT]\" color=", "<font face=\"[PEN_FONT]\" nocolor=") //state of the art techniques in action
copied = replacetext(copied, "<font face=\"[CRAYON_FONT]\" color=", "<font face=\"[CRAYON_FONT]\" nocolor=") //This basically just breaks the existing color tag, which we need to do because the innermost tag takes priority.
c.info += copied
c.info += "</font>"
c.coloroverride = "808080"
var/copyinfo = copy.info
copyinfo = clearcolor(copyinfo)
c.info += copyinfo + "</font>"
//Now for copying the new $written var
for(var/L in copy.written)
if(istype(L,/datum/langtext))
var/datum/langtext/oldL = L
var/datum/langtext/newL = new(clearcolor(oldL.text),oldL.lang)
c.written += newL
else
c.written += L
c.name = copy.name
c.fields = copy.fields
c.update_icon()
Expand Down Expand Up @@ -114,7 +125,7 @@
for(var/i = 0, i < copies, i++)
var/icon/temp_img
if(ishuman(ass) && (ass.get_item_by_slot(SLOT_W_UNIFORM) || ass.get_item_by_slot(SLOT_WEAR_SUIT)))
to_chat(usr, "<span class='notice'>You feel kind of silly, copying [ass == usr ? "your" : ass][ass == usr ? "" : "\'s"] ass with [ass == usr ? "your" : "[ass.p_their()]"] clothes on.</span>" )
to_chat(usr, "<span class='notice'>You feel kind of silly, copying [ass == usr ? "your" : ass][ass == usr ? "" : "\'s"] ass with [ass == usr ? "your" : "[ass.p_their()]"] clothes on.</span>" ) // '
break
else if(toner >= 5 && !busy && check_ass()) //You have to be sitting on the copier and either be a xeno or a human without clothes on.
if(isalienadult(ass) || istype(ass, /mob/living/simple_animal/hostile/alien)) //Xenos have their own asses, thanks to Pybro.
Expand Down Expand Up @@ -239,7 +250,7 @@
if(!user.temporarilyRemoveItemFromInventory(O))
return
qdel(O)
toner = 40
toner = initial(toner)
to_chat(user, "<span class='notice'>You insert [O] into [src].</span>")
updateUsrDialog()
else
Expand Down Expand Up @@ -332,3 +343,4 @@
grind_results = list(/datum/reagent/iodine = 40, /datum/reagent/iron = 10)
var/charges = 5
var/max_charges = 5