Skip to content

Commit

Permalink
Add Frequency and ID settings to the RPD (vgstation-coders#35142)
Browse files Browse the repository at this point in the history
* Add frequency setting to the RPD

* Add ID setting to the RPD

* removes buildFrom copy-paste in each pipe
  • Loading branch information
joaomarcosh authored Oct 16, 2023
1 parent 741ade4 commit 7bc242d
Show file tree
Hide file tree
Showing 21 changed files with 130 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions code/ATMOSPHERICS/components/binary_devices/heat_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

var/open = FALSE

var/frequency = 0
frequency = 0

var/datum/radio_frequency/radio_connection
machine_flags = MULTITOOL_MENU
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/valve.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -111,8 +111,6 @@ Thus, the two variables affect pump operation are set in New():
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
onclose(user, "atmo_pump")



/obj/machinery/atmospherics/binary/volume_pump/initialize()
..()

Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/trinary_devices/filter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -341,7 +341,7 @@
</ul>
"}

/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)
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/trinary_devices/t_valve.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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


Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/unary/outlet_injector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion code/ATMOSPHERICS/components/unary/unary_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
..()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions code/ATMOSPHERICS/components/unary/vent_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -211,7 +211,6 @@

return 1


/obj/machinery/atmospherics/unary/vent_pump/initialize()
..()

Expand Down
7 changes: 3 additions & 4 deletions code/ATMOSPHERICS/components/unary/vent_scrubber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

level = 1

var/frequency = 1439
frequency = 1439
var/datum/radio_frequency/radio_connection

var/on = 0
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 7bc242d

Please sign in to comment.