Skip to content

Commit

Permalink
Fixes overlay issues w/ pipes (yogstation13#20165)
Browse files Browse the repository at this point in the history
* fixes pipe stuff

* manifolds
  • Loading branch information
JohnFulpWillard authored Aug 31, 2023
1 parent acf8429 commit 89580ea
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
construction_type = /obj/item/pipe/trinary
pipe_state = "he_manifold"

var/mutable_appearance/center

/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/New()
icon_state = ""
center = mutable_appearance(icon, "manifold_center")
return ..()

/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/SetInitDirections()
Expand All @@ -29,6 +26,7 @@
/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/update_overlays()
. = ..()

var/mutable_appearance/center = mutable_appearance(icon, "manifold_center")
PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
. += center

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@
construction_type = /obj/item/pipe/quaternary
pipe_state = "he_manifold4w"

var/mutable_appearance/center

/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/New()
icon_state = ""
center = mutable_appearance(icon, "manifold4w_center")
return ..()

/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/SetInitDirections()
initialize_directions = initial(initialize_directions)

/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/update_overlays()
. = ..()

var/mutable_appearance/center = mutable_appearance(icon, "manifold4w_center")
PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
. += center

Expand Down
27 changes: 14 additions & 13 deletions code/modules/atmospherics/machinery/pipes/layermanifold.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@
/obj/machinery/atmospherics/pipe/layer_manifold/proc/get_all_connected_nodes()
return front_nodes + back_nodes + nodes

/obj/machinery/atmospherics/pipe/layer_manifold/update_icon(updates=ALL) //HEAVILY WIP FOR UPDATE ICONS!!
/obj/machinery/atmospherics/pipe/layer_manifold/update_icon(updates=ALL)
. = ..()
layer = initial(layer) + (PIPING_LAYER_MAX * PIPING_LAYER_LCHANGE) //This is above everything else.
layer = initial(layer) + (PIPING_LAYER_MAX * PIPING_LAYER_LCHANGE)

/obj/machinery/atmospherics/pipe/layer_manifold/update_overlays(updates=ALL)
. = ..()
for(var/node in front_nodes)
add_attached_images(node)
. += add_attached_images(node)
for(var/node in back_nodes)
add_attached_images(node)
. += add_attached_images(node)

update_alpha()

Expand All @@ -58,21 +60,20 @@
return
if(istype(A, /obj/machinery/atmospherics/pipe/layer_manifold))
for(var/i in PIPING_LAYER_MIN to PIPING_LAYER_MAX)
add_attached_image(get_dir(src, A), i)
return
add_attached_image(get_dir(src, A), A.piping_layer, A.pipe_color)
return get_attached_image(get_dir(src, A), i)
return get_attached_image(get_dir(src, A), A.piping_layer, A.pipe_color)

/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_image(p_dir, p_layer, p_color = null)
var/image/I
/obj/machinery/atmospherics/pipe/layer_manifold/proc/get_attached_image(p_dir, p_layer, p_color = null)
var/mutable_appearance/new_overlay

// Uses pipe-3 because we don't want the vertical shifting
if(p_color)
I = getpipeimage(icon, "pipe-3", p_dir, p_color, piping_layer = p_layer)
new_overlay = getpipeimage(icon, "pipe-3", p_dir, p_color, piping_layer = p_layer)
else
I = getpipeimage(icon, "pipe-3", p_dir, piping_layer = p_layer)
new_overlay = getpipeimage(icon, "pipe-3", p_dir, piping_layer = p_layer)

I.layer = layer - 0.01
add_overlay(I)
new_overlay.layer = layer - 0.01
return new_overlay

/obj/machinery/atmospherics/pipe/layer_manifold/SetInitDirections()
switch(dir)
Expand Down
4 changes: 1 addition & 3 deletions code/modules/atmospherics/machinery/pipes/manifold.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@
pipe_interference_group = "atmos-[piping_layer]"\
)

var/mutable_appearance/center

/* We use New() instead of Initialize(mapload) because these values are used in update_appearance(UPDATE_ICON)
* in the mapping subsystem init before Initialize(mapload) is called in the atoms subsystem init.
* This is true for the other manifolds (the 4 ways and the heat exchanges) too.
*/
/obj/machinery/atmospherics/pipe/manifold/New()
icon_state = ""
center = mutable_appearance(icon, "manifold_center")
return ..()

/obj/machinery/atmospherics/pipe/manifold/SetInitDirections()
Expand All @@ -37,6 +34,7 @@

/obj/machinery/atmospherics/pipe/manifold/update_overlays()
. = ..()
var/mutable_appearance/center = mutable_appearance(icon, "manifold_center")
if(!center)
center = mutable_appearance(icon, "manifold_center")
PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
Expand Down
6 changes: 1 addition & 5 deletions code/modules/atmospherics/machinery/pipes/manifold4w.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,16 @@
pipe_interference_group = "atmos-[piping_layer]"\
)

var/mutable_appearance/center

/obj/machinery/atmospherics/pipe/manifold4w/New()
icon_state = ""
center = mutable_appearance(icon, "manifold4w_center")
return ..()

/obj/machinery/atmospherics/pipe/manifold4w/SetInitDirections()
initialize_directions = initial(initialize_directions)

/obj/machinery/atmospherics/pipe/manifold4w/update_overlays()
. = ..()
if(!center)
center = mutable_appearance(icon, "manifold_center")
var/mutable_appearance/center = mutable_appearance(icon, "manifold4w_center")
PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
. += center

Expand Down

0 comments on commit 89580ea

Please sign in to comment.