Multi-Page Faxes and More (#11561)

This commit is contained in:
Geeves
2021-04-10 18:32:23 +02:00
committed by GitHub
parent 016cba448f
commit 612dce10b6
5 changed files with 117 additions and 110 deletions
+7 -10
View File
@@ -220,11 +220,11 @@ var/list/admin_departments
// give the sprite some time to flick
spawn(20)
if (istype(incoming, /obj/item/paper))
copy(incoming, 1, 0, 0)
copy(src, incoming, 1, 0, 0)
else if (istype(incoming, /obj/item/photo))
photocopy(incoming)
photocopy(src, incoming)
else if (istype(incoming, /obj/item/paper_bundle))
bundlecopy(incoming)
bundlecopy(src, incoming)
do_pda_alerts()
use_power(active_power_usage)
@@ -254,11 +254,11 @@ var/list/admin_departments
var/obj/item/rcvdcopy
if (istype(copyitem, /obj/item/paper))
rcvdcopy = copy(copyitem, 0)
rcvdcopy = copy(src, copyitem, 0)
else if (istype(copyitem, /obj/item/photo))
rcvdcopy = photocopy(copyitem)
rcvdcopy = photocopy(src, copyitem)
else if (istype(copyitem, /obj/item/paper_bundle))
rcvdcopy = bundlecopy(copyitem, 0)
rcvdcopy = bundlecopy(src, copyitem, 0)
else
visible_message("[src] beeps, \"Error transmitting message.\"")
return
@@ -306,9 +306,6 @@ var/list/admin_departments
discord_bot.send_to_cciaa(discord_msg)
/obj/machinery/photocopier/faxmachine/proc/do_pda_alerts()
if (!alert_pdas || !alert_pdas.len)
return
for (var/obj/item/modular_computer/pda in alert_pdas)
for(var/obj/item/modular_computer/pda in alert_pdas)
var/message = "New message has arrived!"
pda.get_notification(message, 1, "[department] [name]")
+30 -26
View File
@@ -56,7 +56,7 @@ VUEUI_MONITOR_VARS(/obj/machinery/photocopier, photocopiermonitor)
if(toner <= 0)
break
var/c_type = copy_type()
var/c_type = copy_type(src, copyitem, toner)
if(!c_type) // if there's something that can't be copied
break
@@ -84,7 +84,7 @@ VUEUI_MONITOR_VARS(/obj/machinery/photocopier, photocopiermonitor)
if (!selection)
return
var/obj/item/photo/p = photocopy(selection)
var/obj/item/photo/p = photocopy(src, selection)
if (p.desc == "")
p.desc += "Copied by [tempAI.name]"
else
@@ -124,21 +124,21 @@ VUEUI_MONITOR_VARS(/obj/machinery/photocopier, photocopiermonitor)
to_chat(user, SPAN_NOTICE("You [anchored ? "wrench" : "unwrench"] \the [src]."))
return
/obj/machinery/photocopier/proc/copy_type(var/c_item = copyitem) // helper proc to reduce ctrl+c ctrl+v
/proc/copy_type(var/obj/machinery/target, var/c_item, var/toner, var/do_print = TRUE) // helper proc to reduce ctrl+c ctrl+v
if (istype(c_item, /obj/item/paper))
var/obj/item/paper/C = copy(c_item)
var/obj/item/paper/C = copy(target, c_item, do_print, do_print, 1 SECOND, toner)
sleep(20)
return C
else if (istype(c_item, /obj/item/photo))
var/obj/item/photo/P = photocopy(c_item)
var/obj/item/photo/P = photocopy(target, c_item, toner)
sleep(20)
return P
else if (istype(c_item, /obj/item/paper_bundle))
var/obj/item/paper_bundle/B = bundlecopy(c_item)
var/obj/item/paper_bundle/B = bundlecopy(target, c_item, TRUE, toner)
sleep(15*B.pages.len)
return B
else
to_chat(usr, SPAN_WARNING("\The [c_item] can't be copied by \the [src]."))
to_chat(usr, SPAN_WARNING("\The [c_item] can't be copied by \the [target]."))
return FALSE
/obj/machinery/photocopier/ex_act(severity)
@@ -159,7 +159,7 @@ VUEUI_MONITOR_VARS(/obj/machinery/photocopier, photocopiermonitor)
toner = 0
return
/obj/machinery/photocopier/proc/copy(var/obj/item/paper/copy, var/print = 1, var/use_sound = 1, var/delay = 10) // note: var/delay is the delay from copy to print, it should be less than the sleep in copy_type()
/proc/copy(var/obj/machinery/target, var/obj/item/paper/copy, var/print = TRUE, var/use_sound = TRUE, var/delay = 10, var/toner) // note: var/delay is the delay from copy to print, it should be less than the sleep in copy_type()
var/obj/item/paper/c = new /obj/item/paper()
var/info
var/pname
@@ -195,20 +195,22 @@ VUEUI_MONITOR_VARS(/obj/machinery/photocopier, photocopiermonitor)
toner--
if(toner == 0)
visible_message(SPAN_NOTICE("A red light on \the [src] flashes, indicating that it is out of toner."))
flick("photocopier_notoner", src)
playsound(loc, 'sound/machines/buzz-two.ogg', 75, 1)
target.visible_message(SPAN_NOTICE("A red light on \the [target] flashes, indicating that it is out of toner."))
if(target.type == /obj/machinery/photocopier)
flick("photocopier_notoner", target)
playsound(target.loc, 'sound/machines/buzz-two.ogg', 75, 1)
return
c.set_content_unsafe(pname, info)
if (print)
flick("photocopier_print", src)
src.print(c, use_sound, 'sound/bureaucracy/print.ogg', delay)
if(target.type == /obj/machinery/photocopier)
flick("photocopier_print", target)
target.print(c, use_sound, 'sound/bureaucracy/print.ogg', delay)
return c
/obj/machinery/photocopier/proc/photocopy(var/obj/item/photo/photocopy)
/proc/photocopy(var/obj/machinery/target, var/obj/item/photo/photocopy, var/toner)
var/obj/item/photo/p = photocopy.copy()
p.forceMove(src.loc)
p.forceMove(target.loc)
var/icon/I = icon(photocopy.icon, photocopy.icon_state)
if(toner > 10) //plenty of toner, go straight greyscale
@@ -223,28 +225,30 @@ VUEUI_MONITOR_VARS(/obj/machinery/photocopier, photocopiermonitor)
toner -= 5 //photos use a lot of ink!
if(toner < 0)
toner = 0
visible_message(SPAN_NOTICE("A red light on \the [src] flashes, indicating that it is out of toner."))
flick("photocopier_notoner", src)
playsound(loc, 'sound/machines/buzz-two.ogg', 75, 1)
target.visible_message(SPAN_NOTICE("A red light on \the [target] flashes, indicating that it is out of toner."))
if(target.type == /obj/machinery/photocopier)
flick("photocopier_notoner", target)
playsound(target.loc, 'sound/machines/buzz-two.ogg', 75, 1)
return p
//If need_toner is 0, the copies will still be lightened when low on toner, however it will not be prevented from printing. TODO: Implement print queues for fax machines and get rid of need_toner
/obj/machinery/photocopier/proc/bundlecopy(var/obj/item/paper_bundle/bundle, var/need_toner=1)
var/obj/item/paper_bundle/p = new /obj/item/paper_bundle (src)
/proc/bundlecopy(var/obj/machinery/target, var/obj/item/paper_bundle/bundle, var/need_toner = TRUE, var/toner, var/do_print = TRUE)
var/obj/item/paper_bundle/p = new /obj/item/paper_bundle(target)
for(var/obj/item/W in bundle.pages)
if(toner <= 0 && need_toner)
toner = 0
visible_message(SPAN_NOTICE("A red light on \the [src] flashes, indicating that it is out of toner."))
flick("photocopier_notoner", src)
playsound(loc, 'sound/machines/buzz-two.ogg', 75, 1)
target.visible_message(SPAN_NOTICE("A red light on \the [target] flashes, indicating that it is out of toner."))
if(target.type == /obj/machinery/photocopier)
flick("photocopier_notoner", target)
playsound(target.loc, 'sound/machines/buzz-two.ogg', 75, 1)
break
W = copy_type(W)
W = copy_type(target, W, need_toner ? toner : 15, do_print)
W.forceMove(p)
p.pages += W
p.forceMove(src.loc)
p.forceMove(target.loc)
p.update_icon()
p.icon_state = "paper_words"
p.name = bundle.name
@@ -256,4 +260,4 @@ VUEUI_MONITOR_VARS(/obj/machinery/photocopier, photocopiermonitor)
name = "toner cartridge"
desc = "A high-definition toner for colour photocopying and printer machines. Good thing it's a business expense."
icon_state = "tonercartridge"
var/toner_amount = 30
var/toner_amount = 30