Updates /code/game/objects/item/circuitboards/* to follow the style guide (#63026)

Co-authored-by: SuperNovaa41 <supernovaa41@protonmail.com>
This commit is contained in:
Seth Scherer
2021-11-26 15:47:44 -08:00
committed by GitHub
co-authored by SuperNovaa41
parent 56ac225e34
commit ec86b62db4
3 changed files with 84 additions and 95 deletions
@@ -10,7 +10,7 @@
inhand_icon_state = "electronic"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
custom_materials = list(/datum/material/glass=1000)
custom_materials = list(/datum/material/glass = 1000)
w_class = WEIGHT_CLASS_SMALL
grind_results = list(/datum/reagent/silicon = 20)
greyscale_colors = CIRCUIT_COLOR_GENERIC
@@ -19,31 +19,31 @@
var/onstation = TRUE
/obj/item/circuitboard/Initialize(mapload)
set_greyscale(new_config=/datum/greyscale_config/circuit)
set_greyscale(new_config = /datum/greyscale_config/circuit)
return ..()
/obj/item/circuitboard/proc/apply_default_parts(obj/machinery/M)
if(LAZYLEN(M.component_parts))
/obj/item/circuitboard/proc/apply_default_parts(obj/machinery/machine)
if(LAZYLEN(machine.component_parts))
// This really shouldn't happen. If it somehow does, print out a stack trace and gracefully handle it.
stack_trace("apply_defauly_parts called on machine that already had component_parts: [M]")
stack_trace("apply_defauly_parts called on machine that already had component_parts: [machine]")
// Move to nullspace so you don't trigger handle_atom_del logic and remove existing parts.
for(var/obj/item/part in M.component_parts)
for(var/obj/item/part as anything in machine.component_parts)
part.moveToNullspace(loc)
qdel(part)
// List of components always contains the circuit board used to build it.
M.component_parts = list(src)
forceMove(M)
machine.component_parts = list(src)
forceMove(machine)
if(M.circuit != src)
if(machine.circuit != src)
// This really shouldn't happen. If it somehow does, print out a stack trace and gracefully handle it.
stack_trace("apply_default_parts called from a circuit board that does not belong to machine: [M]")
stack_trace("apply_default_parts called from a circuit board that does not belong to machine: [machine]")
// Move to nullspace so you don't trigger handle_atom_del logic, remove old circuit, add new circuit.
M.circuit.moveToNullspace()
qdel(M.circuit)
M.circuit = src
machine.circuit.moveToNullspace()
qdel(machine.circuit)
machine.circuit = src
return
@@ -70,7 +70,7 @@ micro-manipulator, console screen, beaker, Microlaser, matter bin, power cells.
// 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)
/obj/item/circuitboard/machine/apply_default_parts(obj/machinery/machine)
if(!req_components)
return
@@ -85,20 +85,19 @@ micro-manipulator, console screen, beaker, Microlaser, matter bin, power cells.
comp_path = def_components[comp_path]
if(ispath(comp_path, /obj/item/stack))
M.component_parts += new comp_path(M, comp_amt)
machine.component_parts += new comp_path(machine, comp_amt)
else
for(var/i in 1 to comp_amt)
M.component_parts += new comp_path(M)
for(var/component in 1 to comp_amt)
machine.component_parts += new comp_path(machine)
M.RefreshParts()
machine.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))
for(var/atom/component as anything in req_components)
if(!ispath(component))
continue
nice_list += list("[req_components[A]] [initial(A.name)]")
nice_list += list("[req_components[component]] [initial(component.name)]")
. += span_notice("Required components: [english_list(nice_list)].")
@@ -232,18 +232,16 @@
name = "Library Visitor Console (Computer Board)"
build_path = /obj/machinery/computer/libraryconsole
/obj/item/circuitboard/computer/libraryconsole/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(build_path == /obj/machinery/computer/bookmanagement)
name = "Library Visitor Console (Computer Board)"
build_path = /obj/machinery/computer/libraryconsole
to_chat(user, span_notice("Defaulting access protocols."))
else
name = "Book Inventory Management Console (Computer Board)"
build_path = /obj/machinery/computer/bookmanagement
to_chat(user, span_notice("Access protocols successfully updated."))
/obj/item/circuitboard/computer/libraryconsole/screwdriver_act(mob/living/user, obj/item/tool)
if(build_path == /obj/machinery/computer/bookmanagement)
name = "Library Visitor Console (Computer Board)"
build_path = /obj/machinery/computer/libraryconsole
to_chat(user, span_notice("Defaulting access protocols."))
else
return ..()
name = "Book Inventory Management Console (Computer Board)"
build_path = /obj/machinery/computer/bookmanagement
to_chat(user, span_notice("Access protocols successfully updated."))
return TRUE
/obj/item/circuitboard/computer/monastery_shuttle
name = "Monastery Shuttle (Computer Board)"
@@ -271,11 +271,10 @@
/obj/item/stack/cable_coil = 1,
/obj/item/stack/sheet/glass = 1)
/obj/item/circuitboard/machine/thermomachine/multitool_act(mob/living/user, obj/item/multitool/I)
/obj/item/circuitboard/machine/thermomachine/multitool_act(mob/living/user, obj/item/multitool/multitool)
. = ..()
if (istype(I))
pipe_layer = (pipe_layer >= PIPING_LAYER_MAX) ? PIPING_LAYER_MIN : (pipe_layer + 1)
to_chat(user, span_notice("You change the circuitboard to layer [pipe_layer]."))
pipe_layer = (pipe_layer >= PIPING_LAYER_MAX) ? PIPING_LAYER_MIN : (pipe_layer + 1)
to_chat(user, span_notice("You change the circuitboard to layer [pipe_layer]."))
/obj/item/circuitboard/machine/thermomachine/examine()
. = ..()
@@ -373,16 +372,15 @@
needs_anchored = FALSE //wew lad
var/secure = FALSE
/obj/item/circuitboard/machine/holopad/attackby(obj/item/P, mob/user, params)
if(P.tool_behaviour == TOOL_MULTITOOL)
if(secure)
build_path = /obj/machinery/holopad
secure = FALSE
else
build_path = /obj/machinery/holopad/secure
secure = TRUE
to_chat(user, span_notice("You [secure? "en" : "dis"]able the security on the [src]"))
. = ..()
/obj/item/circuitboard/machine/holopad/multitool_act(mob/living/user, obj/item/tool)
if(secure)
build_path = /obj/machinery/holopad
secure = FALSE
else
build_path = /obj/machinery/holopad/secure
secure = TRUE
to_chat(user, span_notice("You [secure? "en" : "dis"]able the security on [src]"))
return TRUE
/obj/item/circuitboard/machine/holopad/examine(mob/user)
. = ..()
@@ -446,21 +444,21 @@
needs_anchored = FALSE
var/is_special_type = FALSE
/obj/item/circuitboard/machine/smartfridge/apply_default_parts(obj/machinery/smartfridge/M)
build_path = M.base_build_path
/obj/item/circuitboard/machine/smartfridge/apply_default_parts(obj/machinery/smartfridge/smartfridge)
build_path = smartfridge.base_build_path
if(!fridges_name_paths.Find(build_path, fridges_name_paths))
name = "[initial(M.name)] (Machine Board)" //if it's a unique type, give it a unique name.
name = "[initial(smartfridge.name)] (Machine Board)" //if it's a unique type, give it a unique name.
is_special_type = TRUE
return ..()
/obj/item/circuitboard/machine/smartfridge/attackby(obj/item/I, mob/user, params)
if(!is_special_type && I.tool_behaviour == TOOL_SCREWDRIVER)
var/position = fridges_name_paths.Find(build_path, fridges_name_paths)
position = (position == fridges_name_paths.len) ? 1 : (position + 1)
build_path = fridges_name_paths[position]
to_chat(user, span_notice("You set the board to [fridges_name_paths[build_path]]."))
else
return ..()
/obj/item/circuitboard/machine/smartfridge/screwdriver_act(mob/living/user, obj/item/tool)
if (is_special_type)
return FALSE
var/position = fridges_name_paths.Find(build_path, fridges_name_paths)
position = (position == fridges_name_paths.len) ? 1 : (position + 1)
build_path = fridges_name_paths[position]
to_chat(user, span_notice("You set the board to [fridges_name_paths[build_path]]."))
return TRUE
/obj/item/circuitboard/machine/smartfridge/examine(mob/user)
. = ..()
@@ -557,26 +555,24 @@
/obj/machinery/vending/tool = "YouTool",
/obj/machinery/vending/custom = "Custom Vendor")
/obj/item/circuitboard/machine/vendor/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_SCREWDRIVER)
var/static/list/display_vending_names_paths
if(!display_vending_names_paths)
display_vending_names_paths = list()
for(var/path in vending_names_paths)
display_vending_names_paths[vending_names_paths[path]] = path
var/choice = input(user,"Choose a new brand","Select an Item") as null|anything in sort_list(display_vending_names_paths)
set_type(display_vending_names_paths[choice])
else
return ..()
/obj/item/circuitboard/machine/vendor/screwdriver_act(mob/living/user, obj/item/tool)
var/static/list/display_vending_names_paths
if(!display_vending_names_paths)
display_vending_names_paths = list()
for(var/path in vending_names_paths)
display_vending_names_paths[vending_names_paths[path]] = path
var/choice = input(user, "Choose a new brand", "Select an Item") as null|anything in sort_list(display_vending_names_paths)
set_type(display_vending_names_paths[choice])
return TRUE
/obj/item/circuitboard/machine/vendor/proc/set_type(obj/machinery/vending/typepath)
build_path = typepath
name = "[vending_names_paths[build_path]] Vendor (Machine Board)"
req_components = list(initial(typepath.refill_canister) = 1)
/obj/item/circuitboard/machine/vendor/apply_default_parts(obj/machinery/M)
/obj/item/circuitboard/machine/vendor/apply_default_parts(obj/machinery/machine)
for(var/typepath in vending_names_paths)
if(istype(M, typepath))
if(istype(machine, typepath))
set_type(typepath)
break
return ..()
@@ -689,20 +685,18 @@
/obj/item/stack/sheet/glass = 1)
needs_anchored = FALSE
/obj/item/circuitboard/machine/chem_master/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_SCREWDRIVER)
var/new_name = "ChemMaster"
var/new_path = /obj/machinery/chem_master
/obj/item/circuitboard/machine/chem_master/screwdriver_act(mob/living/user, obj/item/tool)
var/new_name = "ChemMaster"
var/new_path = /obj/machinery/chem_master
if(build_path == /obj/machinery/chem_master)
new_name = "CondiMaster"
new_path = /obj/machinery/chem_master/condimaster
if(build_path == /obj/machinery/chem_master)
new_name = "CondiMaster"
new_path = /obj/machinery/chem_master/condimaster
build_path = new_path
name = "[new_name] 3000 (Machine Board)"
to_chat(user, span_notice("You change the circuit board setting to \"[new_name]\"."))
else
return ..()
build_path = new_path
name = "[new_name] 3000 (Machine Board)"
to_chat(user, span_notice("You change the circuit board setting to \"[new_name]\"."))
return TRUE
/obj/item/circuitboard/machine/cryo_tube
name = "Cryotube (Machine Board)"
@@ -737,7 +731,7 @@
/obj/item/circuitboard/machine/medical_kiosk/multitool_act(mob/living/user)
. = ..()
var/new_cost = input("Set a new cost for using this medical kiosk.","New cost", custom_cost) as num|null
var/new_cost = input("Set a new cost for using this medical kiosk.", "New cost", custom_cost) as num|null
if(!new_cost || (loc != user))
to_chat(user, span_warning("You must hold the circuitboard to change its cost!"))
return
@@ -1113,18 +1107,16 @@
/obj/item/stock_parts/manipulator = 1)
needs_anchored = FALSE
/obj/item/circuitboard/machine/processor/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(build_path == /obj/machinery/processor)
name = "Slime Processor (Machine Board)"
build_path = /obj/machinery/processor/slime
to_chat(user, span_notice("Name protocols successfully updated."))
else
name = "Food Processor (Machine Board)"
build_path = /obj/machinery/processor
to_chat(user, span_notice("Defaulting name protocols."))
/obj/item/circuitboard/machine/processor/screwdriver_act(mob/living/user, obj/item/tool)
if(build_path == /obj/machinery/processor)
name = "Slime Processor (Machine Board)"
build_path = /obj/machinery/processor/slime
to_chat(user, span_notice("Name protocols successfully updated."))
else
return ..()
name = "Food Processor (Machine Board)"
build_path = /obj/machinery/processor
to_chat(user, span_notice("Defaulting name protocols."))
return TRUE
/obj/item/circuitboard/machine/protolathe/department/service
name = "Departmental Protolathe - Service (Machine Board)"