Files
CHOMPStation2/code/game/machinery/constructable_frame.dm
Mloc-Argent 117ca6a135 refactor 'dir = ' into 'set_dir()'
This should have little/no gameplay effect right now, just paving the
 way for directional lights.
Replaced handle_rotation() on buckly things with this.

Signed-off-by: Mloc-Argent <colmohici@gmail.com>
2014-12-01 13:44:02 +00:00

414 lines
17 KiB
Plaintext

//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
/obj/machinery/constructable_frame //Made into a seperate type to make future revisions easier.
name = "machine frame"
icon = 'icons/obj/stock_parts.dmi'
icon_state = "box_0"
density = 1
anchored = 1
use_power = 0
var/obj/item/weapon/circuitboard/circuit = null
var/list/components = null
var/list/req_components = null
var/list/req_component_names = null
var/state = 1
proc/update_desc()
var/D
if(req_components)
D = "Requires "
var/first = 1
for(var/I in req_components)
if(req_components[I] > 0)
D += "[first?"":", "][num2text(req_components[I])] [req_component_names[I]]"
first = 0
if(first) // nothing needs to be added, then
D += "nothing"
D += "."
desc = D
/obj/machinery/constructable_frame/machine_frame
attackby(obj/item/P as obj, mob/user as mob)
if(P.crit_fail)
user << "\red This part is faulty, you cannot add this to the machine!"
return
switch(state)
if(1)
if(istype(P, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = P
if (C.get_amount() < 5)
user << "<span class='warning'>You need five lengths of cable to add them to the frame.</span>"
return
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
user << "<span class='notice'>You start to add cables to the frame.</span>"
if(do_after(user, 20) && state == 1)
if(C.use(5))
user << "<span class='notice'>You add cables to the frame.</span>"
state = 2
icon_state = "box_1"
else
if(istype(P, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
user << "\blue You dismantle the frame"
new /obj/item/stack/sheet/metal(src.loc, 5)
del(src)
if(2)
if(istype(P, /obj/item/weapon/circuitboard))
var/obj/item/weapon/circuitboard/B = P
if(B.board_type == "machine")
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
user << "\blue You add the circuit board to the frame."
circuit = P
user.drop_item()
P.loc = src
icon_state = "box_2"
state = 3
components = list()
req_components = circuit.req_components.Copy()
for(var/A in circuit.req_components)
req_components[A] = circuit.req_components[A]
req_component_names = circuit.req_components.Copy()
for(var/A in req_components)
var/cp = text2path(A)
var/obj/ct = new cp() // have to quickly instantiate it get name
req_component_names[A] = ct.name
if(circuit.frame_desc)
desc = circuit.frame_desc
else
update_desc()
user << desc
else
user << "\red This frame does not accept circuit boards of this type!"
else
if(istype(P, /obj/item/weapon/wirecutters))
playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1)
user << "\blue You remove the cables."
state = 1
icon_state = "box_0"
var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( src.loc )
A.amount = 5
if(3)
if(istype(P, /obj/item/weapon/crowbar))
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
state = 2
circuit.loc = src.loc
circuit = null
if(components.len == 0)
user << "\blue You remove the circuit board."
else
user << "\blue You remove the circuit board and other components."
for(var/obj/item/weapon/W in components)
W.loc = src.loc
desc = initial(desc)
req_components = null
components = null
icon_state = "box_1"
else
if(istype(P, /obj/item/weapon/screwdriver))
var/component_check = 1
for(var/R in req_components)
if(req_components[R] > 0)
component_check = 0
break
if(component_check)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
var/obj/machinery/new_machine = new src.circuit.build_path(src.loc)
new_machine.component_parts.Cut()
src.circuit.construct(new_machine)
for(var/obj/O in src)
if(circuit.contain_parts) // things like disposal don't want their parts in them
O.loc = new_machine
else
O.loc = null
new_machine.component_parts += O
if(circuit.contain_parts)
circuit.loc = new_machine
else
circuit.loc = null
new_machine.RefreshParts()
del(src)
else
if(istype(P, /obj/item))
for(var/I in req_components)
if(istype(P, text2path(I)) && (req_components[I] > 0))
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(istype(P, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/CP = P
if(CP.get_amount() > 1)
var/camt = min(CP.amount, req_components[I]) // amount of cable to take, idealy amount required, but limited by amount provided
var/obj/item/stack/cable_coil/CC = new /obj/item/stack/cable_coil(src)
CC.amount = camt
CC.update_icon()
CP.use(camt)
components += CC
req_components[I] -= camt
update_desc()
break
user.drop_item()
P.loc = src
components += P
req_components[I]--
update_desc()
break
user << desc
if(P && P.loc != src && !istype(P, /obj/item/stack/cable_coil))
user << "\red You cannot add that component to the machine!"
//Machine Frame Circuit Boards
/*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.
Note: Once everything is added to the public areas, will add materials to circuit boards since autolathe won't be able
to destroy them and players will be able to make replacements.
*/
/obj/item/weapon/circuitboard/destructive_analyzer
name = "Circuit board (Destructive Analyzer)"
build_path = "/obj/machinery/r_n_d/destructive_analyzer"
board_type = "machine"
origin_tech = "magnets=2;engineering=2;programming=2"
frame_desc = "Requires 1 Scanning Module, 1 Micro Manipulator, and 1 Micro-Laser."
req_components = list(
"/obj/item/weapon/stock_parts/scanning_module" = 1,
"/obj/item/weapon/stock_parts/manipulator" = 1,
"/obj/item/weapon/stock_parts/micro_laser" = 1)
/obj/item/weapon/circuitboard/autolathe
name = "Circuit board (Autolathe)"
build_path = "/obj/machinery/autolathe"
board_type = "machine"
origin_tech = "engineering=2;programming=2"
frame_desc = "Requires 3 Matter Bins, 1 Micro Manipulator, and 1 Console Screen."
req_components = list(
"/obj/item/weapon/stock_parts/matter_bin" = 3,
"/obj/item/weapon/stock_parts/manipulator" = 1,
"/obj/item/weapon/stock_parts/console_screen" = 1)
/obj/item/weapon/circuitboard/protolathe
name = "Circuit board (Protolathe)"
build_path = "/obj/machinery/r_n_d/protolathe"
board_type = "machine"
origin_tech = "engineering=2;programming=2"
frame_desc = "Requires 2 Matter Bins, 2 Micro Manipulators, and 2 Beakers."
req_components = list(
"/obj/item/weapon/stock_parts/matter_bin" = 2,
"/obj/item/weapon/stock_parts/manipulator" = 2,
"/obj/item/weapon/reagent_containers/glass/beaker" = 2)
/obj/item/weapon/circuitboard/circuit_imprinter
name = "Circuit board (Circuit Imprinter)"
build_path = "/obj/machinery/r_n_d/circuit_imprinter"
board_type = "machine"
origin_tech = "engineering=2;programming=2"
frame_desc = "Requires 1 Matter Bin, 1 Micro Manipulator, and 2 Beakers."
req_components = list(
"/obj/item/weapon/stock_parts/matter_bin" = 1,
"/obj/item/weapon/stock_parts/manipulator" = 1,
"/obj/item/weapon/reagent_containers/glass/beaker" = 2)
/obj/item/weapon/circuitboard/pacman
name = "Circuit Board (PACMAN-type Generator)"
build_path = "/obj/machinery/power/port_gen/pacman"
board_type = "machine"
origin_tech = "programming=3;powerstorage=3;phorontech=3;engineering=3"
frame_desc = "Requires 1 Matter Bin, 1 Micro-Laser, 2 Pieces of Cable, and 1 Capacitor."
req_components = list(
"/obj/item/weapon/stock_parts/matter_bin" = 1,
"/obj/item/weapon/stock_parts/micro_laser" = 1,
"/obj/item/stack/cable_coil" = 2,
"/obj/item/weapon/stock_parts/capacitor" = 1)
/obj/item/weapon/circuitboard/pacman/super
name = "Circuit Board (SUPERPACMAN-type Generator)"
build_path = "/obj/machinery/power/port_gen/pacman/super"
origin_tech = "programming=3;powerstorage=4;engineering=4"
/obj/item/weapon/circuitboard/pacman/mrs
name = "Circuit Board (MRSPACMAN-type Generator)"
build_path = "/obj/machinery/power/port_gen/pacman/mrs"
origin_tech = "programming=3;powerstorage=5;engineering=5"
obj/item/weapon/circuitboard/rdserver
name = "Circuit Board (R&D Server)"
build_path = "/obj/machinery/r_n_d/server"
board_type = "machine"
origin_tech = "programming=3"
frame_desc = "Requires 2 pieces of cable, and 1 Scanning Module."
req_components = list(
"/obj/item/stack/cable_coil" = 2,
"/obj/item/weapon/stock_parts/scanning_module" = 1)
/obj/item/weapon/circuitboard/mechfab
name = "Circuit board (Exosuit Fabricator)"
build_path = "/obj/machinery/mecha_part_fabricator"
board_type = "machine"
origin_tech = "programming=3;engineering=3"
frame_desc = "Requires 2 Matter Bins, 1 Micro Manipulator, 1 Micro-Laser and 1 Console Screen."
req_components = list(
"/obj/item/weapon/stock_parts/matter_bin" = 2,
"/obj/item/weapon/stock_parts/manipulator" = 1,
"/obj/item/weapon/stock_parts/micro_laser" = 1,
"/obj/item/weapon/stock_parts/console_screen" = 1)
/obj/item/weapon/circuitboard/clonepod
name = "Circuit board (Clone Pod)"
build_path = "/obj/machinery/clonepod"
board_type = "machine"
origin_tech = "programming=3;biotech=3"
frame_desc = "Requires 2 Manipulator, 2 Scanning Module, 2 pieces of cable and 1 Console Screen."
req_components = list(
"/obj/item/stack/cable_coil" = 2,
"/obj/item/weapon/stock_parts/scanning_module" = 2,
"/obj/item/weapon/stock_parts/manipulator" = 2,
"/obj/item/weapon/stock_parts/console_screen" = 1)
/obj/item/weapon/circuitboard/clonescanner
name = "Circuit board (Cloning Scanner)"
build_path = "/obj/machinery/dna_scannernew"
board_type = "machine"
origin_tech = "programming=2;biotech=2"
frame_desc = "Requires 1 Scanning module, 1 Micro Manipulator, 1 Micro-Laser, 2 pieces of cable and 1 Console Screen."
req_components = list(
"/obj/item/weapon/stock_parts/scanning_module" = 1,
"/obj/item/weapon/stock_parts/manipulator" = 1,
"/obj/item/weapon/stock_parts/micro_laser" = 1,
"/obj/item/weapon/stock_parts/console_screen" = 1,
"/obj/item/stack/cable_coil" = 2,)
/obj/item/weapon/circuitboard/unary_atmos
board_type = "machine"
var/machine_dir = SOUTH
var/init_dirs = SOUTH
/obj/item/weapon/circuitboard/unary_atmos/attackby(obj/item/I as obj, mob/user as mob)
if(istype(I,/obj/item/weapon/screwdriver))
machine_dir = turn(machine_dir, 90)
init_dirs = machine_dir
user.visible_message("\blue \The [user] adjusts the jumper on the [src]'s port configuration pins.", "\blue You adjust the jumper on the port configuration pins. Now set to [dir2text(machine_dir)].")
return
/obj/item/weapon/circuitboard/unary_atmos/examine(mob/user)
..(user)
user << "The jumper is connecting the [dir2text(machine_dir)] pins."
/obj/item/weapon/circuitboard/unary_atmos/construct(var/obj/machinery/atmospherics/unary/U)
//TODO: Move this stuff into the relevant constructor when pipe/construction.dm is cleaned up.
U.set_dir(src.machine_dir)
U.initialize_directions = src.init_dirs
U.initialize()
U.build_network()
if (U.node)
U.node.initialize()
U.node.build_network()
/obj/item/weapon/circuitboard/unary_atmos/heater
name = "Circuit Board (Gas Heating System)"
build_path = "/obj/machinery/atmospherics/unary/heater"
origin_tech = "powerstorage=2;engineering=1"
frame_desc = "Requires 5 Pieces of Cable, 1 Matter Bin, and 2 Capacitors."
req_components = list(
"/obj/item/stack/cable_coil" = 5,
"/obj/item/weapon/stock_parts/matter_bin" = 1,
"/obj/item/weapon/stock_parts/capacitor" = 2)
/obj/item/weapon/circuitboard/unary_atmos/cooler
name = "Circuit Board (Gas Cooling System)"
build_path = "/obj/machinery/atmospherics/unary/freezer"
origin_tech = "magnets=2;engineering=2"
frame_desc = "Requires 2 Pieces of Cable, 1 Matter Bin, 1 Micro Manipulator, and 2 Capacitors."
req_components = list(
"/obj/item/stack/cable_coil" = 2,
"/obj/item/weapon/stock_parts/matter_bin" = 1,
"/obj/item/weapon/stock_parts/capacitor" = 2,
"/obj/item/weapon/stock_parts/manipulator" = 1)
// Telecomms circuit boards:
/obj/item/weapon/circuitboard/telecomms/receiver
name = "Circuit Board (Subspace Receiver)"
build_path = "/obj/machinery/telecomms/receiver"
board_type = "machine"
origin_tech = "programming=4;engineering=3;bluespace=2"
frame_desc = "Requires 1 Subspace Ansible, 1 Hyperwave Filter, 2 Micro Manipulators, and 1 Micro-Laser."
req_components = list(
"/obj/item/weapon/stock_parts/subspace/ansible" = 1,
"/obj/item/weapon/stock_parts/subspace/filter" = 1,
"/obj/item/weapon/stock_parts/manipulator" = 2,
"/obj/item/weapon/stock_parts/micro_laser" = 1)
/obj/item/weapon/circuitboard/telecomms/hub
name = "Circuit Board (Hub Mainframe)"
build_path = "/obj/machinery/telecomms/hub"
board_type = "machine"
origin_tech = "programming=4;engineering=4"
frame_desc = "Requires 2 Micro Manipulators, 2 Cable Coil and 2 Hyperwave Filter."
req_components = list(
"/obj/item/weapon/stock_parts/manipulator" = 2,
"/obj/item/stack/cable_coil" = 2,
"/obj/item/weapon/stock_parts/subspace/filter" = 2)
/obj/item/weapon/circuitboard/telecomms/relay
name = "Circuit Board (Relay Mainframe)"
build_path = "/obj/machinery/telecomms/relay"
board_type = "machine"
origin_tech = "programming=3;engineering=4;bluespace=3"
frame_desc = "Requires 2 Micro Manipulators, 2 Cable Coil and 2 Hyperwave Filters."
req_components = list(
"/obj/item/weapon/stock_parts/manipulator" = 2,
"/obj/item/stack/cable_coil" = 2,
"/obj/item/weapon/stock_parts/subspace/filter" = 2)
/obj/item/weapon/circuitboard/telecomms/bus
name = "Circuit Board (Bus Mainframe)"
build_path = "/obj/machinery/telecomms/bus"
board_type = "machine"
origin_tech = "programming=4;engineering=4"
frame_desc = "Requires 2 Micro Manipulators, 1 Cable Coil and 1 Hyperwave Filter."
req_components = list(
"/obj/item/weapon/stock_parts/manipulator" = 2,
"/obj/item/stack/cable_coil" = 1,
"/obj/item/weapon/stock_parts/subspace/filter" = 1)
/obj/item/weapon/circuitboard/telecomms/processor
name = "Circuit Board (Processor Unit)"
build_path = "/obj/machinery/telecomms/processor"
board_type = "machine"
origin_tech = "programming=4;engineering=4"
frame_desc = "Requires 3 Micro Manipulators, 1 Hyperwave Filter, 2 Treatment Disks, 1 Wavelength Analyzer, 2 Cable Coils and 1 Subspace Amplifier."
req_components = list(
"/obj/item/weapon/stock_parts/manipulator" = 3,
"/obj/item/weapon/stock_parts/subspace/filter" = 1,
"/obj/item/weapon/stock_parts/subspace/treatment" = 2,
"/obj/item/weapon/stock_parts/subspace/analyzer" = 1,
"/obj/item/stack/cable_coil" = 2,
"/obj/item/weapon/stock_parts/subspace/amplifier" = 1)
/obj/item/weapon/circuitboard/telecomms/server
name = "Circuit Board (Telecommunication Server)"
build_path = "/obj/machinery/telecomms/server"
board_type = "machine"
origin_tech = "programming=4;engineering=4"
frame_desc = "Requires 2 Micro Manipulators, 1 Cable Coil and 1 Hyperwave Filter."
req_components = list(
"/obj/item/weapon/stock_parts/manipulator" = 2,
"/obj/item/stack/cable_coil" = 1,
"/obj/item/weapon/stock_parts/subspace/filter" = 1)
/obj/item/weapon/circuitboard/telecomms/broadcaster
name = "Circuit Board (Subspace Broadcaster)"
build_path = "/obj/machinery/telecomms/broadcaster"
board_type = "machine"
origin_tech = "programming=4;engineering=4;bluespace=2"
frame_desc = "Requires 2 Micro Manipulators, 1 Cable Coil, 1 Hyperwave Filter, 1 Ansible Crystal and 2 High-Powered Micro-Lasers. "
req_components = list(
"/obj/item/weapon/stock_parts/manipulator" = 2,
"/obj/item/stack/cable_coil" = 1,
"/obj/item/weapon/stock_parts/subspace/filter" = 1,
"/obj/item/weapon/stock_parts/subspace/crystal" = 1,
"/obj/item/weapon/stock_parts/micro_laser/high" = 2)