|
15 | 15 | integrity_failure = 100
|
16 | 16 | atom_say_verb = "bleeps"
|
17 | 17 |
|
| 18 | + COOLDOWN_DECLARE(copying_cooldown) |
| 19 | + |
18 | 20 | var/insert_anim = "bigscanner1"
|
19 | 21 | ///Is the photocopier performing an action currently?
|
20 | 22 | var/copying = FALSE
|
|
39 | 41 | var/static/total_copies = 0
|
40 | 42 | var/static/max_copies_reached = FALSE
|
41 | 43 |
|
| 44 | + |
42 | 45 | /obj/machinery/photocopier/attack_ai(mob/user)
|
43 | 46 | return attack_hand(user)
|
44 | 47 |
|
|
289 | 292 | if(!cancopy(scancopy))
|
290 | 293 | return
|
291 | 294 | copying = TRUE
|
292 |
| - playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, 1) |
| 295 | + playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE) |
293 | 296 | if(istype(C, /obj/item/paper))
|
294 | 297 | for(var/i in copies to 1 step -1)
|
295 | 298 | if(!papercopy(C))
|
|
344 | 347 | copying = FALSE
|
345 | 348 | return
|
346 | 349 | use_power(active_power_consumption)
|
347 |
| - sleep(PHOTOCOPIER_DELAY) |
| 350 | + COOLDOWN_START(src, copying_cooldown, PHOTOCOPIER_DELAY) |
348 | 351 | LAZYADD(saved_documents, O)
|
349 | 352 | copying = FALSE
|
350 |
| - playsound(loc, 'sound/machines/ping.ogg', 50, 0) |
| 353 | + playsound(loc, 'sound/machines/ping.ogg', 50, FALSE) |
351 | 354 | atom_say("Document successfully scanned!")
|
352 | 355 |
|
353 | 356 | /obj/machinery/photocopier/proc/delete_file(uid)
|
|
386 | 389 | data["files"] += list(document_data)
|
387 | 390 | return data
|
388 | 391 |
|
389 |
| -/obj/machinery/photocopier/ui_act(action, list/params) |
| 392 | +/obj/machinery/photocopier/ui_act(action, list/params, datum/tgui/ui) |
390 | 393 | if(..())
|
391 | 394 | return
|
392 | 395 | . = 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 |
393 | 399 | add_fingerprint(usr)
|
394 | 400 | switch(action)
|
395 | 401 | if("copy")
|
|
410 | 416 | . = TRUE
|
411 | 417 | if("scandocument")
|
412 | 418 | scan_document()
|
| 419 | + if("ai_text") |
| 420 | + ai_text(ui.user) |
413 | 421 | if("ai_pic")
|
414 | 422 | ai_pic()
|
415 | 423 | if("filecopy")
|
|
419 | 427 | . = TRUE
|
420 | 428 | update_icon()
|
421 | 429 |
|
| 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 | + |
422 | 449 | /obj/machinery/photocopier/proc/ai_pic()
|
423 | 450 | if(!issilicon(usr))
|
424 | 451 | return
|
425 | 452 | if(stat & (BROKEN|NOPOWER))
|
426 | 453 | return
|
| 454 | + if(toner < 5) |
| 455 | + return |
| 456 | + var/mob/living/silicon/tempAI = usr |
| 457 | + var/obj/item/camera/siliconcam/camera = tempAI.aiCamera |
427 | 458 |
|
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) |
447 | 475 |
|
448 | 476 | /obj/machinery/photocopier/attackby(obj/item/O, mob/user, params)
|
449 | 477 | if(istype(O, /obj/item/paper) || istype(O, /obj/item/photo) || istype(O, /obj/item/paper_bundle))
|
|
513 | 541 | copyitem.forceMove(get_turf(src))
|
514 | 542 | visible_message("<span class='notice'>[copyitem] is shoved out of the way by [copymob]!</span>")
|
515 | 543 | copyitem = null
|
516 |
| - playsound(loc, 'sound/machines/ping.ogg', 50, 0) |
| 544 | + playsound(loc, 'sound/machines/ping.ogg', 50, FALSE) |
517 | 545 | atom_say("Attention: Posterior Placed on Printing Plaque!")
|
518 | 546 | SStgui.update_uis(src)
|
519 | 547 | return TRUE
|
|
0 commit comments