Skip to content

Commit 370adae

Browse files
Allows All Silicons to do Paperwork (ParadiseSS13#22653)
* Silicons Paper Printing * the CI OD fix * Revert "the CI OD fix" This reverts commit d223e05. * 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 <[email protected]> * using right variable names Co-authored-by: Ryan <[email protected]> * adding argument to text function Co-authored-by: Ryan <[email protected]> * 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 e7faaa4. * Use empty fragment instead of divider * compile TGUI * Compile TGUI --------- Co-authored-by: Ryan <[email protected]>
1 parent 9cd8451 commit 370adae

File tree

3 files changed

+73
-34
lines changed

3 files changed

+73
-34
lines changed

code/modules/paperwork/photocopier.dm

+52-24
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
integrity_failure = 100
1616
atom_say_verb = "bleeps"
1717

18+
COOLDOWN_DECLARE(copying_cooldown)
19+
1820
var/insert_anim = "bigscanner1"
1921
///Is the photocopier performing an action currently?
2022
var/copying = FALSE
@@ -39,6 +41,7 @@
3941
var/static/total_copies = 0
4042
var/static/max_copies_reached = FALSE
4143

44+
4245
/obj/machinery/photocopier/attack_ai(mob/user)
4346
return attack_hand(user)
4447

@@ -289,7 +292,7 @@
289292
if(!cancopy(scancopy))
290293
return
291294
copying = TRUE
292-
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, 1)
295+
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE)
293296
if(istype(C, /obj/item/paper))
294297
for(var/i in copies to 1 step -1)
295298
if(!papercopy(C))
@@ -344,10 +347,10 @@
344347
copying = FALSE
345348
return
346349
use_power(active_power_consumption)
347-
sleep(PHOTOCOPIER_DELAY)
350+
COOLDOWN_START(src, copying_cooldown, PHOTOCOPIER_DELAY)
348351
LAZYADD(saved_documents, O)
349352
copying = FALSE
350-
playsound(loc, 'sound/machines/ping.ogg', 50, 0)
353+
playsound(loc, 'sound/machines/ping.ogg', 50, FALSE)
351354
atom_say("Document successfully scanned!")
352355

353356
/obj/machinery/photocopier/proc/delete_file(uid)
@@ -386,10 +389,13 @@
386389
data["files"] += list(document_data)
387390
return data
388391

389-
/obj/machinery/photocopier/ui_act(action, list/params)
392+
/obj/machinery/photocopier/ui_act(action, list/params, datum/tgui/ui)
390393
if(..())
391394
return
392395
. = FALSE
396+
if(!COOLDOWN_FINISHED(src, copying_cooldown))
397+
to_chat(usr, "<span class='warning'>[src] is busy, try again in a few seconds.</span>")
398+
return
393399
add_fingerprint(usr)
394400
switch(action)
395401
if("copy")
@@ -410,6 +416,8 @@
410416
. = TRUE
411417
if("scandocument")
412418
scan_document()
419+
if("ai_text")
420+
ai_text(ui.user)
413421
if("ai_pic")
414422
ai_pic()
415423
if("filecopy")
@@ -419,31 +427,51 @@
419427
. = TRUE
420428
update_icon()
421429

430+
/obj/machinery/photocopier/proc/ai_text(mob/user)
431+
if(!issilicon(user))
432+
return
433+
if(stat & (BROKEN|NOPOWER))
434+
return
435+
var/text = input("Enter what you want to write:", "Write", null, null) as message
436+
if(!text)
437+
return
438+
if(toner < 1 || !user)
439+
return
440+
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE)
441+
var/obj/item/paper/p = new /obj/item/paper(loc)
442+
text = p.parsepencode(text, null, user)
443+
p.info = text
444+
p.populatefields()
445+
toner -= 1
446+
use_power(active_power_consumption)
447+
COOLDOWN_START(src, copying_cooldown, PHOTOCOPIER_DELAY)
448+
422449
/obj/machinery/photocopier/proc/ai_pic()
423450
if(!issilicon(usr))
424451
return
425452
if(stat & (BROKEN|NOPOWER))
426453
return
454+
if(toner < 5)
455+
return
456+
var/mob/living/silicon/tempAI = usr
457+
var/obj/item/camera/siliconcam/camera = tempAI.aiCamera
427458

428-
if(toner >= 5)
429-
var/mob/living/silicon/tempAI = usr
430-
var/obj/item/camera/siliconcam/camera = tempAI.aiCamera
431-
432-
if(!camera)
433-
return
434-
var/datum/picture/selection = camera.selectpicture()
435-
if(!selection)
436-
return
437-
438-
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, 1)
439-
var/obj/item/photo/p = new /obj/item/photo(loc)
440-
p.construct(selection)
441-
if(p.desc == "")
442-
p.desc += "Copied by [tempAI.name]"
443-
else
444-
p.desc += " - Copied by [tempAI.name]"
445-
toner -= 5
446-
sleep(15)
459+
if(!camera)
460+
return
461+
var/datum/picture/selection = camera.selectpicture()
462+
if(!selection)
463+
return
464+
465+
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE)
466+
var/obj/item/photo/p = new /obj/item/photo(loc)
467+
p.construct(selection)
468+
if(p.desc == "")
469+
p.desc += "Copied by [tempAI.name]"
470+
else
471+
p.desc += " - Copied by [tempAI.name]"
472+
toner -= 5
473+
use_power(active_power_consumption)
474+
COOLDOWN_START(src, copying_cooldown, PHOTOCOPIER_DELAY)
447475

448476
/obj/machinery/photocopier/attackby(obj/item/O, mob/user, params)
449477
if(istype(O, /obj/item/paper) || istype(O, /obj/item/photo) || istype(O, /obj/item/paper_bundle))
@@ -513,7 +541,7 @@
513541
copyitem.forceMove(get_turf(src))
514542
visible_message("<span class='notice'>[copyitem] is shoved out of the way by [copymob]!</span>")
515543
copyitem = null
516-
playsound(loc, 'sound/machines/ping.ogg', 50, 0)
544+
playsound(loc, 'sound/machines/ping.ogg', 50, FALSE)
517545
atom_say("Attention: Posterior Placed on Printing Plaque!")
518546
SStgui.update_uis(src)
519547
return TRUE

tgui/packages/tgui/interfaces/Photocopier.js

+20-9
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,26 @@ const Actions = (props, context) => {
9797
onClick={() => act('scandocument')}
9898
/>
9999
{!!issilicon && (
100-
<Button
101-
fluid
102-
icon="image"
103-
color="green"
104-
float="center"
105-
textAlign="center"
106-
content="Print from database"
107-
onClick={() => act('ai_pic')}
108-
/>
100+
<>
101+
<Button
102+
fluid
103+
icon="file"
104+
color="green"
105+
float="center"
106+
textAlign="center"
107+
content="Print Text"
108+
onClick={() => act('ai_text')}
109+
/>
110+
<Button
111+
fluid
112+
icon="image"
113+
color="green"
114+
float="center"
115+
textAlign="center"
116+
content="Print Image"
117+
onClick={() => act('ai_pic')}
118+
/>
119+
</>
109120
)}
110121
</Fragment>
111122
);

0 commit comments

Comments
 (0)