Prepare Atmospherics Machinery for SSatoms (#4501)

* to_chat() replacement.

* Revert calling target.init_dir() before connecting.

* This change was added in https://github.com/PolarisSS13/Polaris/pull/3775 to counteract `dir` not being set prior to New() for dynamically loaded maps.  The root cause was /atom/New() not calling _preloader.load().  Undoing the change now that /atom/New() is fixed.
* The addition of the init_dir() proc itself however, is useful, because there ARE other times some atmos machinery will want to re-initialize its dir, specifically whenever it is rotated.
* init_dir() must be called in the constructor of all atmospherics machines capable of connecting to another.   Since it has to happen for ALL machines, lets move that call to /obj/machinery/atmospherics/New()

* Rename /obj/machinery/atmospherics initialize() to atmos_init()

* These days `initialize()` is used to handle general object initialization that is moved outside of New().  The node connection discovery of atmos machinery needs to happen after all that, and so needs to be in a separate proc.
* Make sure to actually call atmos_init during system startup.
This commit is contained in:
Leshana
2018-01-06 11:52:56 -05:00
committed by Anewbe
parent e23c002eb5
commit 224fe42e77
28 changed files with 238 additions and 297 deletions

View File

@@ -10,9 +10,6 @@ Pipelines + Other Objects -> Pipe network
*/
/obj/machinery/atmospherics
auto_init = 0
anchored = 1
idle_power_usage = 0
active_power_usage = 0
@@ -33,6 +30,7 @@ Pipelines + Other Objects -> Pipe network
var/obj/machinery/atmospherics/node2
/obj/machinery/atmospherics/New()
..()
if(!icon_manager)
icon_manager = new()
@@ -42,7 +40,19 @@ Pipelines + Other Objects -> Pipe network
if(!pipe_color_check(pipe_color))
pipe_color = null
..()
init_dir()
// This is used to set up what directions pipes will connect to. Should be called inside New() and whenever a dir changes.
/obj/machinery/atmospherics/proc/init_dir()
return
// Initializes nodes by looking at neighboring atmospherics machinery to connect to.
// When we're being constructed at runtime, atmos_init() is called by the construction code.
// When dynamically loading a map atmos_init is called by the maploader (initTemplateBounds proc)
// But during initial world creation its called by the master_controller.
// TODO - Consolidate these different ways of being called once SSatoms is created.
/obj/machinery/atmospherics/proc/atmos_init()
return
/obj/machinery/atmospherics/attackby(atom/A, mob/user as mob)
if(istype(A, /obj/item/device/pipe_painter))

View File

@@ -57,24 +57,20 @@
node1 = null
node2 = null
/obj/machinery/atmospherics/binary/initialize()
/obj/machinery/atmospherics/binary/atmos_init()
if(node1 && node2)
return
init_dir()
var/node2_connect = dir
var/node1_connect = turn(dir, 180)
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target

View File

@@ -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)

View File

@@ -166,7 +166,7 @@
return
src.add_fingerprint(usr)
if(!src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return
usr.set_machine(src)
ui_interact(user)
@@ -240,14 +240,14 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (unlocked)
user << "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>"
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>")
return 1
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \

View File

@@ -87,7 +87,7 @@
if(istype(W, /obj/item/weapon/wrench))
anchored = !anchored
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding \the [src] to the floor.</span>"
to_chat(user, "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding \the [src] to the floor.</span>")
if(anchored)
if(dir & (NORTH|SOUTH))
@@ -95,13 +95,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)
@@ -153,7 +153,7 @@
return null
initialize()
atmos_init()
if(node1 && node2) return
var/node2_connect = turn(dir, -90)
@@ -260,7 +260,7 @@
anchored = !anchored
playsound(src, W.usesound, 50, 1)
turbine = null
user << "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding \the [src] to the floor.</span>"
to_chat(user, "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding \the [src] to the floor.</span>")
updateConnection()
else
..()

View File

@@ -183,7 +183,7 @@ Thus, the two variables affect pump operation are set in New():
return
src.add_fingerprint(usr)
if(!src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return
usr.set_machine(src)
ui_interact(user)
@@ -219,14 +219,14 @@ Thus, the two variables affect pump operation are set in New():
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && use_power)
user << "<span class='warning'>You cannot unwrench this [src], turn it off first.</span>"
to_chat(user, "<span class='warning'>You cannot unwrench this [src], turn it off first.</span>")
return 1
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench this [src], it too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \

View File

@@ -40,10 +40,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()

View File

