Allows All Silicons to do Paperwork (#22653)

* Silicons Paper Printing

* the CI OD fix

* Revert "the CI OD fix"

This reverts commit d223e056c1.

* This should fix it

* Add files via upload

* Test TGUI Fix 1

* Empty Commit

* Recompile TGUI with checkout

* toner code early return

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* using right variable names

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* adding argument to text function

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* New code testing

* ui.user usage

* Used the new cooldown declarations

* Automatic TGUI Prettifier

* TGUI 10

* Recomplie TGUI

* TGUI 11

* Try to fix TGUI

* remove extra divider

* Revert "remove extra divider"

This reverts commit e7faaa4b4d.

* Use empty fragment instead of divider

* compile TGUI

* Compile TGUI

---------

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
Daniel Lenrd
2023-11-13 12:14:30 +00:00
committed by GitHub
co-authored by Ryan
parent 9cd84512a0
commit 370adae9cf
3 changed files with 72 additions and 33 deletions
+51 -23
View File
@@ -15,6 +15,8 @@
integrity_failure = 100
atom_say_verb = "bleeps"
COOLDOWN_DECLARE(copying_cooldown)
var/insert_anim = "bigscanner1"
///Is the photocopier performing an action currently?
var/copying = FALSE
@@ -39,6 +41,7 @@
var/static/total_copies = 0
var/static/max_copies_reached = FALSE
/obj/machinery/photocopier/attack_ai(mob/user)
return attack_hand(user)
@@ -289,7 +292,7 @@
if(!cancopy(scancopy))
return
copying = TRUE
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, 1)
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE)
if(istype(C, /obj/item/paper))
for(var/i in copies to 1 step -1)
if(!papercopy(C))
@@ -344,10 +347,10 @@
copying = FALSE
return
use_power(active_power_consumption)
sleep(PHOTOCOPIER_DELAY)
COOLDOWN_START(src, copying_cooldown, PHOTOCOPIER_DELAY)
LAZYADD(saved_documents, O)
copying = FALSE
playsound(loc, 'sound/machines/ping.ogg', 50, 0)
playsound(loc, 'sound/machines/ping.ogg', 50, FALSE)
atom_say("Document successfully scanned!")
/obj/machinery/photocopier/proc/delete_file(uid)
@@ -386,10 +389,13 @@
data["files"] += list(document_data)
return data
/obj/machinery/photocopier/ui_act(action, list/params)
/obj/machinery/photocopier/ui_act(action, list/params, datum/tgui/ui)
if(..())
return
. = FALSE
if(!COOLDOWN_FINISHED(src, copying_cooldown))
to_chat(usr, "<span class='warning'>[src] is busy, try again in a few seconds.</span>")
return
add_fingerprint(usr)
switch(action)
if("copy")
@@ -410,6 +416,8 @@
. = TRUE
if("scandocument")
scan_document()
if("ai_text")
ai_text(ui.user)
if("ai_pic")
ai_pic()
if("filecopy")
@@ -419,31 +427,51 @@
. = TRUE
update_icon()
/obj/machinery/photocopier/proc/ai_text(mob/user)
if(!issilicon(user))
return
if(stat & (BROKEN|NOPOWER))
return
var/text = input("Enter what you want to write:", "Write", null, null) as message
if(!text)
return
if(toner < 1 || !user)
return
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE)
var/obj/item/paper/p = new /obj/item/paper(loc)
text = p.parsepencode(text, null, user)
p.info = text
p.populatefields()
toner -= 1
use_power(active_power_consumption)
COOLDOWN_START(src, copying_cooldown, PHOTOCOPIER_DELAY)
/obj/machinery/photocopier/proc/ai_pic()
if(!issilicon(usr))
return
if(stat & (BROKEN|NOPOWER))
return
if(toner < 5)
return
var/mob/living/silicon/tempAI = usr
var/obj/item/camera/siliconcam/camera = tempAI.aiCamera
if(toner >= 5)
var/mob/living/silicon/tempAI = usr
var/obj/item/camera/siliconcam/camera = tempAI.aiCamera
if(!camera)
return
var/datum/picture/selection = camera.selectpicture()
if(!selection)
return
if(!camera)
return
var/datum/picture/selection = camera.selectpicture()
if(!selection)
return
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, 1)
var/obj/item/photo/p = new /obj/item/photo(loc)
p.construct(selection)
if(p.desc == "")
p.desc += "Copied by [tempAI.name]"
else
p.desc += " - Copied by [tempAI.name]"
toner -= 5
sleep(15)
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE)
var/obj/item/photo/p = new /obj/item/photo(loc)
p.construct(selection)
if(p.desc == "")
p.desc += "Copied by [tempAI.name]"
else
p.desc += " - Copied by [tempAI.name]"
toner -= 5
use_power(active_power_consumption)
COOLDOWN_START(src, copying_cooldown, PHOTOCOPIER_DELAY)
/obj/machinery/photocopier/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/paper) || istype(O, /obj/item/photo) || istype(O, /obj/item/paper_bundle))
@@ -513,7 +541,7 @@
copyitem.forceMove(get_turf(src))
visible_message("<span class='notice'>[copyitem] is shoved out of the way by [copymob]!</span>")
copyitem = null
playsound(loc, 'sound/machines/ping.ogg', 50, 0)
playsound(loc, 'sound/machines/ping.ogg', 50, FALSE)
atom_say("Attention: Posterior Placed on Printing Plaque!")
SStgui.update_uis(src)
return TRUE