Makes some machines upgradeable (#3311)

Adds the ability to upgrade the following:
- Sleepers
- The ore processor
- All cooking appliances (Minus the microwave)
- Tesla Coil

Also makes components not spawn in machines until they are needed (When they are being upgraded) to reduce the objects generated. Adds some new macro's and converts some istypes to use them. And moves stock parts into their own file.
This commit is contained in:
Ron
2017-08-28 02:51:37 -04:00
committed by Lohikar
parent f8bcaf4864
commit ceab73c63e
32 changed files with 466 additions and 262 deletions

View File

@@ -56,6 +56,8 @@ using metal and glass, it uses glass and reagents (usually sulphuric acid).
/obj/machinery/r_n_d/circuit_imprinter/RefreshParts()
// Adjust reagent container volume to match combined volume of the inserted beakers
if(!component_parts)
populate_components()
var/T = 0
for(var/obj/item/weapon/reagent_containers/glass/G in component_parts)
T += G.reagents.maximum_volume

View File

@@ -25,6 +25,8 @@ Note: Must be placed within 3 tiles of the R&D Console
/obj/machinery/r_n_d/destructive_analyzer/RefreshParts()
var/T = 0
if(!component_parts)
T = 3
for(var/obj/item/weapon/stock_parts/S in component_parts)
T += S.rating
decon_mod = T * 0.1

View File

@@ -56,6 +56,8 @@
return t
/obj/machinery/r_n_d/protolathe/RefreshParts()
if(!component_parts)
populate_components()
// Adjust reagent container volume to match combined volume of the inserted beakers
var/T = 0
for(var/obj/item/weapon/reagent_containers/glass/G in component_parts)

View File

@@ -26,7 +26,9 @@
/obj/machinery/r_n_d/server/RefreshParts()
var/tot_rating = 0
for(var/obj/item/weapon/stock_parts/SP in src)
if(!component_parts)
tot_rating = 2
for(var/obj/item/weapon/stock_parts/SP in component_parts)
tot_rating += SP.rating
idle_power_usage /= max(1, tot_rating)

View File

@@ -0,0 +1,188 @@
/obj/item/weapon/stock_parts
name = "stock part"
desc = "What?"
gender = PLURAL
icon = 'icons/obj/stock_parts.dmi'
w_class = 2.0
var/rating = 1
/obj/item/weapon/stock_parts/Initialize()
. = ..()
src.pixel_x = rand(-5.0, 5)
src.pixel_y = rand(-5.0, 5)
//Rank 1
/obj/item/weapon/stock_parts/console_screen
name = "console screen"
desc = "Used in the construction of computers and other devices with a interactive console."
icon_state = "screen"
origin_tech = list(TECH_MATERIAL = 1)
matter = list("glass" = 200)
/obj/item/weapon/stock_parts/capacitor
name = "capacitor"
desc = "A basic capacitor used in the construction of a variety of devices."
icon_state = "capacitor"
origin_tech = list(TECH_POWER = 1)
matter = list(DEFAULT_WALL_MATERIAL = 50,"glass" = 50)
/obj/item/weapon/stock_parts/scanning_module
name = "scanning module"
desc = "A compact, high resolution scanning module used in the construction of certain devices."
icon_state = "scan_module"
origin_tech = list(TECH_MAGNET = 1)
matter = list(DEFAULT_WALL_MATERIAL = 50,"glass" = 20)
/obj/item/weapon/stock_parts/manipulator
name = "micro-manipulator"
desc = "A tiny little manipulator used in the construction of certain devices."
icon_state = "micro_mani"
origin_tech = list(TECH_MATERIAL = 1, TECH_DATA = 1)
matter = list(DEFAULT_WALL_MATERIAL = 30)
/obj/item/weapon/stock_parts/micro_laser
name = "micro-laser"
desc = "A tiny laser used in certain devices."
icon_state = "micro_laser"
origin_tech = list(TECH_MAGNET = 1)
matter = list(DEFAULT_WALL_MATERIAL = 10,"glass" = 20)
/obj/item/weapon/stock_parts/matter_bin
name = "matter bin"
desc = "A container for hold compressed matter awaiting re-construction."
icon_state = "matter_bin"
origin_tech = list(TECH_MATERIAL = 1)
matter = list(DEFAULT_WALL_MATERIAL = 80)
//Rank 2
/obj/item/weapon/stock_parts/capacitor/adv
name = "advanced capacitor"
desc = "An advanced capacitor used in the construction of a variety of devices."
origin_tech = list(TECH_POWER = 3)
rating = 2
matter = list(DEFAULT_WALL_MATERIAL = 50,"glass" = 50)
/obj/item/weapon/stock_parts/scanning_module/adv
name = "advanced scanning module"
desc = "A compact, high resolution scanning module used in the construction of certain devices."
icon_state = "scan_module"
origin_tech = list(TECH_MAGNET = 3)
rating = 2
matter = list(DEFAULT_WALL_MATERIAL = 50,"glass" = 20)
/obj/item/weapon/stock_parts/manipulator/nano
name = "nano-manipulator"
desc = "A tiny little manipulator used in the construction of certain devices."
icon_state = "nano_mani"
origin_tech = list(TECH_MATERIAL = 3, TECH_DATA = 2)
rating = 2
matter = list(DEFAULT_WALL_MATERIAL = 30)
/obj/item/weapon/stock_parts/micro_laser/high
name = "high-power micro-laser"
desc = "A tiny laser used in certain devices."
icon_state = "high_micro_laser"
origin_tech = list(TECH_MAGNET = 3)
rating = 2
matter = list(DEFAULT_WALL_MATERIAL = 10,"glass" = 20)
/obj/item/weapon/stock_parts/matter_bin/adv
name = "advanced matter bin"
desc = "A container for hold compressed matter awaiting re-construction."
icon_state = "advanced_matter_bin"
origin_tech = list(TECH_MATERIAL = 3)
rating = 2
matter = list(DEFAULT_WALL_MATERIAL = 80)
//Rating 3
/obj/item/weapon/stock_parts/capacitor/super
name = "super capacitor"
desc = "A super-high capacity capacitor used in the construction of a variety of devices."
origin_tech = list(TECH_POWER = 5, TECH_MATERIAL = 4)
rating = 3
matter = list(DEFAULT_WALL_MATERIAL = 50,"glass" = 50)
/obj/item/weapon/stock_parts/scanning_module/phasic
name = "phasic scanning module"
desc = "A compact, high resolution phasic scanning module used in the construction of certain devices."
origin_tech = list(TECH_MAGNET = 5)
rating = 3
matter = list(DEFAULT_WALL_MATERIAL = 50,"glass" = 20)
/obj/item/weapon/stock_parts/manipulator/pico
name = "pico-manipulator"
desc = "A tiny little manipulator used in the construction of certain devices."
icon_state = "pico_mani"
origin_tech = list(TECH_MATERIAL = 5, TECH_DATA = 2)
rating = 3
matter = list(DEFAULT_WALL_MATERIAL = 30)
/obj/item/weapon/stock_parts/micro_laser/ultra
name = "ultra-high-power micro-laser"
icon_state = "ultra_high_micro_laser"
desc = "A tiny laser used in certain devices."
origin_tech = list(TECH_MAGNET = 5)
rating = 3
matter = list(DEFAULT_WALL_MATERIAL = 10,"glass" = 20)
/obj/item/weapon/stock_parts/matter_bin/super
name = "super matter bin"
desc = "A container for hold compressed matter awaiting re-construction."
icon_state = "super_matter_bin"
origin_tech = list(TECH_MATERIAL = 5)
rating = 3
matter = list(DEFAULT_WALL_MATERIAL = 80)
//TCOMS stock parts
/obj/item/weapon/stock_parts/subspace/ansible
name = "subspace ansible"
icon_state = "subspace_ansible"
desc = "A compact module capable of sensing extradimensional activity."
origin_tech = list(TECH_DATA = 3, TECH_MAGNET = 5 ,TECH_MATERIAL = 4, TECH_BLUESPACE = 2)
matter = list(DEFAULT_WALL_MATERIAL = 30,"glass" = 10)
/obj/item/weapon/stock_parts/subspace/filter
name = "hyperwave filter"
icon_state = "hyperwave_filter"
desc = "A tiny device capable of filtering and converting super-intense radiowaves."
origin_tech = list(TECH_DATA = 4, TECH_MAGNET = 2)
matter = list(DEFAULT_WALL_MATERIAL = 30,"glass" = 10)
/obj/item/weapon/stock_parts/subspace/amplifier
name = "subspace amplifier"
icon_state = "subspace_amplifier"
desc = "A compact micro-machine capable of amplifying weak subspace transmissions."
origin_tech = list(TECH_DATA = 3, TECH_MAGNET = 4, TECH_MATERIAL = 4, TECH_BLUESPACE = 2)
matter = list(DEFAULT_WALL_MATERIAL = 30,"glass" = 10)
/obj/item/weapon/stock_parts/subspace/treatment
name = "subspace treatment disk"
icon_state = "treatment_disk"
desc = "A compact micro-machine capable of stretching out hyper-compressed radio waves."
origin_tech = list(TECH_DATA = 3, TECH_MAGNET = 2, TECH_MATERIAL = 5, TECH_BLUESPACE = 2)
matter = list(DEFAULT_WALL_MATERIAL = 30,"glass" = 10)
/obj/item/weapon/stock_parts/subspace/analyzer
name = "subspace wavelength analyzer"
icon_state = "wavelength_analyzer"
desc = "A sophisticated analyzer capable of analyzing cryptic subspace wavelengths."
origin_tech = list(TECH_DATA = 3, TECH_MAGNETS = 4, TECH_MATERIAL = 4, TECH_BLUESPACE = 2)
matter = list(DEFAULT_WALL_MATERIAL = 30,"glass" = 10)
/obj/item/weapon/stock_parts/subspace/crystal
name = "ansible crystal"
icon_state = "ansible_crystal"
desc = "A crystal made from pure glass used to transmit laser databursts to subspace."
origin_tech = list(TECH_MAGNET = 4, TECH_MATERIAL = 4, TECH_BLUESPACE = 2)
matter = list("glass" = 50)
/obj/item/weapon/stock_parts/subspace/transmitter
name = "subspace transmitter"
icon_state = "subspace_transmitter"
desc = "A large piece of equipment used to open a window into the subspace dimension."
origin_tech = list(TECH_MAGNET = 5, TECH_MATERIAL = 5, TECH_BLUESPACE = 3)
matter = list(DEFAULT_WALL_MATERIAL = 50)