@@ -86,7 +86,7 @@
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
playsound(src, W.usesound, 50, 1)
if(do_after(user, 40 * W.toolspeed))
user.visible_message( \
@@ -245,14 +245,13 @@
qdel(P.network)
P.node = null
..()
. = ..()
/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
for(var/obj/machinery/atmospherics/target in get_step(src, P.dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
P.node = target

View File

@@ -21,10 +21,6 @@
/obj/machinery/atmospherics/portables_connector/init_dir()
initialize_directions = dir
/obj/machinery/atmospherics/portables_connector/New()
init_dir()
..()
/obj/machinery/atmospherics/portables_connector/update_icon()
icon_state = "connector"
@@ -74,16 +70,13 @@
node = null
/obj/machinery/atmospherics/portables_connector/initialize()
/obj/machinery/atmospherics/portables_connector/atmos_init()
if(node)
return
init_dir()
var/node_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node = target
@@ -138,7 +131,7 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (connected_device)
user << "<span class='warning'>You cannot unwrench \the [src], dettach \the [connected_device] first.</span>"
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], dettach \the [connected_device] first.</span>")
return 1
if (locate(/obj/machinery/portable_atmospherics, src.loc))
return 1
@@ -147,7 +140,7 @@
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \

View File

@@ -136,7 +136,7 @@
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \
@@ -151,7 +151,7 @@
return
if(!src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return
var/dat
@@ -247,9 +247,7 @@ obj/machinery/atmospherics/trinary/atmos_filter/m_filter/init_dir()
if(WEST)
initialize_directions = WEST|SOUTH|EAST
/obj/machinery/atmospherics/trinary/atmos_filter/m_filter/initialize()
set_frequency(frequency)
/obj/machinery/atmospherics/trinary/atmos_filter/m_filter/atmos_init()
if(node1 && node2 && node3) return
var/node1_connect = turn(dir, -180)

View File

@@ -111,7 +111,7 @@
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \
@@ -125,7 +125,7 @@
return
src.add_fingerprint(usr)
if(!src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return
usr.set_machine(src)
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[use_power?"On":"Off"]</a><br>
@@ -192,7 +192,7 @@ obj/machinery/atmospherics/trinary/mixer/t_mixer/init_dir()
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
@@ -237,7 +237,7 @@ obj/machinery/atmospherics/trinary/mixer/m_mixer/init_dir()
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

View File

@@ -15,7 +15,6 @@
/obj/machinery/atmospherics/trinary/New()
..()
init_dir()
air1 = new
air2 = new
@@ -71,31 +70,26 @@
node2 = null
node3 = null
/obj/machinery/atmospherics/trinary/initialize()
/obj/machinery/atmospherics/trinary/atmos_init()
if(node1 && node2 && node3)
return
init_dir()
var/node1_connect = turn(dir, -180)
var/node2_connect = turn(dir, -90)
var/node3_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node3_connect))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node3 = target

View File

@@ -46,10 +46,6 @@
/obj/machinery/atmospherics/tvalve/hide(var/i)
update_underlays()
/obj/machinery/atmospherics/tvalve/New()
init_dir()
..()
/obj/machinery/atmospherics/tvalve/init_dir()
switch(dir)
if(NORTH)
@@ -183,31 +179,26 @@
return
/obj/machinery/atmospherics/tvalve/initialize()
/obj/machinery/atmospherics/tvalve/atmos_init()
var/node1_dir
var/node2_dir
var/node3_dir
init_dir()
node1_dir = turn(dir, 180)
node2_dir = turn(dir, -90)
node3_dir = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node3 = target
@@ -308,7 +299,7 @@
if(!powered())
return
if(!src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return
..()
@@ -350,14 +341,14 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (istype(src, /obj/machinery/atmospherics/tvalve/digital))
user << "<span class='warning'>You cannot unwrench \the [src], it's too complicated.</span>"
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it's too complicated.</span>")
return 1
if(!can_unwrench())
to_chat(user, "<span class='warnng'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \
@@ -384,7 +375,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
@@ -446,7 +437,7 @@
if(!powered())
return
if(!src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return
..()

View File

@@ -23,7 +23,6 @@
/obj/machinery/atmospherics/unary/freezer/New()
..()
initialize_directions = dir
component_parts = list()
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
@@ -32,7 +31,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

View File

@@ -18,7 +18,7 @@
return
initialize()
atmos_init()
if(!partner)
var/partner_connect = turn(dir,180)
@@ -70,14 +70,14 @@
return ..()
var/turf/T = src.loc
if (level==1 && isturf(T) && !T.is_plating())
user << "<span class='warning'>You must remove the plating first.</span>"
to_chat(user, "<span class='warning'>You must remove the plating first.</span>")
return 1
if (!can_unwrench())
user << "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \

View File

@@ -23,7 +23,6 @@
/obj/machinery/atmospherics/unary/heater/New()
..()
initialize_directions = dir
component_parts = list()
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
@@ -32,7 +31,7 @@
RefreshParts()
/obj/machinery/atmospherics/unary/heater/initialize()
/obj/machinery/atmospherics/unary/heater/atmos_init()
if(node)
return

View File

@@ -13,7 +13,6 @@
/obj/machinery/atmospherics/unary/New()
..()
init_dir()
air_contents = new
air_contents.volume = 200
@@ -42,16 +41,13 @@
node = null
/obj/machinery/atmospherics/unary/initialize()
/obj/machinery/atmospherics/unary/atmos_init()
if(node)
return
init_dir()
var/node_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node = target

View File

@@ -357,7 +357,7 @@
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "<span class='notice'>Now welding the vent.</span>"
to_chat(user, "<span class='notice'>Now welding the vent.</span>")
if(do_after(user, 20 * WT.toolspeed))
if(!src || !WT.isOn()) return
playsound(src.loc, WT.usesound, 50, 1)
@@ -370,9 +370,9 @@
welded = 0
update_icon()
else
user << "<span class='notice'>The welding tool needs to be on to start this task.</span>"
to_chat(user, "<span class='notice'>The welding tool needs to be on to start this task.</span>")
else
user << "<span class='warning'>You need more welding fuel to complete this task.</span>"
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task.</span>")
return 1
else
..()
@@ -395,18 +395,18 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && use_power)
user << "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>"
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>")
return 1
var/turf/T = src.loc
if (node && node.level==1 && isturf(T) && !T.is_plating())
user << "<span class='warning'>You must remove the plating first.</span>"
to_chat(user, "<span class='warning'>You must remove the plating first.</span>")
return 1
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \

View File

@@ -266,18 +266,18 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && use_power)
user << "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>"
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>")
return 1
var/turf/T = src.loc
if (node && node.level==1 && isturf(T) && !T.is_plating())
user << "<span class='warning'>You must remove the plating first.</span>"
to_chat(user, "<span class='warning'>You must remove the plating first.</span>")
return 1
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \

View File

@@ -140,8 +140,7 @@
return
/obj/machinery/atmospherics/valve/initialize()
init_dir()
/obj/machinery/atmospherics/valve/atmos_init()
normalize_dir()
var/node1_dir
@@ -155,13 +154,11 @@
node2_dir = direction
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
@@ -239,7 +236,7 @@
if(!powered())
return
if(!src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return
..()
@@ -292,14 +289,14 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (istype(src, /obj/machinery/atmospherics/valve/digital) && !src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return 1
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \

View File

@@ -19,7 +19,6 @@
// BubbleWrap
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/New()
..()
init_dir()
// BubbleWrap END
color = "#404040" //we don't make use of the fancy overlay system for colours, use this to set the default.
@@ -28,7 +27,6 @@
initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/initialize()
init_dir()
normalize_dir()
var/node1_dir
var/node2_dir
@@ -41,12 +39,10 @@
node2_dir = direction
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node1_dir))
target.init_dir()
if(target.initialize_directions_he & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node2_dir))
target.init_dir()
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break
@@ -137,14 +133,11 @@
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/initialize()
init_dir()
for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,initialize_directions_he))
target.init_dir()
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break

