partial gas meter code revert (#19492)

* old meter

* revert

* revert
This commit is contained in:
Will
2026-05-27 19:43:24 -04:00
committed by GitHub
parent 67d0612729
commit fa2a7227d7
3 changed files with 17 additions and 48 deletions
+2 -2
View File
@@ -116,10 +116,10 @@
if(air_temporary)
loc.assume_air(air_temporary)
for(var/obj/machinery/meter/meter in loc)
var/obj/machinery/atmospherics/pipe/target = meter.select_target()
if(target == src)
if(meter.target == src)
var/obj/item/pipe_meter/PM = new /obj/item/pipe_meter(loc)
meter.transfer_fingerprints_to(PM)
meter.align_to_target()
qdel(meter)
. = ..()
-1
View File
@@ -72,7 +72,6 @@
return atmosanalyzer_scan(src, src.output.air, user)
/obj/machinery/meter/atmosanalyze(mob/user)
var/obj/machinery/atmospherics/pipe/target = select_target()
var/datum/gas_mixture/mixture = null
if(target && target.parent)
mixture = target.parent.air
+15 -45
View File
@@ -3,6 +3,7 @@
desc = "It measures something."
icon = 'icons/obj/meter.dmi'
icon_state = "meterX"
var/obj/machinery/atmospherics/pipe/target = null
var/list/pipes_on_turf = list()
anchored = TRUE
power_channel = ENVIRON
@@ -11,52 +12,28 @@
var/open = FALSE
use_power = USE_POWER_IDLE
idle_power_usage = 15
var/piping_layer = PIPING_LAYER_DEFAULT
var/datum/weakref/cached_pipe = null
/obj/machinery/meter/Initialize(mapload, pipe_layer_selected)
. = ..()
// Check if we should attach to a pipe OTHER than the regular.
// Don't do this if we have a mapper set pipe layer, or if we are not maploaded.
if(mapload && piping_layer == PIPING_LAYER_DEFAULT)
for(var/obj/machinery/atmospherics/pipe/P in get_turf(src))
pipe_layer_selected = P.piping_layer // First come first serve
break
// Offset the icon as needed
if(pipe_layer_selected != PIPING_LAYER_DEFAULT)
piping_layer = pipe_layer_selected
update_icon()
// Rename automagically based on the pipelayer it's being made at.
if(!mapload || name == initial(name)) // Check if we have a map edited name first
switch(piping_layer)
if(PIPING_LAYER_SUPPLY)
name = "supply-meter"
if(PIPING_LAYER_SCRUBBER)
name = "scrubber-meter"
if(PIPING_LAYER_FUEL)
name = "fuel-meter"
if(PIPING_LAYER_AUX)
name = "aux-meter"
if (!target)
target = select_target()
align_to_target()
/obj/machinery/meter/Destroy()
pipes_on_turf.Cut()
cached_pipe = null
target = null
return ..()
/obj/machinery/meter/proc/select_target()
var/obj/machinery/atmospherics/pipe/P = cached_pipe?.resolve()
if(P)
return P
for(P in get_turf(src))
if(P.piping_layer != piping_layer)
continue
var/obj/machinery/atmospherics/pipe/P
for(P in loc)
if(!P.hides_under_flooring())
cached_pipe = WEAKREF(P)
return P
return null
break
if(!P)
P = locate(/obj/machinery/atmospherics/pipe) in loc
return P
/obj/machinery/meter/process()
var/obj/machinery/atmospherics/pipe/target = select_target()
if(!target)
icon_state = "meterX"
return 0
@@ -104,7 +81,6 @@
/obj/machinery/meter/examine(mob/user)
. = ..()
var/obj/machinery/atmospherics/pipe/target = select_target()
if(get_dist(user, src) > 6 && !(isAI(user) || isobserver(user)))
. += span_warning("You are too far away to read it.")
@@ -160,44 +136,38 @@
pipes_on_turf |= P
if(!pipes_on_turf.len)
return
var/obj/machinery/atmospherics/pipe/target = select_target()
target = pipes_on_turf[1]
pipes_on_turf.Remove(target)
pipes_on_turf.Add(target)
align_to_target()
to_chat(user, span_notice("Pipe meter set to moniter \the [target]."))
return
return ..()
/obj/machinery/meter/update_icon()
. = ..()
/obj/machinery/meter/proc/align_to_target()
// Use offsets instead of custom icons
switch(piping_layer)
switch(target?.piping_layer)
if(PIPING_LAYER_SUPPLY)
pixel_x = -4
pixel_y = -4
name = "supply-meter"
if(PIPING_LAYER_SCRUBBER)
pixel_x = 4
pixel_y = 4
name = "scrubber-meter"
if(PIPING_LAYER_FUEL)
pixel_x = 8
pixel_y = 8
name = "fuel-meter"
if(PIPING_LAYER_AUX)
pixel_x = -8
pixel_y = -8
name = "aux-meter"
else
pixel_x = 0
pixel_y = 0
name = initial(name)
// TURF METER - REPORTS A TILE'S AIR CONTENTS
/obj/machinery/meter/turf/select_target()
return loc
/obj/machinery/meter/turf/attackby(obj/item/W as obj, mob/user as mob)
/obj/machinery/meter/turf/attackby(obj/item/W, mob/user)
return