mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Mirrored pipe simplification.
The last time I dealt with mirrors, the implementation got fudged. Some were flipped but had the same dirs, some were flipped and had the opposite dirs, etc. This fixes all that by making all mirrors have the same dirs, but different node positions. Fixes #3140.
This commit is contained in:
@@ -215,15 +215,7 @@ obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/mirrored
|
||||
icon_state = "intactm_off"
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/mirrored/initialize()
|
||||
if(node1 && node2 && node3) return
|
||||
|
||||
node1 = findConnecting(dir)
|
||||
node2 = findConnecting(turn(dir, -90))
|
||||
node3 = findConnecting(turn(dir, -180))
|
||||
|
||||
update_icon()
|
||||
pipe_flags = IS_MIRROR
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/mirrored/update_icon()
|
||||
if(stat & NOPOWER)
|
||||
|
||||
@@ -142,6 +142,7 @@ obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/mirrored
|
||||
icon_state = "intactm_off"
|
||||
pipe_flags = IS_MIRROR
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/mirrored/update_icon()
|
||||
if(stat & NOPOWER)
|
||||
@@ -153,12 +154,3 @@ obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
|
||||
on = 0
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/mirrored/initialize()
|
||||
if(node1 && node2 && node3) return
|
||||
|
||||
node1 = findConnecting(dir)
|
||||
node2 = findConnecting(turn(dir, -90))
|
||||
node3 = findConnecting(turn(dir, -180))
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -59,6 +59,13 @@
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/initialize()
|
||||
..()
|
||||
|
||||
//force build the networks.
|
||||
go_to_side()
|
||||
go_straight()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/proc/go_to_side()
|
||||
|
||||
if(state) return 0
|
||||
@@ -151,43 +158,9 @@
|
||||
/obj/machinery/atmospherics/trinary/tvalve/return_network_air(datum/network/reference)
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node1)
|
||||
del(network1)
|
||||
node1 = null
|
||||
|
||||
else if(reference==node2)
|
||||
del(network2)
|
||||
node2 = null
|
||||
|
||||
else if(reference==node3)
|
||||
del(network3)
|
||||
node2 = null
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/mirrored
|
||||
icon_state = "tvalvem0"
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/mirrored/initialize()
|
||||
if(node1 && node2 && node3) return
|
||||
|
||||
node1 = findConnecting(turn(dir, 180))
|
||||
node2 = findConnecting(turn(dir, 90))
|
||||
node3 = findConnecting(dir)
|
||||
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/mirrored/initialize_directions()
|
||||
switch(dir)
|
||||
if(SOUTH)
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
if(NORTH)
|
||||
initialize_directions = NORTH|SOUTH|WEST
|
||||
if(WEST)
|
||||
initialize_directions = WEST|EAST|SOUTH
|
||||
if(EAST)
|
||||
initialize_directions = EAST|WEST|NORTH
|
||||
pipe_flags = IS_MIRROR
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/mirrored/update_icon(animation)
|
||||
if(animation)
|
||||
@@ -261,29 +234,7 @@
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/digital/mirrored
|
||||
icon_state = "tvalvem0"
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/digital/mirrored/initialize()
|
||||
if(node1 && node2 && node3) return
|
||||
|
||||
node1 = findConnecting(turn(dir, 180))
|
||||
node2 = findConnecting(turn(dir, 90))
|
||||
node3 = findConnecting(dir)
|
||||
|
||||
update_icon()
|
||||
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/digital/mirrored/initialize_directions()
|
||||
switch(dir)
|
||||
if(SOUTH)
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
if(NORTH)
|
||||
initialize_directions = NORTH|SOUTH|WEST
|
||||
if(WEST)
|
||||
initialize_directions = WEST|EAST|SOUTH
|
||||
if(EAST)
|
||||
initialize_directions = EAST|WEST|NORTH
|
||||
pipe_flags = IS_MIRROR
|
||||
|
||||
/obj/machinery/atmospherics/trinary/tvalve/digital/mirrored/update_icon(animation)
|
||||
if(animation)
|
||||
|
||||
@@ -39,14 +39,14 @@ obj/machinery/atmospherics/trinary/New()
|
||||
if(WEST)
|
||||
initialize_directions = EAST|WEST|NORTH
|
||||
|
||||
obj/machinery/atmospherics/trinary/buildFrom(var/mob/usr,var/obj/item/pipe/pipe, var/mirrored = 0)
|
||||
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
|
||||
var/obj/machinery/atmospherics/trinary/mirrored_pipe = new mirror(src.loc)
|
||||
pipe.dir = turn(pipe.dir, -45)
|
||||
qdel(src)
|
||||
return mirrored_pipe.buildFrom(usr, pipe, 1)
|
||||
return mirrored_pipe.buildFrom(usr, pipe)
|
||||
dir = pipe.dir
|
||||
initialize_directions = pipe.get_pipe_dir(mirrored)
|
||||
initialize_directions = pipe.get_pipe_dir()
|
||||
if (pipe.pipename)
|
||||
name = pipe.pipename
|
||||
var/turf/T = loc
|
||||
@@ -102,9 +102,20 @@ obj/machinery/atmospherics/trinary/Destroy()
|
||||
obj/machinery/atmospherics/trinary/initialize()
|
||||
if(node1 && node2 && node3) return
|
||||
|
||||
node1 = findConnecting(turn(dir, -180))
|
||||
node2 = findConnecting(turn(dir, -90))
|
||||
node3 = findConnecting(dir)
|
||||
//mirrored pipes face the same way and have their nodes in the same place
|
||||
//The 1 and 3 nodes are reversed, however.
|
||||
// 1 3
|
||||
// 2-- becomes 2-- facing south, for example
|
||||
// 3 1
|
||||
if(!(pipe_flags & IS_MIRROR))
|
||||
node1 = findConnecting(turn(dir, -180))
|
||||
node2 = findConnecting(turn(dir, -90))
|
||||
node3 = findConnecting(dir)
|
||||
else
|
||||
node1 = findConnecting(dir)
|
||||
node2 = findConnecting(turn(dir, -90))
|
||||
node3 = findConnecting(turn(dir, -180))
|
||||
|
||||
|
||||
update_icon()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user