View File

@@ -101,7 +101,7 @@ obj/machinery/atmospherics/mains_pipe
disconnect()
..()
initialize()
atmos_init()
for(var/i = 1 to nodes.len)
var/obj/machinery/atmospherics/mains_pipe/node = nodes[i]
if(node)
@@ -155,7 +155,7 @@ obj/machinery/atmospherics/mains_pipe/simple
var/have_node2 = nodes[2]?1:0
icon_state = "exposed[have_node1][have_node2][invisibility ? "-f" : "" ]"
initialize()
atmos_init()
normalize_dir()
var/node1_dir
var/node2_dir
@@ -203,7 +203,7 @@ obj/machinery/atmospherics/mains_pipe/manifold
..()
initialize_mains_directions = (NORTH|SOUTH|EAST|WEST) & ~dir
initialize()
atmos_init()
var/connect_directions = initialize_mains_directions
for(var/direction in cardinal)
@@ -267,7 +267,7 @@ obj/machinery/atmospherics/mains_pipe/manifold4w
nodes.len = 4
..()
initialize()
atmos_init()
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,NORTH))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[1] = target
@@ -319,7 +319,7 @@ obj/machinery/atmospherics/mains_pipe/split
initialize_mains_directions = turn(dir, 90) | turn(dir, -90)
initialize_directions = dir // actually have a normal connection too
initialize()
atmos_init()
var/node1_dir
var/node2_dir
var/node3_dir
@@ -420,7 +420,7 @@ obj/machinery/atmospherics/mains_pipe/split3
initialize_mains_directions = dir
initialize_directions = cardinal & ~dir // actually have a normal connection too
initialize()
atmos_init()
var/node1_dir
var/supply_node_dir
var/scrubbers_node_dir
@@ -514,7 +514,7 @@ obj/machinery/atmospherics/mains_pipe/cap
update_icon()
icon_state = "cap[invisibility ? "-f" : ""]"
initialize()
atmos_init()
for(var/obj/machinery/atmospherics/mains_pipe/target in get_step(src,dir))
if(target.initialize_mains_directions & get_dir(target,src))
nodes[1] = target
@@ -647,7 +647,7 @@ obj/machinery/atmospherics/mains_pipe/valve
attack_hand(mob/user as mob)
if(!src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return
..()

View File

@@ -34,10 +34,6 @@
return 1
// This is used to set up what directions pipes will connect to. Called inside New(), initialize(), and when pipes look at another pipe, incase they didn't get to initialize() yet.
/obj/machinery/atmospherics/proc/init_dir()
return
/obj/machinery/atmospherics/pipe/return_air()
if(!parent)
parent = new /datum/pipeline()
@@ -84,14 +80,14 @@
return ..()
var/turf/T = src.loc
if (level==1 && isturf(T) && !T.is_plating())
user << "<span class='warning'>You must remove the plating first.</span>"
to_chat(user, "<span class='warning'>You must remove the plating first.</span>")
return 1
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \
@@ -170,10 +166,6 @@
icon = null
alpha = 255
init_dir()
/obj/machinery/atmospherics/pipe/simple/hide(var/i)
if(istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
@@ -274,8 +266,7 @@
/obj/machinery/atmospherics/pipe/simple/update_underlays()
return
/obj/machinery/atmospherics/pipe/simple/initialize()
init_dir()
/obj/machinery/atmospherics/pipe/simple/atmos_init()
normalize_dir()
var/node1_dir
var/node2_dir
@@ -288,13 +279,11 @@
node2_dir = direction
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
@@ -444,8 +433,6 @@
alpha = 255
icon = null
init_dir()
/obj/machinery/atmospherics/pipe/manifold/init_dir()
switch(dir)
if(NORTH)
@@ -554,14 +541,12 @@
..()
update_icon()
/obj/machinery/atmospherics/pipe/manifold/initialize()
init_dir()
/obj/machinery/atmospherics/pipe/manifold/atmos_init()
var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir)
for(var/direction in cardinal)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
@@ -574,7 +559,6 @@
for(var/direction in cardinal)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
@@ -587,7 +571,6 @@
for(var/direction in cardinal)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node3 = target
@@ -835,31 +818,27 @@
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/manifold4w/initialize()
/obj/machinery/atmospherics/pipe/manifold4w/atmos_init()
for(var/obj/machinery/atmospherics/target in get_step(src,1))
target.init_dir()
if(target.initialize_directions & 2)
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,2))
target.init_dir()
if(target.initialize_directions & 1)
if (check_connect_types(target,src))
node2 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,4))
target.init_dir()
if(target.initialize_directions & 8)
if (check_connect_types(target,src))
node3 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,8))
target.init_dir()
if(target.initialize_directions & 4)
if (check_connect_types(target,src))
node4 = target
@@ -975,10 +954,6 @@
var/obj/machinery/atmospherics/node
/obj/machinery/atmospherics/pipe/cap/New()
..()
init_dir()
/obj/machinery/atmospherics/pipe/cap/init_dir()
initialize_directions = dir
@@ -1027,10 +1002,8 @@
overlays.Cut()
overlays += icon_manager.get_atmos_icon("pipe", , pipe_color, "cap")
/obj/machinery/atmospherics/pipe/cap/initialize()
init_dir()
/obj/machinery/atmospherics/pipe/cap/atmos_init()
for(var/obj/machinery/atmospherics/target in get_step(src, dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node = target
@@ -1106,7 +1079,6 @@
/obj/machinery/atmospherics/pipe/tank/New()
icon_state = "air"
init_dir()
..()
/obj/machinery/atmospherics/pipe/tank/init_dir()
@@ -1139,12 +1111,10 @@
/obj/machinery/atmospherics/pipe/tank/hide()
update_underlays()
/obj/machinery/atmospherics/pipe/tank/initialize()
init_dir()
/obj/machinery/atmospherics/pipe/tank/atmos_init()
var/connect_direction = dir
for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
@@ -1272,10 +1242,6 @@
var/build_killswitch = 1
/obj/machinery/atmospherics/pipe/vent/New()
init_dir()
..()
/obj/machinery/atmospherics/pipe/vent/init_dir()
initialize_directions = dir
@@ -1313,12 +1279,10 @@
else
icon_state = "exposed"
/obj/machinery/atmospherics/pipe/vent/initialize()
init_dir()
/obj/machinery/atmospherics/pipe/vent/atmos_init()
var/connect_direction = dir
for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target