Files
CHOMPStation2/code/modules/xenobio/machinery/processor.dm
CHOMPStation2StaffMirrorBot ad5a944c8a [MIRROR] Mech construction fix and unittest (#12062)
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
Co-authored-by: C.L. <killer65311@gmail.com>
2025-11-30 00:05:21 -05:00

120 lines
3.6 KiB
Plaintext

// This is specifically for slimes since we don't have a 'normal' processor now.
// Feel free to rename it if that ever changes.
/obj/machinery/processor
name = "slime processor"
desc = "An industrial grinder used to automate the process of slime core extraction. It can also recycle biomatter."
icon = 'icons/obj/kitchen.dmi'
icon_state = "processor1"
density = TRUE
anchored = TRUE
var/processing = FALSE // So I heard you like processing.
var/list/to_be_processed = list()
var/monkeys_recycled = 0
description_info = "Clickdrag dead slimes or monkeys to it to insert them. It will make a new monkey cube for every four monkeys it processes."
/obj/item/circuitboard/processor
name = T_BOARD("slime processor")
build_path = /obj/machinery/processor
origin_tech = list(TECH_DATA = 2, TECH_BIO = 2)
/obj/machinery/processor/attack_hand(mob/living/user)
if(processing)
to_chat(user, span_warning("The processor is in the process of processing!"))
return
if(to_be_processed.len)
spawn(1)
begin_processing()
else
to_chat(user, span_warning("The processor is empty."))
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, 1)
return
// Verb to remove everything.
/obj/machinery/processor/verb/eject()
set category = "Object"
set name = "Eject Processor"
set src in oview(1)
if(usr.stat || !usr.canmove || usr.restrained())
return
empty()
add_fingerprint(usr)
return
// Ejects all the things out of the machine.
/obj/machinery/processor/proc/empty()
for(var/atom/movable/AM in to_be_processed)
to_be_processed.Remove(AM)
AM.forceMove(get_turf(src))
// Ejects all the things out of the machine.
/obj/machinery/processor/proc/insert(var/atom/movable/AM, var/mob/living/user)
if(!Adjacent(AM))
return
if(!can_insert(AM))
to_chat(user, span_warning("\The [src] cannot process \the [AM] at this time."))
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, 1)
return
to_be_processed.Add(AM)
AM.forceMove(src)
visible_message(span_infoplain(span_bold("\The [user]") + " places [AM] inside \the [src]."))
/obj/machinery/processor/proc/begin_processing()
if(processing)
return // Already doing it.
processing = TRUE
playsound(src, 'sound/machines/juicer.ogg', 50, 1)
for(var/atom/movable/AM in to_be_processed)
extract(AM)
sleep(1 SECONDS)
while(monkeys_recycled >= 4)
new /obj/item/reagent_containers/food/snacks/monkeycube(get_turf(src))
playsound(src, 'sound/effects/splat.ogg', 50, 1)
monkeys_recycled -= 4
sleep(1 SECOND)
processing = FALSE
playsound(src, 'sound/machines/ding.ogg', 50, 1)
/obj/machinery/processor/proc/extract(var/atom/movable/AM)
if(istype(AM, /mob/living/simple_mob/slime))
var/mob/living/simple_mob/slime/S = AM
while(S.cores)
var/atom/new_core = new S.coretype(get_turf(src))
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_HARVEST_SLIME_CORE, new_core)
playsound(src, 'sound/effects/splat.ogg', 50, 1)
S.cores--
sleep(1 SECOND)
to_be_processed.Remove(S)
qdel(S)
if(ishuman(AM))
var/mob/living/carbon/human/M = AM
playsound(src, 'sound/effects/splat.ogg', 50, 1)
to_be_processed.Remove(M)
qdel(M)
monkeys_recycled++
sleep(1 SECOND)
/obj/machinery/processor/proc/can_insert(var/atom/movable/AM)
if(istype(AM, /mob/living/simple_mob/slime))
var/mob/living/simple_mob/slime/S = AM
if(S.stat != DEAD)
return FALSE
return TRUE
if(ishuman(AM))
var/mob/living/carbon/human/H = AM
if(!istype(H.species, /datum/species/monkey))
return FALSE
if(H.stat != DEAD)
return FALSE
return TRUE
return FALSE
/obj/machinery/processor/MouseDrop_T(var/atom/movable/AM, var/mob/living/user)
if(user.stat || user.incapacitated(INCAPACITATION_DISABLED) || !istype(user))
return
insert(AM, user)