Files
GS13NG/code/game/objects/items/circuitboards/circuitboard.dm
2018-09-11 04:06:45 -05:00

68 lines
2.2 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)
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/needs_anchored = TRUE // Whether this machine must be anchored to be constructed.
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()
/obj/item/circuitboard/machine/examine(mob/user)
..()
if(LAZYLEN(req_components))
var/list/nice_list = list()
for(var/B in req_components)
var/atom/A = B
if(!ispath(A))
continue
nice_list += list("[req_components[A]] [initial(A.name)]")
to_chat(user,"<span class='notice'>Required components: [english_list(nice_list)].</span>")