mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-05 23:21:53 +00:00
* R&D Rework PT1 * Give robotics access too * Run prettier * More lints * This is INCREDIBLY ironic * Re-add blacklisting * Oops * Review changes * Some fixes * Fix outstanding issues * Warriorstar fixes * Tiny tweak
72 lines
2.5 KiB
Plaintext
72 lines
2.5 KiB
Plaintext
//All devices that link into the R&D console fall into thise type for easy identification and some shared procs.
|
|
|
|
|
|
/obj/machinery/r_n_d
|
|
name = "R&D Device"
|
|
icon = 'icons/obj/machines/research.dmi'
|
|
density = TRUE
|
|
anchored = TRUE
|
|
var/busy = FALSE
|
|
var/obj/machinery/computer/rdconsole/linked_console
|
|
// Why is this scoped here????????
|
|
var/obj/item/loaded_item = null
|
|
var/datum/component/material_container/materials //Store for hyper speed!
|
|
var/efficiency_coeff = 1
|
|
var/list/categories = list()
|
|
|
|
/obj/machinery/r_n_d/Initialize(mapload)
|
|
. = ..()
|
|
materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE, MAT_PLASTIC), 0, TRUE, /obj/item/stack, CALLBACK(src, PROC_REF(is_insertion_ready)), CALLBACK(src, PROC_REF(AfterMaterialInsert)))
|
|
materials.precise_insertion = TRUE
|
|
|
|
/obj/machinery/r_n_d/Destroy()
|
|
if(loaded_item)
|
|
loaded_item.forceMove(get_turf(src))
|
|
loaded_item = null
|
|
linked_console = null
|
|
materials = null
|
|
return ..()
|
|
|
|
//whether the machine can have an item inserted in its current state.
|
|
/obj/machinery/r_n_d/proc/is_insertion_ready(mob/user)
|
|
if(panel_open)
|
|
to_chat(user, "<span class='warning'>You can't load [src] while it's opened!</span>")
|
|
return FALSE
|
|
|
|
if(!linked_console)
|
|
to_chat(user, "<span class='warning'>[src] must be linked to an R&D console first!</span>")
|
|
return FALSE
|
|
|
|
if(busy)
|
|
to_chat(user, "<span class='warning'>[src] is busy right now.</span>")
|
|
return FALSE
|
|
|
|
if(stat & BROKEN)
|
|
to_chat(user, "<span class='warning'>[src] is broken.</span>")
|
|
return FALSE
|
|
|
|
if(stat & NOPOWER)
|
|
to_chat(user, "<span class='warning'>[src] has no power.</span>")
|
|
return FALSE
|
|
|
|
if(loaded_item)
|
|
to_chat(user, "<span class='warning'>[src] is already loaded.</span>")
|
|
return FALSE
|
|
|
|
return TRUE
|
|
|
|
/obj/machinery/r_n_d/proc/AfterMaterialInsert(type_inserted, id_inserted, amount_inserted)
|
|
var/stack_name
|
|
if(ispath(type_inserted, /obj/item/stack/ore/bluespace_crystal))
|
|
stack_name = "bluespace"
|
|
use_power(MINERAL_MATERIAL_AMOUNT / 10)
|
|
else
|
|
var/obj/item/stack/S = type_inserted
|
|
stack_name = initial(S.name)
|
|
use_power(min(1000, (amount_inserted / 100)))
|
|
add_overlay("protolathe_[stack_name]")
|
|
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, cut_overlay), "protolathe_[stack_name]"), 10)
|
|
|
|
/obj/machinery/r_n_d/proc/check_mat(datum/design/being_built, M)
|
|
return 0 // number of copies of design beign_built you can make with material M
|