mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-19 14:51:27 +00:00
* local powernet and machine power refactor * some fixes * more tweaks + powerchange() refactor * fixes var edited apcs on meatpackers.dmm * fixes issue with power channels * Reviews * delta fix * Update code/game/machinery/portable_turret.dm Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> * removed area power change proc * damn morgues * requested changes * request changes * deconfliction * mapping fixes * some fixes from TM --------- Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
71 lines
2.4 KiB
Plaintext
71 lines
2.4 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
|
|
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
|