-
-
Notifications
You must be signed in to change notification settings - Fork 452
/
circuitboard.dm
73 lines (58 loc) · 2.51 KB
/
circuitboard.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//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 = "circuit_map"
item_state = "electronic"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
materials = list(/datum/material/glass=1000)
w_class = WEIGHT_CLASS_SMALL
grind_results = list(/datum/reagent/silicon = 20, /datum/reagent/gold = 10)
greyscale_colors = CIRCUIT_COLOR_GENERIC
var/build_path = null
/obj/item/circuitboard/Initialize(mapload)
if(icon_state == "circuit_map") // some circuitboards have cool custom sprites
set_greyscale(new_config = /datum/greyscale_config/circuit)
return ..()
/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)]")
. += span_notice("Required components: [english_list(nice_list)].")