Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Init rework, SSatoms #749

Merged
merged 21 commits into from Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion code/ATMOSPHERICS/atmospherics.dm
Expand Up @@ -42,6 +42,15 @@ Pipelines + Other Objects -> Pipe network
pipe_color = null
..()

/obj/machinery/atmospherics/Initialize(mapload)
. = ..()
if (mapload) // If mapload, chain to atmos_init() as well to emulate the old init system.
atmos_init()

// Optimally this wouldn't be needed, but it would take a crazier man than I to refactor atmos machinery code. This is NOT equivalent to Initialize()!
// Unlike Initialize(), this may be called multiple times or in weird spots.
/obj/machinery/atmospherics/proc/atmos_init()

/obj/machinery/atmospherics/attackby(atom/A, var/mob/user)
if(istype(A, /obj/item/pipe_painter))
return
Expand Down Expand Up @@ -122,4 +131,4 @@ obj/machinery/atmospherics/proc/check_connect_types(obj/machinery/atmospherics/a
/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)

/obj/machinery/atmospherics/update_icon()
return null
return null
Expand Up @@ -56,7 +56,7 @@ obj/machinery/atmospherics/binary

return ..()

initialize()
atmos_init()
if(node1 && node2) return

var/node2_connect = dir
Expand Down Expand Up @@ -130,4 +130,4 @@ obj/machinery/atmospherics/binary
update_icon()
update_underlays()

return null
return null
8 changes: 4 additions & 4 deletions code/ATMOSPHERICS/components/binary_devices/circulator.dm
Expand Up @@ -101,13 +101,13 @@
else if(dir & (EAST|WEST))
initialize_directions = EAST|WEST

initialize()
atmos_init()
build_network()
if (node1)
node1.initialize()
node1.atmos_init()
node1.build_network()
if (node2)
node2.initialize()
node2.atmos_init()
node2.build_network()
else
if(node1)
Expand Down Expand Up @@ -144,4 +144,4 @@
return

src.set_dir(turn(src.dir, -90))
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
Expand Up @@ -189,7 +189,7 @@

return 1

/obj/machinery/atmospherics/binary/dp_vent_pump/initialize()
/obj/machinery/atmospherics/binary/dp_vent_pump/atmos_init()
..()
if(frequency)
set_frequency(frequency)
Expand Down
Expand Up @@ -127,7 +127,7 @@

return 1

/obj/machinery/atmospherics/binary/passive_gate/initialize()
/obj/machinery/atmospherics/binary/passive_gate/atmos_init()
..()
if(frequency)
set_frequency(frequency)
Expand Down
8 changes: 4 additions & 4 deletions code/ATMOSPHERICS/components/binary_devices/pipeturbine.dm
Expand Up @@ -96,13 +96,13 @@
else if(dir & (EAST|WEST))
initialize_directions = NORTH|SOUTH

initialize()
atmos_init()
build_network()
if (node1)
node1.initialize()
node1.atmos_init()
node1.build_network()
if (node2)
node2.initialize()
node2.atmos_init()
node2.build_network()
else
if(node1)
Expand Down Expand Up @@ -154,7 +154,7 @@

return null

initialize()
atmos_init()
if(node1 && node2) return

var/node2_connect = turn(dir, -90)
Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/binary_devices/pump.dm
Expand Up @@ -143,7 +143,7 @@ Thus, the two variables affect pump operation are set in New():
ui.open() // open the new ui window
ui.set_auto_update(1) // auto update every Master Controller tick

/obj/machinery/atmospherics/binary/pump/initialize()
/obj/machinery/atmospherics/binary/pump/atmos_init()
..()
if(frequency)
set_frequency(frequency)
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/omni_devices/_omni_extras.dm
Expand Up @@ -41,10 +41,10 @@
/datum/omni_port/proc/connect()
if(node)
return
master.initialize()
master.atmos_init()
master.build_network()
if(node)
node.initialize()
node.atmos_init()
node.build_network()

/datum/omni_port/proc/disconnect()
Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/omni_devices/omni_base.dm
Expand Up @@ -236,7 +236,7 @@

return ..()

/obj/machinery/atmospherics/omni/initialize()
/obj/machinery/atmospherics/omni/atmos_init()
for(var/datum/omni_port/P in ports)
if(P.node || P.mode == 0)
continue
Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/portables_connector.dm
Expand Up @@ -74,7 +74,7 @@

return ..()

/obj/machinery/atmospherics/portables_connector/initialize()
/obj/machinery/atmospherics/portables_connector/atmos_init()
if(node) return

var/node_connect = dir
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/trinary_devices/filter.dm
Expand Up @@ -118,7 +118,7 @@

return 1

/obj/machinery/atmospherics/trinary/filter/initialize()
/obj/machinery/atmospherics/trinary/filter/atmos_init()
set_frequency(frequency)
..()

Expand Down Expand Up @@ -243,7 +243,7 @@ obj/machinery/atmospherics/trinary/filter/m_filter/New()
if(WEST)
initialize_directions = WEST|SOUTH|EAST

/obj/machinery/atmospherics/trinary/filter/m_filter/initialize()
/obj/machinery/atmospherics/trinary/filter/m_filter/atmos_init()
set_frequency(frequency)

if(node1 && node2 && node3) return
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/trinary_devices/mixer.dm
Expand Up @@ -189,7 +189,7 @@ obj/machinery/atmospherics/trinary/mixer/t_mixer/New()
if(WEST)
initialize_directions = WEST|NORTH|SOUTH

