From 7bc242de9c8573a237e7209470e03412b361713d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos?= <34819564+joaomarcosh@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:52:24 -0400 Subject: [PATCH] Add Frequency and ID settings to the RPD (#35142) * Add frequency setting to the RPD * Add ID setting to the RPD * removes buildFrom copy-paste in each pipe --- .../binary_devices/binary_atmos_base.dm | 8 ++++ .../components/binary_devices/dp_vent_pump.dm | 4 +- .../components/binary_devices/heat_pump.dm | 5 +- .../components/binary_devices/passive_gate.dm | 4 +- .../components/binary_devices/pump.dm | 4 +- .../components/binary_devices/valve.dm | 4 +- .../components/binary_devices/volume_pump.dm | 6 +-- .../components/trinary_devices/filter.dm | 4 +- .../trinary_devices/pressure_valve.dm | 4 +- .../components/trinary_devices/t_valve.dm | 4 +- .../trinary_devices/trinary_base.dm | 8 ++++ .../components/unary/outlet_injector.dm | 4 +- .../components/unary/unary_base.dm | 8 +++- .../components/unary/vent_pump.dm | 7 ++- .../components/unary/vent_scrubber.dm | 7 ++- code/ATMOSPHERICS/pipe/construction.dm | 30 ++++++++++-- code/game/machinery/atmo_control.dm | 4 +- code/game/machinery/atmoalter/meter.dm | 4 +- code/modules/RCD/RCD.dm | 3 ++ code/modules/RCD/RPD.dm | 8 ++-- code/modules/RCD/schematics/pipe.dm | 46 ++++++++++++++++--- 21 files changed, 130 insertions(+), 46 deletions(-) diff --git a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm index d452f2b5bafe..93d193e7f9a3 100644 --- a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm +++ b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm @@ -3,6 +3,8 @@ initialize_directions = SOUTH|NORTH use_power = MACHINE_POWER_USE_IDLE + var/frequency = -1 + var/datum/gas_mixture/air1 var/datum/gas_mixture/air2 @@ -92,6 +94,8 @@ if(!toggle_status(user)) // Subtypes returning FALSE do not allow alt-clicking to toggle power ..() +/obj/machinery/atmospherics/binary/proc/set_frequency(new_frequency) + /obj/machinery/atmospherics/binary/buildFrom(var/mob/usr,var/obj/item/pipe/pipe) dir = pipe.dir initialize_directions = pipe.get_pipe_dir() @@ -108,6 +112,10 @@ if (node2) node2.initialize() node2.build_network() + if(pipe.frequency) + set_frequency(pipe.frequency) + if(pipe.id_tag) + id_tag = pipe.id_tag return 1 //this is used when a machine_flags = WRENCHMOVE machine gets anchored down diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index 46a5b878a26e..c14b375e8435 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -21,7 +21,7 @@ //2: Do not pass input_pressure_min //4: Do not pass output_pressure_max - var/frequency = 0 + frequency = 0 var/datum/radio_frequency/radio_connection @@ -122,7 +122,7 @@ //Radio remote control -/obj/machinery/atmospherics/binary/dp_vent_pump/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/binary/dp_vent_pump/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) diff --git a/code/ATMOSPHERICS/components/binary_devices/heat_pump.dm b/code/ATMOSPHERICS/components/binary_devices/heat_pump.dm index ed67e3c5190f..1b036fa4ac56 100644 --- a/code/ATMOSPHERICS/components/binary_devices/heat_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/heat_pump.dm @@ -36,7 +36,7 @@ It also must be positive. Technically it can be 0 without breaking physics, but ghost_read = FALSE - var/frequency = 0 + frequency = 0 var/datum/radio_frequency/radio_connection machine_flags = MULTITOOL_MENU @@ -99,14 +99,13 @@ It also must be positive. Technically it can be 0 without breaking physics, but icon_state = "intact_on" ..() - /obj/machinery/atmospherics/binary/heat_pump/initialize() ..() if(frequency) set_frequency(frequency) -/obj/machinery/atmospherics/binary/heat_pump/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/binary/heat_pump/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index 7844f774a68d..89e36cfe8df5 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -9,7 +9,7 @@ var/open = FALSE - var/frequency = 0 + frequency = 0 var/datum/radio_frequency/radio_connection machine_flags = MULTITOOL_MENU @@ -66,7 +66,7 @@ //Radio remote control -/obj/machinery/atmospherics/binary/passive_gate/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/binary/passive_gate/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index 563833903708..17af757057ac 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -23,7 +23,7 @@ air2.volume desc = "A pump." var/target_pressure = ONE_ATMOSPHERE - var/frequency = 0 + frequency = 0 var/datum/radio_frequency/radio_connection @@ -76,7 +76,7 @@ air2.volume //Radio remote control -/obj/machinery/atmospherics/binary/pump/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/binary/pump/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) diff --git a/code/ATMOSPHERICS/components/binary_devices/valve.dm b/code/ATMOSPHERICS/components/binary_devices/valve.dm index b963640a4d1e..da923e897e50 100644 --- a/code/ATMOSPHERICS/components/binary_devices/valve.dm +++ b/code/ATMOSPHERICS/components/binary_devices/valve.dm @@ -111,7 +111,7 @@ name = "digital valve" desc = "A digitally controlled valve." icon = 'icons/obj/atmospherics/digital_valve.dmi' - var/frequency = 0 + frequency = 0 var/datum/radio_frequency/radio_connection @@ -123,7 +123,7 @@ //Radio remote control -/obj/machinery/atmospherics/binary/valve/digital/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/binary/valve/digital/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm index 4fc1d55f4d2d..8685523290e5 100644 --- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm @@ -23,7 +23,7 @@ Thus, the two variables affect pump operation are set in New(): var/transfer_rate = MAX_TRANSFER_RATE - var/frequency = 0 + frequency = 0 var/pump_stalled = 0 var/datum/radio_frequency/radio_connection @@ -77,7 +77,7 @@ Thus, the two variables affect pump operation are set in New(): return 1 -/obj/machinery/atmospherics/binary/volume_pump/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/binary/volume_pump/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) @@ -111,8 +111,6 @@ Thus, the two variables affect pump operation are set in New(): user << browse("[src.name] control[dat]", "window=atmo_pump") onclose(user, "atmo_pump") - - /obj/machinery/atmospherics/binary/volume_pump/initialize() ..() diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm index 6a17b60bf028..e1103151491d 100755 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -21,12 +21,12 @@ Filter types: 4: Sleeping Agent (N2O) */ - var/frequency = 0 + frequency = 0 var/datum/radio_frequency/radio_connection ex_node_offset = 5 -/obj/machinery/atmospherics/trinary/filter/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/trinary/filter/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) diff --git a/code/ATMOSPHERICS/components/trinary_devices/pressure_valve.dm b/code/ATMOSPHERICS/components/trinary_devices/pressure_valve.dm index acb1cdb3c74c..8f2906bf32c2 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/pressure_valve.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/pressure_valve.dm @@ -328,7 +328,7 @@ name = "digital conditional valve" desc = "A digitally controlled automatic valve." - var/frequency = 0 + frequency = 0 var/datum/radio_frequency/radio_connection machine_flags = MULTITOOL_MENU @@ -341,7 +341,7 @@ "} -/obj/machinery/atmospherics/trinary/pressure_valve/digital/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/trinary/pressure_valve/digital/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) diff --git a/code/ATMOSPHERICS/components/trinary_devices/t_valve.dm b/code/ATMOSPHERICS/components/trinary_devices/t_valve.dm index edfbd531b1f6..6e1a2e569cab 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/t_valve.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/t_valve.dm @@ -180,7 +180,7 @@ desc = "A digitally controlled valve." icon = 'icons/obj/atmospherics/digital_valve.dmi' - var/frequency = 0 + frequency = 0 var/datum/radio_frequency/radio_connection @@ -227,7 +227,7 @@ //Radio remote control -/obj/machinery/atmospherics/trinary/tvalve/digital/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/trinary/tvalve/digital/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) diff --git a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm index a98076c3c491..affc0d0e1944 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm @@ -3,6 +3,8 @@ initialize_directions = SOUTH|NORTH|WEST use_power = MACHINE_POWER_USE_IDLE can_be_coloured = 0 + + var/frequency = -1 var/datum/gas_mixture/air1 var/datum/gas_mixture/air2 @@ -51,6 +53,8 @@ if(WEST) initialize_directions = EAST|WEST|NORTH ..() + +/obj/machinery/atmospherics/trinary/proc/set_frequency(new_frequency) /obj/machinery/atmospherics/trinary/buildFrom(var/mob/usr,var/obj/item/pipe/pipe) if(!(pipe.dir in list(NORTH, SOUTH, EAST, WEST)) && src.mirror) //because the dir isn't in the right set, we want to make the mirror kind @@ -77,6 +81,10 @@ if (node3) node3.initialize() node3.build_network() + if(pipe.frequency) + set_frequency(pipe.frequency) + if(pipe.id_tag) + id_tag = pipe.id_tag return 1 diff --git a/code/ATMOSPHERICS/components/unary/outlet_injector.dm b/code/ATMOSPHERICS/components/unary/outlet_injector.dm index 6cdddb803e6f..958033a6bc0d 100644 --- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm @@ -12,7 +12,7 @@ var/volume_rate = CELL_VOLUME //1 tile worth of air by default var/max_rate= 4*CELL_VOLUME // 10000L - var/frequency = 0 + frequency = 0 var/datum/radio_frequency/radio_connection level = 1 @@ -82,7 +82,7 @@ flick("inject", src) -/obj/machinery/atmospherics/unary/outlet_injector/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/unary/outlet_injector/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) diff --git a/code/ATMOSPHERICS/components/unary/unary_base.dm b/code/ATMOSPHERICS/components/unary/unary_base.dm index 0aa450f96edd..29a8103fab90 100644 --- a/code/ATMOSPHERICS/components/unary/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary/unary_base.dm @@ -6,6 +6,7 @@ var/datum/gas_mixture/air_contents var/obj/machinery/atmospherics/node1 var/datum/pipe_network/network + var/frequency = -1 /obj/machinery/atmospherics/unary/New() ..() @@ -43,7 +44,8 @@ /obj/machinery/atmospherics/unary/update_icon(var/adjacent_procd,node_list) node_list = list(node1) ..(adjacent_procd,node_list) - + +/obj/machinery/atmospherics/unary/proc/set_frequency(new_frequency) /obj/machinery/atmospherics/unary/buildFrom(var/mob/usr,var/obj/item/pipe/pipe) dir = pipe.dir @@ -58,6 +60,10 @@ if (node1) node1.initialize() node1.build_network() + if(pipe.frequency) + set_frequency(pipe.frequency) + if(pipe.id_tag) + id_tag = pipe.id_tag return 1 //this is used when a machine_flags = WRENCHMOVE machine gets anchored down diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index 7cef9e69bc12..cf3724eb669d 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -24,7 +24,7 @@ var/welded = 0 // Added for aliens -- TLE var/canSpawnMice = 1 // Set to 0 to prevent spawning of mice. - var/frequency = 1439 + frequency = 1439 var/datum/radio_frequency/radio_connection var/radio_filter_out @@ -159,7 +159,7 @@ return pressure_delta -/obj/machinery/atmospherics/unary/vent_pump/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/unary/vent_pump/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency if(frequency) @@ -172,7 +172,7 @@ name = "Vent Pump" else broadcast_status() - + /obj/machinery/atmospherics/unary/vent_pump/buildFrom(var/mob/usr,var/obj/item/pipe/pipe) ..() src.broadcast_status() @@ -211,7 +211,6 @@ return 1 - /obj/machinery/atmospherics/unary/vent_pump/initialize() ..() diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index 2da0722559ba..6c5e126fa52f 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -9,7 +9,7 @@ level = 1 - var/frequency = 1439 + frequency = 1439 var/datum/radio_frequency/radio_connection var/on = 0 @@ -96,7 +96,7 @@ ..() -/obj/machinery/atmospherics/unary/vent_scrubber/proc/set_frequency(new_frequency) +/obj/machinery/atmospherics/unary/vent_scrubber/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency radio_connection = radio_controller.add_object(src, frequency, radio_filter_in) @@ -108,7 +108,7 @@ name = "Air Scrubber" else broadcast_status() - + /obj/machinery/atmospherics/unary/vent_scrubber/buildFrom(var/mob/usr,var/obj/item/pipe/pipe) ..() src.broadcast_status() @@ -168,7 +168,6 @@ else //stalled and too much pressure, do nothing return - /obj/machinery/atmospherics/unary/vent_scrubber/initialize() ..() radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null diff --git a/code/ATMOSPHERICS/pipe/construction.dm b/code/ATMOSPHERICS/pipe/construction.dm index 2d422342e40c..86c2a7d5398a 100644 --- a/code/ATMOSPHERICS/pipe/construction.dm +++ b/code/ATMOSPHERICS/pipe/construction.dm @@ -74,6 +74,8 @@ var/global/list/heat_pipes = list(PIPE_HE_STRAIGHT, PIPE_HE_BENT, PIPE_JUNCTION, flags = FPRINT w_class = W_CLASS_MEDIUM level = 2 + var/frequency = 0 + var/id_tag = null var/piping_layer = PIPING_LAYER_DEFAULT @@ -100,8 +102,12 @@ var/global/list/heat_pipes = list(PIPE_HE_STRAIGHT, PIPE_HE_BENT, PIPE_JUNCTION, qdel(src) return 2 var/list/bent_dirs = list(NORTH|SOUTH, WEST|EAST) -/obj/item/pipe/New(var/loc, var/pipe_type as num, var/dir as num, var/obj/machinery/atmospherics/make_from = null) +/obj/item/pipe/New(var/loc, var/pipe_type as num, var/dir as num, var/obj/machinery/atmospherics/make_from = null, freq, id) ..() + if (freq) + frequency = freq + if (id) + id_tag = id if (make_from) src.dir = make_from.dir src.pipename = make_from.name @@ -581,8 +587,17 @@ var/list/manifold_pipes = list(PIPE_MANIFOLD4W, PIPE_INSUL_MANIFOLD4W, PIPE_HE_M item_state = "buildpipe" flags = FPRINT w_class = W_CLASS_LARGE + var/frequency = 1439 + var/id_tag = null var/layer_to_make = PIPING_LAYER_DEFAULT + +/obj/item/pipe_meter/New(loc, freq, id) + ..() + if(freq) + frequency = freq + if(id) + id_tag = id /obj/item/pipe_meter/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) ..() @@ -597,7 +612,7 @@ var/list/manifold_pipes = list(PIPE_MANIFOLD4W, PIPE_INSUL_MANIFOLD4W, PIPE_HE_M if(!pipe) to_chat(user, "You need to fasten it to a pipe.") return 1 - new/obj/machinery/meter(src.loc, pipe) + new/obj/machinery/meter(src.loc, pipe, frequency, id_tag) W.playtoolsound(src, 50) to_chat(user, "You have fastened the meter to the pipe.") qdel(src) @@ -620,12 +635,21 @@ var/list/manifold_pipes = list(PIPE_MANIFOLD4W, PIPE_INSUL_MANIFOLD4W, PIPE_HE_M item_state = "buildpipe" flags = FPRINT w_class = W_CLASS_LARGE + var/frequency = 1439 + var/id_tag = null + +/obj/item/pipe_gsensor/New(loc, freq, id) + ..() + if(freq) + frequency = freq + if(id) + id_tag = id /obj/item/pipe_gsensor/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) ..() if(!W.is_wrench(user)) return ..() - new/obj/machinery/air_sensor( src.loc ) + new/obj/machinery/air_sensor( src.loc, frequency, id_tag ) W.playtoolsound(src, 50) to_chat(user, "You have fastened the gas sensor.") qdel(src) diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm index d45aa25ceafb..b13a80295721 100644 --- a/code/game/machinery/atmo_control.dm +++ b/code/game/machinery/atmo_control.dm @@ -108,9 +108,11 @@ return set_frequency(frequency) -/obj/machinery/air_sensor/New() +/obj/machinery/air_sensor/New(loc, freq = 1439, id = null) ..() + frequency = freq + id_tag = id if(ticker && ticker.current_state == GAME_STATE_PLAYING) initialize() diff --git a/code/game/machinery/atmoalter/meter.dm b/code/game/machinery/atmoalter/meter.dm index 492fd13f6d87..8d33763e75e4 100644 --- a/code/game/machinery/atmoalter/meter.dm +++ b/code/game/machinery/atmoalter/meter.dm @@ -14,11 +14,13 @@ active_power_usage = 4 machine_flags = MULTITOOL_MENU -/obj/machinery/meter/New(newloc, new_target) +/obj/machinery/meter/New(newloc, new_target, freq = 1439, id = null) ..(newloc) src.target = new_target if(target) setAttachLayer(target.piping_layer) + frequency = freq + id_tag = id return 1 /obj/machinery/meter/initialize() diff --git a/code/modules/RCD/RCD.dm b/code/modules/RCD/RCD.dm index 088d423bcc5e..b7d55bebee10 100644 --- a/code/modules/RCD/RCD.dm +++ b/code/modules/RCD/RCD.dm @@ -17,6 +17,9 @@ w_type = RECYK_ELECTRONIC melt_temperature = MELTPOINT_STEEL // Lots of metal origin_tech = Tc_ENGINEERING + "=4;" + Tc_MATERIALS + "=2" + + var/frequency = 0 + var/id = null //list of schematics, in definitions of RCD subtypes, no organization is needed, in New() these get organized. var/list/schematics = list(/datum/rcd_schematic/test) diff --git a/code/modules/RCD/RPD.dm b/code/modules/RCD/RPD.dm index 36f7082c54b8..0934bfafe15c 100644 --- a/code/modules/RCD/RPD.dm +++ b/code/modules/RCD/RPD.dm @@ -2,6 +2,8 @@ name = "\improper Rapid-Piping-Device (RPD)" desc = "A device used to rapidly pipe things." icon_state = "rpd" + frequency = 1439 + id = null var/has_metal_slime = 0 var/has_yellow_slime = 0 starting_materials = list(MAT_IRON = 75000, MAT_GLASS = 37500) @@ -195,9 +197,9 @@ our_schematic.set_layer(layer) if(layer != 5 ) spawn(-1) - our_schematic.attack(A, user) + our_schematic.attack(A, user, frequency, id) else - var/t = our_schematic.attack(A, user) + var/t = our_schematic.attack(A, user, frequency, id) if(!t) // No errors if(~our_schematic.flags & RCD_SELF_COST) // Handle energy costs unless the schematic does it itself. use_energy(our_schematic.energy_cost, user) @@ -211,7 +213,7 @@ return 1 busy = TRUE // Busy to prevent switching schematic while it's in use. - var/t = selected.attack(A, user) + var/t = selected.attack(A, user, frequency, id) if(!t) // No errors if(~selected.flags & RCD_SELF_COST) // Handle energy costs unless the schematic does it itself. use_energy(selected.energy_cost, user) diff --git a/code/modules/RCD/schematics/pipe.dm b/code/modules/RCD/schematics/pipe.dm index da89edac5a78..9ce32f8462e0 100644 --- a/code/modules/RCD/schematics/pipe.dm +++ b/code/modules/RCD/schematics/pipe.dm @@ -169,7 +169,7 @@ category = "Devices" flags = RCD_RANGE | RCD_GET_TURF | RCD_ALLOW_SWITCH -/datum/rcd_schematic/gsensor/attack(var/atom/A, var/mob/user) +/datum/rcd_schematic/gsensor/attack(var/atom/A, var/mob/user, frequency, id) if(!isturf(A)) return @@ -179,14 +179,14 @@ return 1 playsound(master, 'sound/items/Deconstruct.ogg', 50, 1) - new /obj/item/pipe_gsensor(A) + new /obj/item/pipe_gsensor(A, frequency, id) /datum/rcd_schematic/pmeter name = "Pipe meter" category = "Devices" flags = RCD_RANGE | RCD_GET_TURF | RCD_ALLOW_SWITCH -/datum/rcd_schematic/pmeter/attack(var/atom/A, var/mob/user) +/datum/rcd_schematic/pmeter/attack(var/atom/A, var/mob/user, frequency, id) if(!isturf(A)) return @@ -196,7 +196,7 @@ return 1 playsound(master, 'sound/items/Deconstruct.ogg', 50, 1) - new /obj/item/pipe_meter(A) + new /obj/item/pipe_meter(A, frequency, id) //ACTUAL PIPES. @@ -344,6 +344,13 @@
"} + + . += {" +
+ Frequency: [format_frequency(master.frequency)] GHz Reset + ID: [master.id ? master.id : "-----"] Reset +
+ "} /datum/rcd_schematic/pipe/proc/render_dir_image(var/dir, var/title) var/selected = "" @@ -370,6 +377,33 @@ set_layer(n_layer) return 1 + + if("set_freq" in href_list) + var/newfreq=master.frequency + if(href_list["set_freq"]!="-1") + newfreq=text2num(href_list["set_freq"]) + else + newfreq = input(usr, "Specify a new frequency (GHz). Decimals assigned automatically.", src, master.frequency) as null|num + if(newfreq) + if(findtext(num2text(newfreq), ".")) + newfreq *= 10 // shift the decimal one place + if(newfreq < 10000) + master.frequency = newfreq + master.rebuild_ui() + + return 1 + + if("set_id" in href_list) + var/newid=master.id + if(href_list["set_id"]!="-1") + master.id = null + else + newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag for this machine", src, master.id) as null|text),1,MAX_MESSAGE_LEN) + if(newid) + master.id = newid + master.rebuild_ui() + + return 1 /datum/rcd_schematic/pipe/proc/set_dir(var/new_dir) selected_dir = new_dir @@ -407,7 +441,7 @@ set_dir(dirs[index]) -/datum/rcd_schematic/pipe/attack(var/atom/A, var/mob/user) +/datum/rcd_schematic/pipe/attack(var/atom/A, var/mob/user, frequency, id) to_chat(user, "Building Pipes ...") playsound(user, 'sound/machines/click.ogg', 50, 1) var/thislayer = layer @@ -417,7 +451,7 @@ playsound(user, 'sound/items/Deconstruct.ogg', 50, 1) - var/obj/item/pipe/P = new /obj/item/pipe(A, pipe_id, thisdir) + var/obj/item/pipe/P = new /obj/item/pipe(A, pipe_id, thisdir, null, frequency, id) P.setPipingLayer(thislayer) P.update() P.add_fingerprint(user)