Circuits port plus (#4152)

* initial

* gitignore

* oopsie

* another quick fix for dumb mistake

* Update code/modules/integrated_electronics/core/assemblies.dm

Co-authored-by: Zandario <zandarioh@gmail.com>

* formatting update

* dumb whoops fix

* com,ment formattin,g ftw (aka
commas eating code)

* bugfix (text2path != text2num)

* bugfix tgui

* fix

* fixes

Co-authored-by: Zandario <zandarioh@gmail.com>
This commit is contained in:
lingonberry1234
2022-06-09 13:49:01 -07:00
committed by GitHub
co-authored by Zandario
parent 1731bc22d4
commit bfdff29d92
71 changed files with 6104 additions and 1390 deletions
@@ -1,6 +1,6 @@
// The base subtype for assemblies that can be worn. Certain pieces will have more or less capabilities
// E.g. Glasses have less room than something worn over the chest.
// The base subtype for assemblies that can be worn. Certain pieces will have more or less capabilities
// E.g. Glasses have less room than something worn over the chest.
// Note that the electronic assembly is INSIDE the object that actually gets worn, in a similar way to implants.
/obj/item/electronic_assembly/clothing
@@ -15,6 +15,9 @@
/obj/item/electronic_assembly/clothing/ui_host()
return clothing.ui_host()
/obj/item/electronic_assembly/clothing/ui_action_click()
clothing.action_circuit.do_work()
/obj/item/electronic_assembly/clothing/update_icon()
..()
clothing.icon_state = icon_state
@@ -35,65 +38,57 @@
// This is defined higher up, in /clothing to avoid lots of copypasta.
/obj/item/clothing
var/obj/item/electronic_assembly/clothing/IC = null
var/obj/item/electronic_assembly/clothing/EA = null
var/obj/item/integrated_circuit/built_in/action_button/action_circuit = null // This gets pulsed when someone clicks the button on the hud.
/obj/item/clothing/emp_act(severity)
if(IC)
IC.emp_act(severity)
if(EA)
EA.emp_act(severity)
..()
/obj/item/clothing/examine(mob/user)
if(IC)
IC.examine(user)
if(EA)
EA.examine(user)
. = ..()
/obj/item/clothing/attackby(obj/item/I, mob/user)
if(IC)
// This needs to be done in a better way...
if(I.is_crowbar() || I.is_screwdriver() || istype(I, /obj/item/integrated_circuit) || istype(I, /obj/item/cell/device) || istype(I, /obj/item/integrated_electronics) )
IC.attackby(I, user)
else
..()
if(EA)
return EA.attackby(I, user) ? null : ..()
..()
/obj/item/clothing/attack_self(mob/user)
if(IC)
if(IC.opened)
IC.attack_self(user)
else
action_circuit.do_work()
if(EA && EA.opened)
EA.attack_self(user)
else
..()
/obj/item/clothing/Moved(oldloc)
if(IC)
IC.on_loc_moved(oldloc)
else
..()
EA ? EA.on_loc_moved(oldloc) : ..()
/obj/item/clothing/on_loc_moved(oldloc)
if(IC)
IC.on_loc_moved(oldloc)
else
..()
EA ? EA.on_loc_moved(oldloc) : ..()
// Does most of the repeatative setup.
/obj/item/clothing/proc/setup_integrated_circuit(new_type)
// Set up the internal circuit holder.
IC = new new_type(src)
IC.clothing = src
IC.name = name
EA = new new_type(src)
EA.clothing = src
EA.name = name
// Clothing assemblies can be triggered by clicking on the HUD. This allows that to occur.
action_circuit = new(src.EA)
EA.add_component(action_circuit)
var/obj/item/integrated_circuit/built_in/self_sensor/S = new(src.EA)
EA.add_component(S)
EA.action_button_name = "Activate [name]"
// Clothing assemblies can be triggered by clicking on the HUD. This allows that to occur.
action_circuit = new(src.IC)
IC.force_add_circuit(action_circuit)
action_button_name = "Activate [name]"
/obj/item/clothing/Destroy()
if(IC)
IC.clothing = null
if(EA)
EA.clothing = null
action_circuit = null // Will get deleted by qdel-ing the IC assembly.
qdel(IC)
qdel(EA)
return ..()
// Specific subtypes.
@@ -101,7 +96,7 @@
// Jumpsuit.
/obj/item/clothing/under/circuitry
name = "electronic jumpsuit"
desc = "It's a wearable case for electronics. This on is a black jumpsuit with wiring weaved into the fabric."
desc = "It's a wearable case for electronics. This one is a black jumpsuit with wiring woven into the fabric."
icon_state = "circuitry"
worn_state = "circuitry"
@@ -113,7 +108,7 @@
// Gloves.
/obj/item/clothing/gloves/circuitry
name = "electronic gloves"
desc = "It's a wearable case for electronics. This one is a pair of black gloves, with wires woven into them. A small \
desc = "A wearable case for electronics comprising a pair of black gloves, with wires woven through the fabric. A small \
device with a screen is attached to the left glove."
icon_state = "circuitry"
item_state = "circuitry"
@@ -123,22 +118,21 @@
return ..()
// Watch.
/obj/item/clothing/gloves/ewatch
/obj/item/clothing/gloves/ewatch/circuitry
name = "electronic watch"
desc = "It's a wearable case for electronics. This one is a digital watch, with an antenna and button array attatched to it.\
desc = "A wearable case for electronics; a digital watch with an antenna and button array attatched to it.\
Practical and stylish!"
icon_state = "communicator"
item_state = "ewatch"
/obj/item/clothing/gloves/circuitry/Initialize(mapload)
/obj/item/clothing/gloves/ewatch/circuitry/Initialize(mapload)
setup_integrated_circuit(/obj/item/electronic_assembly/clothing/small)
return ..()
// Glasses.
/obj/item/clothing/glasses/circuitry
name = "electronic goggles"
desc = "It's a wearable case for electronics. This one is a pair of goggles, with wiring sticking out. \
Could this augment your vision?" // Sadly it won't, or at least not yet.
desc = "A wearable case for electronics; a pair of goggles, with exposed wiring. Could this augment your vision?" // Sadly it won't, or at least not yet.
icon_state = "circuitry"
item_state = "night" // The on-mob sprite would be identical anyways.
@@ -149,8 +143,7 @@
// Shoes
/obj/item/clothing/shoes/circuitry
name = "electronic boots"
desc = "It's a wearable case for electronics. This one is a pair of boots, with wires attached to a small \
cover."
desc = "A wearable case for electronics comprising a pair of boots with sleek maintenance hatches on the inside leg."
icon_state = "circuitry"
item_state = "circuitry"
@@ -161,8 +154,7 @@
// Head
/obj/item/clothing/head/circuitry
name = "electronic headwear"
desc = "It's a wearable case for electronics. This one appears to be a very technical-looking piece that \
goes around the collar, with a heads-up-display attached on the right."
desc = "A a very technical-looking wearable case for electronics that clasps around the collar with a heads-up-display attached on the right."
icon_state = "circuitry"
item_state = "circuitry"
@@ -173,7 +165,7 @@
// Ear
/obj/item/clothing/ears/circuitry
name = "electronic earwear"
desc = "It's a wearable case for electronics. This one appears to be a technical-looking headset."
desc = "A wearable case for electronics, bulkier than your average headset."
icon = 'icons/obj/clothing/ears.dmi'
icon_state = "circuitry"
item_state = "circuitry"
@@ -185,8 +177,7 @@
// Exo-slot
/obj/item/clothing/suit/circuitry
name = "electronic chestpiece"
desc = "It's a wearable case for electronics. This one appears to be a very technical-looking vest, that \
almost looks professionally made, however the wiring popping out betrays that idea."
desc = "A wearable case for electronics that sits over the chest and back. The sheer bulk of it gives it an imposing presence."
icon_state = "circuitry"
item_state = "circuitry"
@@ -1,6 +1,6 @@
/obj/item/assembly/electronic_assembly
name = "electronic device"
desc = "It's a case for building electronics with. It can be attached to other small devices."
desc = "It's a case for building electronics with. It can be attached to other small devices."
icon_state = "setup_device"
var/opened = 0
@@ -45,14 +45,14 @@
/obj/item/assembly/electronic_assembly/pulsed(var/radio = 0) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
if(EA)
for(var/obj/item/integrated_circuit/built_in/device_input/I in EA.contents)
for(var/obj/item/integrated_circuit/built_in/device_input/I in EA.assembly_components)
I.do_work()
return
/obj/item/assembly/electronic_assembly/examine(mob/user)
. = ..()
if(EA)
for(var/obj/item/integrated_circuit/IC in EA.contents)
for(var/obj/item/integrated_circuit/IC in EA.assembly_components)
IC.external_examine(user)
/obj/item/assembly/electronic_assembly/verb/toggle()
@@ -73,7 +73,6 @@
max_components = IC_COMPONENTS_BASE * 3/4
max_complexity = IC_COMPLEXITY_BASE * 3/4
/obj/item/electronic_assembly/device/Initialize(mapload)
. = ..()
var/obj/item/integrated_circuit/built_in/device_input/input = new(src)
@@ -1,35 +1,5 @@
// Generic subtypes without a lot of special code.
// Small assemblies.
/obj/item/electronic_assembly/default
name = "type-a electronic assembly"
/obj/item/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/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/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/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/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."
// Tiny assemblies.
/obj/item/electronic_assembly/tiny
@@ -46,22 +16,62 @@
/obj/item/electronic_assembly/tiny/cylinder
name = "type-b electronic device"
icon_state = "setup_device_cylinder"
desc = "It's a case, for building tiny-sized electronics with. This one has a cylindrical design."
desc = "It's a case, for building tiny-sized electronics with. This one has a cylindrical design."
/obj/item/electronic_assembly/tiny/scanner
name = "type-c electronic device"
icon_state = "setup_device_scanner"
desc = "It's a case, for building tiny-sized electronics with. This one has a scanner-like design."
desc = "It's a case, for building tiny-sized electronics with. This one has a scanner-like design."
/obj/item/electronic_assembly/tiny/hook
name = "type-d electronic device"
icon_state = "setup_device_hook"
desc = "It's a case, for building tiny-sized electronics with. This one looks like it has a belt clip, but it's purely decorative."
desc = "It's a case, for building tiny-sized electronics with. This one looks like it has a belt clip, but it's purely decorative."
/obj/item/electronic_assembly/tiny/box
name = "type-e electronic device"
icon_state = "setup_device_box"
desc = "It's a case, for building tiny-sized electronics with. This one has a boxy design."
desc = "It's a case, for building tiny-sized electronics with. This one has a boxy design."
/obj/item/electronic_assembly/tiny/dildo
name = "type-f electronic device"
icon_state = "setup_dildo_small"
desc = "It's a case, for building tiny-sized electronics with. This one has a phallic design."
// Small assemblies.
/obj/item/electronic_assembly/default
name = "type-a electronic assembly"
/obj/item/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/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/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/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/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/electronic_assembly/dildo
name = "type-g electronic assembly"
icon_state = "setup_dildo_medium"
desc = "It's a case, for building small electronics with. This one has a phallic design."
// Medium assemblies.
@@ -79,25 +89,25 @@
/obj/item/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."
desc = "It's a case, for building medium-sized electronics with. This one has a boxy design."
/obj/item/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."
desc = "It's a case, for building medium-sized electronics with. This one has a clamshell design."
/obj/item/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."
desc = "It's a case, for building medium-sized electronics with. This one resembles some type of medical apparatus."
/obj/item/electronic_assembly/medium/gun
name = "type-e electronic mechanism"
icon_state = "setup_medium_gun"
item_state = "circuitgun"
desc = "It's a case, for building medium-sized electronics with. This one resembles a gun, or some type of tool, \
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."
// can_fire_equipped = TRUE
can_fire_equipped = TRUE
item_icons = list(
slot_l_hand_str = 'icons/mob/items/lefthand_guns.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_guns.dmi',
@@ -106,7 +116,12 @@
/obj/item/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."
desc = "It's a case, for building medium-sized electronics with. This one resembles an old radio."
/obj/item/electronic_assembly/medium/dildo
name = "type-g electronic mechanism"
icon_state = "setup_dildo_large"
desc = "It's a case, for building medium-sized electronics with. This one has a phallic design."
// Large assemblies.
@@ -125,32 +140,32 @@
/obj/item/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."
desc = "It's a case, for building large electronics with. This one resembles an oscilloscope."
/obj/item/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."
desc = "It's a case, for building large electronics with. This one resembles a computer terminal."
/obj/item/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."
desc = "It's a case, for building large electronics with. This one resembles a robotic arm."
/obj/item/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."
desc = "It's a case, for building large electronics with. This one has a tall design."
/obj/item/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."
desc = "It's a case, for building large electronics with. This one resembles some kind of industrial machinery."
/obj/item/electronic_assembly/large/vendor
name = "type-g electronic machine"
icon_state = "setup_large_vendor"
desc = "It's a case, for building large electronics with. This one resembles a vending machine."
desc = "It's a case, for building large electronics with. This one resembles a vending machine."
// Drone assemblies, which can move with the locomotion circuit.
@@ -158,9 +173,10 @@
name = "electronic drone"
icon_state = "setup_drone"
desc = "It's a case, for building mobile electronics with."
w_class = ITEMSIZE_NORMAL
max_components = IC_COMPONENTS_BASE * 1.5
max_complexity = IC_COMPLEXITY_BASE * 1.5
w_class = ITEMSIZE_LARGE
max_components = IC_COMPONENTS_BASE * 3
max_complexity = IC_COMPLEXITY_BASE * 3
allowed_circuit_action_flags = IC_ACTION_MOVEMENT | IC_ACTION_COMBAT | IC_ACTION_LONG_RANGE
can_anchor = FALSE
/obj/item/electronic_assembly/drone/can_move()
@@ -172,34 +188,37 @@
/obj/item/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."
desc = "It's a case, for building mobile electronics with. This one is armed and dangerous."
/obj/item/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."
desc = "It's a case, for building mobile electronics with. This one resembles a Securitron."
/obj/item/electronic_assembly/drone/medibot
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."
desc = "It's a case, for building mobile electronics with. This one resembles a Medibot."
/obj/item/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."
desc = "It's a case, for building mobile electronics with. This one has a generic bot design."
/obj/item/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."
desc = "It's a case, for building mobile electronics with. This one has a hominoid design."
w_class = ITEMSIZE_COST_HUGE
max_components = IC_COMPONENTS_BASE * 5
max_complexity = IC_COMPLEXITY_BASE * 5
// Wall mounted assemblies.
/obj/item/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 \
desc = "It's a case, for building medium-sized electronics with. It has a magnetized \
backing to allow it to stick to walls."
w_class = ITEMSIZE_NORMAL
max_components = IC_COMPONENTS_BASE * 2
@@ -243,7 +262,7 @@
/obj/item/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 \
desc = "It's a case, for building large electronics with. It has a magnetized backing \
to allow it to stick to walls."
w_class = ITEMSIZE_LARGE
max_components = IC_COMPONENTS_BASE * 4
@@ -252,7 +271,7 @@
/obj/item/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 \
desc = "It's a case, for building small electronics with. It has a magnetized backing \
to allow it to stick to walls."
w_class = ITEMSIZE_SMALL
max_components = IC_COMPONENTS_BASE
@@ -261,7 +280,7 @@
/obj/item/electronic_assembly/wallmount/tiny
name = "tiny wall-mounted electronic assembly"
icon_state = "setup_wallmount_tiny"
desc = "It's a case, for building tiny electronics with. It has a magnetized backing \
desc = "It's a case, for building tiny electronics with. It has a magnetized backing \
to allow it to stick to walls."
w_class = ITEMSIZE_TINY
max_components = IC_COMPONENTS_BASE / 2