Skip to content

Commit

Permalink
Last Stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Stakks committed May 2, 2018
1 parent 7ad5c08 commit 25cae8f
Show file tree
Hide file tree
Showing 25 changed files with 1,369 additions and 87 deletions.
18 changes: 18 additions & 0 deletions code/modules/integrated_electronics/_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#define COLOR_WHITE "#ffffff"
#define COLOR_SILVER "#c0c0c0"
#define COLOR_GRAY "#808080"
#define COLOR_FLOORTILE_GRAY "#8D8B8B"
#define COLOR_BLACK "#000000"
#define COLOR_RED "#ff0000"
#define COLOR_RED_LIGHT "#b00000"
Expand Down Expand Up @@ -77,6 +78,23 @@
#define COLOR_PURPLE_GRAY "#a2819e"
#define COLOR_SUN "#ec8b2f"

//Color defines used by the assembly detailer.
#define COLOR_ASSEMBLY_BLACK "#545454"
#define COLOR_ASSEMBLY_BGRAY "#9497AB"
#define COLOR_ASSEMBLY_WHITE "#E2E2E2"
#define COLOR_ASSEMBLY_RED "#CC4242"
#define COLOR_ASSEMBLY_ORANGE "#E39751"
#define COLOR_ASSEMBLY_BEIGE "#AF9366"
#define COLOR_ASSEMBLY_BROWN "#97670E"
#define COLOR_ASSEMBLY_GOLD "#AA9100"
#define COLOR_ASSEMBLY_YELLOW "#CECA2B"
#define COLOR_ASSEMBLY_GURKHA "#999875"
#define COLOR_ASSEMBLY_LGREEN "#789876"
#define COLOR_ASSEMBLY_GREEN "#44843C"
#define COLOR_ASSEMBLY_LBLUE "#5D99BE"
#define COLOR_ASSEMBLY_BLUE "#38559E"
#define COLOR_ASSEMBLY_PURPLE "#6F6192"

var/global/list/alphabet_uppercase = list("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

var/list/all_integrated_circuits = list()
Expand Down
182 changes: 178 additions & 4 deletions code/modules/integrated_electronics/core/assemblies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,61 @@
name = "electronic assembly"
desc = "It's a case, for building electronics with."
w_class = 2
icon = 'icons/obj/electronic_assemblies.dmi'
icon = 'icons/obj/assemblies/electronic_setups.dmi'
icon_state = "setup_small"
var/show_messages = TRUE
var/max_components = IC_COMPONENTS_BASE
var/max_complexity = IC_COMPLEXITY_BASE
var/opened = 0
var/detail_color = COLOR_ASSEMBLY_BLACK
var/list/color_whitelist = list( //This is just for checking that hacked colors aren't in the save data.
COLOR_ASSEMBLY_BLACK,
COLOR_FLOORTILE_GRAY,
COLOR_ASSEMBLY_BGRAY,
COLOR_ASSEMBLY_WHITE,
COLOR_ASSEMBLY_RED,
COLOR_ASSEMBLY_ORANGE,
COLOR_ASSEMBLY_BEIGE,
COLOR_ASSEMBLY_BROWN,
COLOR_ASSEMBLY_GOLD,
COLOR_ASSEMBLY_YELLOW,
COLOR_ASSEMBLY_GURKHA,
COLOR_ASSEMBLY_LGREEN,
COLOR_ASSEMBLY_GREEN,
COLOR_ASSEMBLY_LBLUE,
COLOR_ASSEMBLY_BLUE,
COLOR_ASSEMBLY_PURPLE
)
var/obj/item/weapon/stock_parts/cell/battery = null // Internal cell which most circuits need to work.

/obj/item/device/electronic_assembly/default //The /default electronic_assemblys are to allow the introduction of the new naming scheme without breaking old saves.
name = "type-a electronic assembly"

/obj/item/device/electronic_assembly/calc
name = "type-b electronic assembly"
icon_state = "setup_small_calc"
desc = "It's a case, for building small electronics with. This one resembles a pocket calculator."

/obj/item/device/electronic_assembly/clam
name = "type-c electronic assembly"
icon_state = "setup_small_clam"
desc = "It's a case, for building small electronics with. This one has a clamshell design."

/obj/item/device/electronic_assembly/simple
name = "type-d electronic assembly"
icon_state = "setup_small_simple"
desc = "It's a case, for building small electronics with. This one has a simple design."

/obj/item/device/electronic_assembly/hook
name = "type-e electronic assembly"
icon_state = "setup_small_hook"
desc = "It's a case, for building small electronics with. This one looks like it has a belt clip, but it's purely decorative."

/obj/item/device/electronic_assembly/pda
name = "type-f electronic assembly"
icon_state = "setup_small_pda"
desc = "It's a case, for building small electronics with. This one resembles a PDA."

/obj/item/device/electronic_assembly/medium
name = "electronic mechanism"
icon_state = "setup_medium"
Expand All @@ -21,21 +68,132 @@
max_components = IC_COMPONENTS_BASE * 2
max_complexity = IC_COMPLEXITY_BASE * 2

/obj/item/device/electronic_assembly/medium/default
name = "type-a electronic mechanism"

/obj/item/device/electronic_assembly/medium/box
name = "type-b electronic mechanism"
icon_state = "setup_medium_box"
desc = "It's a case, for building medium-sized electronics with. This one has a boxy design."

/obj/item/device/electronic_assembly/medium/clam
name = "type-c electronic mechanism"
icon_state = "setup_medium_clam"
desc = "It's a case, for building medium-sized electronics with. This one has a clamshell design."

/obj/item/device/electronic_assembly/medium/medical
name = "type-d electronic mechanism"
icon_state = "setup_medium_med"
desc = "It's a case, for building medium-sized electronics with. This one resembles some type of medical apparatus."

/obj/item/device/electronic_assembly/medium/gun
name = "type-e electronic mechanism"
icon_state = "setup_medium_gun"
desc = "It's a case, for building medium-sized electronics with. This one resembles a gun, or some type of tool, if you're feeling optimistic."

/obj/item/device/electronic_assembly/medium/radio
name = "type-f electronic mechanism"
icon_state = "setup_medium_radio"
desc = "It's a case, for building medium-sized electronics with. This one resembles an old radio."

/obj/item/device/electronic_assembly/large
name = "electronic machine"
icon_state = "setup_large"
desc = "It's a case, for building large electronics with."
w_class = 4
w_class = 5
max_components = IC_COMPONENTS_BASE * 4
max_complexity = IC_COMPLEXITY_BASE * 4

/obj/item/device/electronic_assembly/large/default
name = "type-a electronic machine"

/obj/item/device/electronic_assembly/large/scope
name = "type-b electronic machine"
icon_state = "setup_large_scope"
desc = "It's a case, for building large electronics with. This one resembles an oscilloscope."

/obj/item/device/electronic_assembly/large/terminal
name = "type-c electronic machine"
icon_state = "setup_large_terminal"
desc = "It's a case, for building large electronics with. This one resembles a computer terminal."

/obj/item/device/electronic_assembly/large/arm
name = "type-d electronic machine"
icon_state = "setup_large_arm"
desc = "It's a case, for building large electronics with. This one resembles a robotic arm."

/obj/item/device/electronic_assembly/large/tall
name = "type-e electronic machine"
icon_state = "setup_large_tall"
desc = "It's a case, for building large electronics with. This one has a tall design."

/obj/item/device/electronic_assembly/large/industrial
name = "type-f electronic machine"
icon_state = "setup_large_industrial"
desc = "It's a case, for building large electronics with. This one resembles some kind of industrial machinery."

/obj/item/device/electronic_assembly/drone
name = "electronic drone"
icon_state = "setup_drone"
desc = "It's a case, for building mobile electronics with."
w_class = 4
max_components = IC_COMPONENTS_BASE * 3
max_complexity = IC_COMPLEXITY_BASE * 3

/obj/item/device/electronic_assembly/drone/can_move()
return TRUE

/obj/item/device/electronic_assembly/drone/default
name = "type-a electronic drone"

/obj/item/device/electronic_assembly/drone/arms
name = "type-b electronic drone"
icon_state = "setup_drone_arms"
desc = "It's a case, for building mobile electronics with. This one is armed and dangerous."

/obj/item/device/electronic_assembly/drone/secbot
name = "type-c electronic drone"
icon_state = "setup_drone_secbot"
desc = "It's a case, for building mobile electronics with. This one resembles a Securitron."

/obj/item/device/electronic_assembly/drone/medbot
name = "type-d electronic drone"
icon_state = "setup_drone_medbot"
desc = "It's a case, for building mobile electronics with. This one resembles a Medibot."

/obj/item/device/electronic_assembly/drone/genbot
name = "type-e electronic drone"
icon_state = "setup_drone_genbot"
desc = "It's a case, for building mobile electronics with. This one has a generic bot design."

/obj/item/device/electronic_assembly/drone/android
name = "type-f electronic drone"
icon_state = "setup_drone_android"
desc = "It's a case, for building mobile electronics with. This one has a hominoid design."

/obj/item/device/electronic_assembly/wallmount
name = "wall-mounted electronic assembly"
icon_state = "setup_wallmount_medium"
desc = "It's a case, for building medium-sized electronics with. It has a magnetized backing to allow it to stick to walls, but you'll still need to wrench the anchoring bolts in place to keep it on."
w_class = 3
max_components = IC_COMPONENTS_BASE * 1.5
max_complexity = IC_COMPLEXITY_BASE * 1.5
max_components = IC_COMPONENTS_BASE * 2
max_complexity = IC_COMPLEXITY_BASE * 2

/obj/item/device/electronic_assembly/wallmount/heavy
name = "heavy wall-mounted electronic assembly"
icon_state = "setup_wallmount_large"
desc = "It's a case, for building large electronics with. It has a magnetized backing to allow it to stick to walls, but you'll still need to wrench the anchoring bolts in place to keep it on."
w_class = 5
max_components = IC_COMPONENTS_BASE * 4
max_complexity = IC_COMPLEXITY_BASE * 4

/obj/item/device/electronic_assembly/wallmount/light
name = "light wall-mounted electronic assembly"
icon_state = "setup_wallmount_small"
desc = "It's a case, for building small electronics with. It has a magnetized backing to allow it to stick to walls, but you'll still need to wrench the anchoring bolts in place to keep it on."
w_class = 2
max_components = IC_COMPONENTS_BASE
max_complexity = IC_COMPLEXITY_BASE

/obj/item/device/electronic_assembly/implant
name = "electronic implant"
Expand Down Expand Up @@ -75,6 +233,12 @@
/obj/item/device/electronic_assembly/implant/update_icon()
..()
implant.icon_state = icon_state
overlays.Cut()
if(detail_color == COLOR_ASSEMBLY_BLACK) //Black colored overlay looks almost but not exactly like the base sprite, so just cut the overlay and avoid it looking kinda off.
return
var/image/detail_overlay = image('icons/obj/assemblies/electronic_setups.dmi', "[icon_state]-color")
detail_overlay.color = detail_color
overlays.Add(detail_overlay)


/obj/item/device/electronic_assembly/implant/proc/nano_host()
Expand Down Expand Up @@ -184,6 +348,12 @@
icon_state = initial(icon_state) + "-open"
else
icon_state = initial(icon_state)
overlays.Cut()
if(detail_color == COLOR_ASSEMBLY_BLACK) //Black colored overlay looks almost but not exactly like the base sprite, so just cut the overlay and avoid it looking kinda off.
return
var/image/detail_overlay = image('icons/obj/assemblies/electronic_setups.dmi', "[icon_state]-color")
detail_overlay.color = detail_color
overlays.Add(detail_overlay)

/obj/item/device/electronic_assembly/examine(mob/user)
. = ..(user, 1)
Expand Down Expand Up @@ -280,6 +450,10 @@
to_chat(user, "<span class='notice'>You slot \the [cell] inside \the [src]'s power supplier.</span>")
interact(user)
return TRUE
else if(istype(I, /obj/item/device/integrated_electronics/detailer))
var/obj/item/device/integrated_electronics/detailer/D = I
detail_color = D.detail_color
update_icon()
else
return ..()

Expand Down
46 changes: 46 additions & 0 deletions code/modules/integrated_electronics/core/detailer.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/obj/item/device/integrated_electronics/detailer
name = "assembly detailer"
desc = "A combination autopainter and flash anodizer designed to give electronic assemblies a colorful, wear-resistant finish."
icon = 'icons/obj/assemblies/electronic_tools.dmi'
icon_state = "detailer"
w_class = 2
var/data_to_write = null
var/accepting_refs = FALSE
var/detail_color = COLOR_ASSEMBLY_WHITE
var/list/color_list = list(
"black" = COLOR_ASSEMBLY_BLACK,
"gray" = COLOR_FLOORTILE_GRAY,
"machine gray" = COLOR_ASSEMBLY_BGRAY,
"white" = COLOR_ASSEMBLY_WHITE,
"red" = COLOR_ASSEMBLY_RED,
"orange" = COLOR_ASSEMBLY_ORANGE,
"beige" = COLOR_ASSEMBLY_BEIGE,
"brown" = COLOR_ASSEMBLY_BROWN,
"gold" = COLOR_ASSEMBLY_GOLD,
"yellow" = COLOR_ASSEMBLY_YELLOW,
"gurkha" = COLOR_ASSEMBLY_GURKHA,
"light green" = COLOR_ASSEMBLY_LGREEN,
"green" = COLOR_ASSEMBLY_GREEN,
"light blue" = COLOR_ASSEMBLY_LBLUE,
"blue" = COLOR_ASSEMBLY_BLUE,
"purple" = COLOR_ASSEMBLY_PURPLE
)

/obj/item/device/integrated_electronics/detailer/New()
.=..()
update_icon()

/obj/item/device/integrated_electronics/detailer/update_icon()
overlays.Cut()
var/image/detail_overlay = image('icons/obj/assemblies/electronic_tools.dmi', "detailer-color")
detail_overlay.color = detail_color
overlays.Add(detail_overlay)

/obj/item/device/integrated_electronics/detailer/attack_self(mob/user)
var/color_choice = input(user, "Select color.", "Assembly Detailer") as null|anything in color_list
if(!color_list[color_choice])
return
if(!in_range(src, user))
return
detail_color = color_list[color_choice]
update_icon()
2 changes: 2 additions & 0 deletions code/modules/integrated_electronics/core/pins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ list[](

/datum/integrated_io/proc/write_data_to_pin(var/new_data)
if(isnull(new_data) || isnum(new_data) || istext(new_data) || isweakref(new_data)) // Anything else is a type we don't want.
if(istext(new_data))
new_data = sanitize_text(new_data, MAX_MESSAGE_LEN, 0, 0)
data = new_data
holder.on_data_written()

Expand Down
36 changes: 30 additions & 6 deletions code/modules/integrated_electronics/core/printer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,33 @@
// Now for non-circuit things.
var/list/assembly_list = list()
assembly_list.Add(
new /obj/item/device/electronic_assembly(null),
new /obj/item/device/electronic_assembly/medium(null),
new /obj/item/device/electronic_assembly/large(null),
new /obj/item/device/electronic_assembly/drone(null),
new /obj/item/device/electronic_assembly/default(null),
new /obj/item/device/electronic_assembly/calc(null),
new /obj/item/device/electronic_assembly/clam(null),
new /obj/item/device/electronic_assembly/simple(null),
new /obj/item/device/electronic_assembly/hook(null),
new /obj/item/device/electronic_assembly/pda(null),
new /obj/item/device/electronic_assembly/medium/default(null),
new /obj/item/device/electronic_assembly/medium/box(null),
new /obj/item/device/electronic_assembly/medium/clam(null),
new /obj/item/device/electronic_assembly/medium/medical(null),
new /obj/item/device/electronic_assembly/medium/gun(null),
new /obj/item/device/electronic_assembly/medium/radio(null),
new /obj/item/device/electronic_assembly/large/default(null),
new /obj/item/device/electronic_assembly/large/scope(null),
new /obj/item/device/electronic_assembly/large/terminal(null),
new /obj/item/device/electronic_assembly/large/arm(null),
new /obj/item/device/electronic_assembly/large/tall(null),
new /obj/item/device/electronic_assembly/large/industrial(null),
new /obj/item/device/electronic_assembly/drone/default(null),
new /obj/item/device/electronic_assembly/drone/arms(null),
new /obj/item/device/electronic_assembly/drone/secbot(null),
new /obj/item/device/electronic_assembly/drone/medbot(null),
new /obj/item/device/electronic_assembly/drone/genbot(null),
new /obj/item/device/electronic_assembly/drone/android(null),
new /obj/item/device/electronic_assembly/wallmount/light(null),
new /obj/item/device/electronic_assembly/wallmount(null),
new /obj/item/device/electronic_assembly/wallmount/heavy(null),
new /obj/item/weapon/implant/integrated_circuit(null),
new /obj/item/device/assembly/electronic_assembly(null)
)
Expand All @@ -64,7 +87,8 @@
var/list/tools_list = list()
tools_list.Add(
new /obj/item/device/integrated_electronics/wirer(null),
new /obj/item/device/integrated_electronics/debugger(null)
new /obj/item/device/integrated_electronics/debugger(null),
new /obj/item/device/integrated_electronics/detailer(null)
)
recipe_list["Tools"] = tools_list

Expand All @@ -77,7 +101,7 @@
to_chat(user, "<span class='warning'>\The [src] is too full to add more metal.</span>")
return
if(stack.amount >= num)
stack.amount -= num
stack.use(num)
to_chat(user, "<span class='notice'>You add [num] sheet\s to \the [src].</span>")
metal += num * metal_per_sheet
interact(user)
Expand Down
Loading

0 comments on commit 25cae8f

Please sign in to comment.