[MIRROR] fix devices sprites on layer 1 and 5 (#667)

* Hardsynced from upstream.

* fix devices sprites on layer 1 and 5 (#53382)

This atomized PR fixes the sprites for layer 1 and 5 of the following devices:
-scrubber
-unary vent
-passive vent
-portable connector
-filter filters don't work well on layer 1 and 5, so they get the axe
-mixer mixers don't work well on layer 1 and 5, so they get the axe
The how:
instead of just moving the node, we'll move the entire thing because sprites bad and can't fit

Co-authored-by: Ghilker <42839747+Ghilker@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-09-07 17:22:20 +02:00
committed by GitHub
co-authored by Ghilker
parent 3a73984e90
commit 00f8ee2fc3
18 changed files with 56 additions and 21 deletions
+8
View File
@@ -376,6 +376,14 @@
T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y;\
}
#define PIPING_FORWARD_SHIFT(T, PipingLayer, more_shift) \
if(T.dir & (NORTH|SOUTH)) { \
T.pixel_y += more_shift * (PipingLayer - PIPING_LAYER_DEFAULT);\
} \
if(T.dir & (EAST|WEST)) { \
T.pixel_x += more_shift * (PipingLayer - PIPING_LAYER_DEFAULT);\
}
#define PIPING_LAYER_DOUBLE_SHIFT(T, PipingLayer) \
T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X;\
T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y;
@@ -249,7 +249,7 @@
transfer_fingerprints_to(stored)
..()
/obj/machinery/atmospherics/proc/getpipeimage(iconset, iconstate, direction, col=rgb(255,255,255), piping_layer=3)
/obj/machinery/atmospherics/proc/getpipeimage(iconset, iconstate, direction, col=rgb(255,255,255), piping_layer=3, trinary = FALSE)
//Add identifiers for the iconset
if(iconsetids[iconset] == null)
@@ -263,6 +263,8 @@
pipe_overlay = . = pipeimages[identifier] = image(iconset, iconstate, dir = direction)
pipe_overlay.color = col
PIPING_LAYER_SHIFT(pipe_overlay, piping_layer)
if(trinary == TRUE && (piping_layer == 1 || piping_layer == 5))
PIPING_FORWARD_SHIFT(pipe_overlay, piping_layer, 2)
/obj/machinery/atmospherics/on_construction(obj_color, set_layer)
if(can_unwrench)
@@ -15,3 +15,11 @@
/obj/machinery/atmospherics/components/binary/getNodeConnects()
return list(turn(dir, 180), dir)
///Used by binary devices to set what the offset will be for each layer
/obj/machinery/atmospherics/components/binary/proc/set_overlay_offset(var/pipe_layer)
switch(pipe_layer)
if(1, 3, 5)
return 1
if(2, 4)
return 2
@@ -47,9 +47,9 @@ Passive gate is similar to the regular pump except:
/obj/machinery/atmospherics/components/binary/passive_gate/update_icon_nopipes()
cut_overlays()
icon_state = "passgate_off"
icon_state = "passgate_off-[set_overlay_offset(piping_layer)]"
if(on)
add_overlay(getpipeimage(icon, "passgate_on"))
add_overlay(getpipeimage(icon, "passgate_on-[set_overlay_offset(piping_layer)]"))
/obj/machinery/atmospherics/components/binary/passive_gate/process_atmos()
..()
@@ -42,11 +42,11 @@
/obj/machinery/atmospherics/components/binary/pressure_valve/update_icon_nopipes()
if(on && is_operational && is_gas_flowing)
icon_state = "pvalve_flow"
icon_state = "pvalve_flow-[set_overlay_offset(piping_layer)]"
else if(on && is_operational && !is_gas_flowing)
icon_state = "pvalve_on"
icon_state = "pvalve_on-[set_overlay_offset(piping_layer)]"
else
icon_state = "pvalve_off"
icon_state = "pvalve_off-[set_overlay_offset(piping_layer)]"
/obj/machinery/atmospherics/components/binary/pressure_valve/process_atmos()
@@ -48,7 +48,7 @@
return ..()
/obj/machinery/atmospherics/components/binary/pump/update_icon_nopipes()
icon_state = (on && is_operational) ? "pump_on" : "pump_off"
icon_state = (on && is_operational) ? "pump_on-[set_overlay_offset(piping_layer)]" : "pump_off-[set_overlay_offset(piping_layer)]"
/obj/machinery/atmospherics/components/binary/pump/process_atmos()
// ..()
@@ -27,8 +27,8 @@ It's like a regular ol' straight pipe, but you can turn it on and off.
/obj/machinery/atmospherics/components/binary/valve/update_icon_nopipes(animation = FALSE)
normalize_cardinal_directions()
if(animation)
flick("[valve_type]valve_[on][!on]", src)
icon_state = "[valve_type]valve_[on ? "on" : "off"]"
flick("[valve_type]valve_[on][!on]-[set_overlay_offset(piping_layer)]", src)
icon_state = "[valve_type]valve_[on ? "on" : "off"]-[set_overlay_offset(piping_layer)]"
/obj/machinery/atmospherics/components/binary/valve/proc/toggle()
if(on)
@@ -69,7 +69,7 @@ It's like a regular ol' straight pipe, but you can turn it on and off.
/obj/machinery/atmospherics/components/binary/valve/digital/update_icon_nopipes(animation)
if(!is_operational)
normalize_cardinal_directions()
icon_state = "dvalve_nopower"
icon_state = "dvalve_nopower-[set_overlay_offset(piping_layer)]"
return
..()
@@ -47,7 +47,7 @@
return ..()
/obj/machinery/atmospherics/components/binary/volume_pump/update_icon_nopipes()
icon_state = on && is_operational ? "volpump_on" : "volpump_off"
icon_state = on && is_operational ? "volpump_on-[set_overlay_offset(piping_layer)]" : "volpump_off-[set_overlay_offset(piping_layer)]"
/obj/machinery/atmospherics/components/binary/volume_pump/process_atmos()
// ..()
@@ -47,9 +47,9 @@
var/image/cap
if(node)
cap = getpipeimage(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer)
cap = getpipeimage(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE)
else
cap = getpipeimage(icon, "cap", direction, piping_layer = piping_layer)
cap = getpipeimage(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE)
add_overlay(cap)
@@ -57,7 +57,7 @@
/obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes()
var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
icon_state = "filter_[on_state ? "on" : "off"][flipped ? "_f" : ""]"
icon_state = "filter_[on_state ? "on" : "off"]-[set_overlay_offset(piping_layer)][flipped ? "_f" : ""]"
/obj/machinery/atmospherics/components/trinary/filter/process_atmos()
..()
@@ -39,9 +39,9 @@
var/image/cap
if(node)
cap = getpipeimage(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer)
cap = getpipeimage(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE)
else
cap = getpipeimage(icon, "cap", direction, piping_layer = piping_layer)
cap = getpipeimage(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE)
add_overlay(cap)
@@ -49,7 +49,7 @@
/obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes()
var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
icon_state = "mixer_[on_state ? "on" : "off"][flipped ? "_f" : ""]"
icon_state = "mixer_[on_state ? "on" : "off"]-[set_overlay_offset(piping_layer)][flipped ? "_f" : ""]"
/obj/machinery/atmospherics/components/trinary/mixer/New()
..()
@@ -46,3 +46,12 @@ Housekeeping and pipe network stuff
node3_connect = turn(node3_connect, 180)
return list(node1_connect, node2_connect, node3_connect)
/obj/machinery/atmospherics/components/trinary/proc/set_overlay_offset(var/pipe_layer)
switch(pipe_layer)
if(1)
return 1
if(5)
return 5
else
return 0
@@ -7,13 +7,14 @@
can_unwrench = TRUE
hide = TRUE
layer = GAS_SCRUBBER_LAYER
shift_underlay_only = FALSE
pipe_state = "pvent"
/obj/machinery/atmospherics/components/unary/passive_vent/update_icon_nopipes()
cut_overlays()
if(showpipe)
var/image/cap = getpipeimage(icon, "vent_cap", initialize_directions, piping_layer = piping_layer)
var/image/cap = getpipeimage(icon, "vent_cap", initialize_directions)
add_overlay(cap)
icon_state = "passive_vent"
@@ -9,6 +9,7 @@
use_power = NO_POWER_USE
layer = GAS_FILTER_LAYER
hide = TRUE
shift_underlay_only = FALSE
pipe_flags = PIPING_ONE_PER_TURF
pipe_state = "connector"
@@ -28,7 +29,7 @@
/obj/machinery/atmospherics/components/unary/portables_connector/update_icon_nopipes()
icon_state = "connector"
if(showpipe)
var/image/cap = getpipeimage(icon, "connector_cap", initialize_directions, piping_layer = piping_layer)
var/image/cap = getpipeimage(icon, "connector_cap", initialize_directions)
add_overlay(cap)
/obj/machinery/atmospherics/components/unary/portables_connector/process_atmos()
@@ -16,6 +16,7 @@
welded = FALSE
layer = GAS_SCRUBBER_LAYER
hide = TRUE
shift_underlay_only = FALSE
var/id_tag = null
var/pump_direction = RELEASING
@@ -52,8 +53,10 @@
/obj/machinery/atmospherics/components/unary/vent_pump/update_icon_nopipes()
cut_overlays()
if(showpipe)
var/image/cap = getpipeimage(icon, "vent_cap", initialize_directions, piping_layer = piping_layer)
var/image/cap = getpipeimage(icon, "vent_cap", initialize_directions)
add_overlay(cap)
else
PIPING_LAYER_SHIFT(src, PIPING_LAYER_DEFAULT)
if(welded)
icon_state = "vent_welded"
@@ -13,6 +13,7 @@
welded = FALSE
layer = GAS_SCRUBBER_LAYER
hide = TRUE
shift_underlay_only = FALSE
var/id_tag = null
var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing
@@ -69,8 +70,10 @@
/obj/machinery/atmospherics/components/unary/vent_scrubber/update_icon_nopipes()
cut_overlays()
if(showpipe)
var/image/cap = getpipeimage(icon, "scrub_cap", initialize_directions, piping_layer = piping_layer)
var/image/cap = getpipeimage(icon, "scrub_cap", initialize_directions)
add_overlay(cap)
else
PIPING_LAYER_SHIFT(src, PIPING_LAYER_DEFAULT)
if(welded)
icon_state = "scrub_welded"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB