d447acdc6e
I had some time free, and noticed how awful the reagent grinder code was - it used huge static lists containing types and their associated reagents from grinding. This is now split into two new vars on /obj/item - var/list/grind_results and var/list/juice_results, as well as two new helper procs, on_grind() and on_juice() to allow those to change based on conditions like plant potency. Such checks and the like have been moved to that. If any of these procs return -1, the operation is canceled. I also fixed some of the recipes that didn't work. The reagent IDs for them didn't exist, leading me to believe that they weren't tested. I corrected that! (I've tested every single recipe in this PR, with the exception of a few juicing-related ones.)
56 lines
1.9 KiB
Plaintext
56 lines
1.9 KiB
Plaintext
//File with the circuitboard and circuitboard/machine class definitions and procs
|
|
|
|
|
|
// Circuitboard
|
|
|
|
/obj/item/circuitboard
|
|
name = "circuit board"
|
|
icon = 'icons/obj/module.dmi'
|
|
icon_state = "id_mod"
|
|
item_state = "electronic"
|
|
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
|
materials = list(MAT_GLASS=1000)
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
grind_results = list("silicon" = 20, "sacid" = 0.5) //Retrieving acid this way is extremely inefficient
|
|
var/build_path = null
|
|
|
|
/obj/item/circuitboard/proc/apply_default_parts(obj/machinery/M)
|
|
return
|
|
|
|
// Circuitboard/machine
|
|
/*Common Parts: Parts List: Ignitor, Timer, Infra-red laser, Infra-red sensor, t_scanner, Capacitor, Valve, sensor unit,
|
|
micro-manipulator, console screen, beaker, Microlaser, matter bin, power cells.
|
|
*/
|
|
|
|
/obj/item/circuitboard/machine
|
|
var/list/req_components // Components required by the machine.
|
|
// Example: list(/obj/item/stock_parts/matter_bin = 5)
|
|
|
|
var/list/def_components // Default replacements for req_components, to be used in apply_default_parts instead of req_components types
|
|
// Example: list(/obj/item/stock_parts/matter_bin = /obj/item/stock_parts/matter_bin/super)
|
|
|
|
// Applies the default parts defined by the circuit board when the machine is created
|
|
/obj/item/circuitboard/machine/apply_default_parts(obj/machinery/M)
|
|
if(!req_components)
|
|
return
|
|
|
|
M.component_parts = list(src) // List of components always contains a board
|
|
moveToNullspace()
|
|
|
|
for(var/comp_path in req_components)
|
|
var/comp_amt = req_components[comp_path]
|
|
if(!comp_amt)
|
|
continue
|
|
|
|
if(def_components && def_components[comp_path])
|
|
comp_path = def_components[comp_path]
|
|
|
|
if(ispath(comp_path, /obj/item/stack))
|
|
M.component_parts += new comp_path(null, comp_amt)
|
|
else
|
|
for(var/i in 1 to comp_amt)
|
|
M.component_parts += new comp_path(null)
|
|
|
|
M.RefreshParts()
|