Skip to content

Commit

Permalink
Allows All Silicons to do Paperwork (ParadiseSS13#22653)
Browse files Browse the repository at this point in the history
* 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 <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 e7faaa4.

* Use empty fragment instead of divider

* compile TGUI

* Compile TGUI

---------

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
  • Loading branch information
Danchi299 and Sirryan2002 authored Nov 13, 2023
1 parent 9cd8451 commit 370adae
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 34 deletions.
76 changes: 52 additions & 24 deletions code/modules/paperwork/photocopier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -410,6 +416,8 @@
. = TRUE
if("scandocument")
scan_document()
if("ai_text")
ai_text(ui.user)
if("ai_pic")
ai_pic()
if("filecopy")
Expand All @@ -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

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)
if(!camera)
return
var/datum/picture/selection = camera.selectpicture()
if(!selection)
return

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))
Expand Down Expand Up @@ -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
Expand Down
29 changes: 20 additions & 9 deletions tgui/packages/tgui/interfaces/Photocopier.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,26 @@ const Actions = (props, context) => {
onClick={() => act('scandocument')}
/>
{!!issilicon && (
<Button
fluid
icon="image"
color="green"
float="center"
textAlign="center"
content="Print from database"
onClick={() => act('ai_pic')}
/>
<>
<Button
fluid
icon="file"
color="green"
float="center"
textAlign="center"
content="Print Text"
onClick={() => act('ai_text')}
/>
<Button
fluid
icon="image"
color="green"
float="center"
textAlign="center"
content="Print Image"
onClick={() => act('ai_pic')}
/>
</>
)}
</Fragment>
);
Expand Down
Loading

0 comments on commit 370adae

Please sign in to comment.