mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-16 18:45:22 +01:00
336d978d4a
## About The Pull Request Converted autolathes, drone dispensers, sheetifiers and recyclers to tool_acts, and autolathes now use base_item_interaction similarly to flatpackers to avoid the ire of material containers. Material containers also now refuse to accept materials if the owner is a machine which is broken or has an open panel. ## Why It's Good For The Game Autolathe ate my multitool one too many times, can't have shit in space detroit. There's been a ton of feedback on autolathes having bad UX and #89859 kinda pushed me over the edge, its just far too confusing to deal with - now they should be up to parity with protolathes (tools don't get eaten on left click anymore) ## Changelog 🆑 fix: You no longer can insert sheets into unpowered, broken or opened autolathes. qol: Screwdriver/crowbar/multitool interactions on autolathes now work with left click instead of right click. /🆑
76 lines
2.7 KiB
Plaintext
76 lines
2.7 KiB
Plaintext
/obj/machinery/sheetifier
|
|
name = "Sheet-meister 2000"
|
|
desc = "A very sheety machine"
|
|
icon = 'icons/obj/machines/sheetifier.dmi'
|
|
icon_state = "base_machine"
|
|
density = TRUE
|
|
circuit = /obj/item/circuitboard/machine/sheetifier
|
|
layer = BELOW_OBJ_LAYER
|
|
var/busy_processing = FALSE
|
|
var/datum/component/material_container/materials
|
|
|
|
/obj/machinery/sheetifier/Initialize(mapload)
|
|
. = ..()
|
|
materials = AddComponent( \
|
|
/datum/component/material_container, \
|
|
list(/datum/material/meat, /datum/material/hauntium), \
|
|
SHEET_MATERIAL_AMOUNT * MAX_STACK_SIZE * 2, \
|
|
MATCONTAINER_EXAMINE, \
|
|
typesof(/datum/material/meat) + /datum/material/hauntium, list(/obj/item/food/meat, /obj/item/photo), \
|
|
container_signals = list(
|
|
COMSIG_MATCONTAINER_PRE_USER_INSERT = TYPE_PROC_REF(/obj/machinery/sheetifier, CanInsertMaterials),
|
|
COMSIG_MATCONTAINER_ITEM_CONSUMED = TYPE_PROC_REF(/obj/machinery/sheetifier, AfterInsertMaterials)
|
|
) \
|
|
)
|
|
|
|
/obj/machinery/sheetifier/Destroy()
|
|
materials = null
|
|
return ..()
|
|
|
|
/obj/machinery/sheetifier/update_overlays()
|
|
. = ..()
|
|
if(machine_stat & (BROKEN|NOPOWER))
|
|
return
|
|
var/mutable_appearance/on_overlay = mutable_appearance(icon, "buttons_on")
|
|
. += on_overlay
|
|
|
|
/obj/machinery/sheetifier/update_icon_state()
|
|
icon_state = "base_machine[busy_processing ? "_processing" : ""]"
|
|
return ..()
|
|
|
|
/obj/machinery/sheetifier/proc/CanInsertMaterials(container, held_item, user)
|
|
SIGNAL_HANDLER
|
|
|
|
return busy_processing ? MATCONTAINER_BLOCK_INSERT : TRUE
|
|
|
|
/obj/machinery/sheetifier/proc/AfterInsertMaterials(container, item_inserted, id_inserted, mats_consumed, amount_inserted, atom/context)
|
|
busy_processing = TRUE
|
|
update_appearance()
|
|
var/datum/material/last_inserted_material = id_inserted
|
|
var/mutable_appearance/processing_overlay = mutable_appearance(icon, "processing")
|
|
processing_overlay.color = last_inserted_material.color
|
|
flick_overlay_static(processing_overlay, src, 64)
|
|
addtimer(CALLBACK(src, PROC_REF(finish_processing)), 6.4 SECONDS)
|
|
|
|
/obj/machinery/sheetifier/proc/finish_processing()
|
|
busy_processing = FALSE
|
|
update_appearance()
|
|
materials.retrieve_all() //Returns all as sheets
|
|
use_energy(active_power_usage)
|
|
|
|
/obj/machinery/sheetifier/wrench_act(mob/living/user, obj/item/tool)
|
|
. = ..()
|
|
default_unfasten_wrench(user, tool)
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
/obj/machinery/sheetifier/screwdriver_act(mob/living/user, obj/item/tool)
|
|
if(default_deconstruction_screwdriver(user, initial(icon_state), initial(icon_state), tool))
|
|
update_appearance()
|
|
return ITEM_INTERACT_SUCCESS
|
|
return ITEM_INTERACT_FAILURE
|
|
|
|
/obj/machinery/sheetifier/crowbar_act(mob/living/user, obj/item/tool)
|
|
if(default_deconstruction_crowbar(tool))
|
|
return ITEM_INTERACT_SUCCESS
|
|
return ITEM_INTERACT_BLOCKING
|