obj/machinery/atmospherics/trinary/mixer/t_mixer/initialize()
obj/machinery/atmospherics/trinary/mixer/t_mixer/atmos_init()
..()
if(node1 && node2 && node3) return

Expand Down Expand Up @@ -235,7 +235,7 @@ obj/machinery/atmospherics/trinary/mixer/m_mixer/New()
if(WEST)
initialize_directions = WEST|SOUTH|EAST

obj/machinery/atmospherics/trinary/mixer/m_mixer/initialize()
obj/machinery/atmospherics/trinary/mixer/m_mixer/atmos_init()
..()
if(node1 && node2 && node3) return

Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm
Expand Up @@ -69,7 +69,7 @@ obj/machinery/atmospherics/trinary

return ..()

initialize()
atmos_init()
if(node1 && node2 && node3) return

var/node1_connect = turn(dir, -180)
Expand Down Expand Up @@ -164,4 +164,4 @@ obj/machinery/atmospherics/trinary

update_underlays()

return null
return null
8 changes: 4 additions & 4 deletions code/ATMOSPHERICS/components/tvalve.dm
Expand Up @@ -186,7 +186,7 @@

return

/obj/machinery/atmospherics/tvalve/initialize()
/obj/machinery/atmospherics/tvalve/atmos_init()
var/node1_dir
var/node2_dir
var/node3_dir
Expand Down Expand Up @@ -314,7 +314,7 @@



/obj/machinery/atmospherics/tvalve/digital/initialize()
/obj/machinery/atmospherics/tvalve/digital/atmos_init()
..()
if(frequency)
set_frequency(frequency)
Expand Down Expand Up @@ -378,7 +378,7 @@
if(WEST)
initialize_directions = EAST|WEST|SOUTH

/obj/machinery/atmospherics/tvalve/mirrored/initialize()
/obj/machinery/atmospherics/tvalve/mirrored/atmos_init()
var/node1_dir
var/node2_dir
var/node3_dir
Expand Down Expand Up @@ -446,7 +446,7 @@
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)

/obj/machinery/atmospherics/tvalve/mirrored/digital/initialize()
/obj/machinery/atmospherics/tvalve/mirrored/digital/atmos_init()
..()
if(frequency)
set_frequency(frequency)
Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/unary/cold_sink.dm
Expand Up @@ -32,7 +32,7 @@
component_parts += new /obj/item/stack/cable_coil(src, 2)
RefreshParts()

/obj/machinery/atmospherics/unary/freezer/initialize()
/obj/machinery/atmospherics/unary/freezer/atmos_init()
if(node)
return

Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/unary/heat_exchanger.dm
Expand Up @@ -18,7 +18,7 @@

return

initialize()
atmos_init()
if(!partner)
var/partner_connect = turn(dir,180)

Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/unary/heat_source.dm
Expand Up @@ -33,7 +33,7 @@

RefreshParts()

/obj/machinery/atmospherics/unary/heater/initialize()
/obj/machinery/atmospherics/unary/heater/atmos_init()
if(node)
return

Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/unary/outlet_injector.dm
Expand Up @@ -112,7 +112,7 @@

return 1

/obj/machinery/atmospherics/unary/outlet_injector/initialize()
/obj/machinery/atmospherics/unary/outlet_injector/atmos_init()
..()

set_frequency(frequency)
Expand Down Expand Up @@ -145,4 +145,4 @@
update_icon()

/obj/machinery/atmospherics/unary/outlet_injector/hide(var/i)
update_underlays()
update_underlays()
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/unary/unary_base.dm
Expand Up @@ -39,7 +39,7 @@

return ..()

initialize()
atmos_init()
if(node) return

var/node_connect = dir
Expand Down Expand Up @@ -90,4 +90,4 @@
update_icon()
update_underlays()

return null
return null
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/unary/vent_pump.dm
Expand Up @@ -251,7 +251,7 @@
return 1


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

//some vents work his own special way
Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/unary/vent_scrubber.dm
Expand Up @@ -115,7 +115,7 @@

return 1

/obj/machinery/atmospherics/unary/vent_scrubber/initialize()
/obj/machinery/atmospherics/unary/vent_scrubber/atmos_init()
..()
radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null
radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/valve.dm
Expand Up @@ -143,7 +143,7 @@

return

/obj/machinery/atmospherics/valve/initialize()
/obj/machinery/atmospherics/valve/atmos_init()
normalize_dir()

var/node1_dir
Expand Down Expand Up @@ -258,7 +258,7 @@
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)

/obj/machinery/atmospherics/valve/digital/initialize()
/obj/machinery/atmospherics/valve/digital/atmos_init()
..()
if(frequency)
set_frequency(frequency)
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/he_pipes.dm
Expand Up @@ -24,7 +24,7 @@ obj/machinery/atmospherics/pipe/simple/heat_exchanging
// BubbleWrap END
color = "#404040" //we don't make use of the fancy overlay system for colours, use this to set the default.

initialize()
atmos_init()
normalize_dir()
var/node1_dir
var/node2_dir
Expand Down Expand Up @@ -131,7 +131,7 @@ obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
initialize_directions_he = WEST
// BubbleWrap END

initialize()
atmos_init()
for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions))
if(target.initialize_directions & get_dir(target,src))
node1 = target
Expand Down