[FIX] Ventcrawling overlay fixes (#27013)

* Vent images update while ventcrawling

* Add some comments

* Autodoc for a variable

* Get rid of this useless timer

* Update code/modules/atmospherics/machinery/atmospherics.dm

Co-authored-by: Nathan Winters <100448493+CinnamonSnowball@users.noreply.github.com>
Signed-off-by: Chap <erwin@lombok.demon.nl>

* Move update pipe image to unary base

* We're doing signals now

* Added a comment to the signal

* Trailing newline

---------

Signed-off-by: Chap <erwin@lombok.demon.nl>
Co-authored-by: Adrer <adrermail@gmail.com>
Co-authored-by: Nathan Winters <100448493+CinnamonSnowball@users.noreply.github.com>
This commit is contained in:
Chap
2024-11-04 19:22:22 +01:00
committed by GitHub
parent 66ed8f5026
commit 08b92591ee
8 changed files with 46 additions and 11 deletions
+3
View File
@@ -212,3 +212,6 @@
/// Sent from datum/spell/ethereal_jaunt/cast, before the mob enters jaunting as a pre-check: (mob/jaunter)
#define COMSIG_MOB_PRE_JAUNT "spell_mob_pre_jaunt"
#define COMPONENT_BLOCK_JAUNT (1<<0)
/// from remove_ventcrawler(): (mob/living/crawler)
#define COMSIG_LIVING_EXIT_VENTCRAWL "living_exit_ventcrawl"
@@ -263,7 +263,8 @@
if(QDELETED(V))
vents -= vent_uid
continue
if(V.on == FALSE && power == FALSE) // Don't bother if it's already off
continue
V.on = power
V.releasing = direction
V.external_pressure_bound = pressure
@@ -101,8 +101,8 @@ Pipelines + Other Objects -> Pipe network
plane = GAME_PLANE
layer = GAS_PIPE_VISIBLE_LAYER + layer_offset
/obj/machinery/atmospherics/proc/update_pipe_image()
pipe_image = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir) //the 20 puts it above Byond's darkness (not its opacity view)
/obj/machinery/atmospherics/proc/update_pipe_image(overlay = src)
pipe_image = image(overlay, loc, layer = ABOVE_HUD_LAYER, dir = dir) //the 20 puts it above Byond's darkness (not its opacity view)
pipe_image.plane = HUD_PLANE
/obj/machinery/atmospherics/proc/check_icon_cache()
@@ -322,6 +322,7 @@ Pipelines + Other Objects -> Pipe network
// Ventcrawling
#define VENT_SOUND_DELAY 30
/obj/machinery/atmospherics/relaymove(mob/living/user, direction)
var/datum/pipeline/current_pipenet = returnPipenet(src)
direction &= initialize_directions
if(!direction || !(direction in GLOB.cardinal)) //cant go this way.
return
@@ -332,6 +333,7 @@ Pipelines + Other Objects -> Pipe network
var/obj/machinery/atmospherics/target_move = findConnecting(direction)
if(target_move)
if(is_type_in_list(target_move, GLOB.ventcrawl_machinery) && target_move.can_crawl_through())
current_pipenet.crawlers -= user
user.remove_ventcrawl()
user.forceMove(target_move.loc) //handles entering and so on
user.visible_message("You hear something squeezing through the ducts.", "You climb out of the ventilation system.")
@@ -344,6 +346,7 @@ Pipelines + Other Objects -> Pipe network
playsound(src, 'sound/machines/ventcrawl.ogg', 50, TRUE, -3)
else
if((direction & initialize_directions) || is_type_in_list(src, GLOB.ventcrawl_machinery)) //if we move in a way the pipe can connect, but doesn't - or we're in a vent
current_pipenet.crawlers -= user
user.remove_ventcrawl()
user.forceMove(loc)
user.visible_message("You hear something squeezing through the pipes.", "You climb out of the ventilation system.")
@@ -50,6 +50,13 @@
build_network()
. = 1
/obj/machinery/atmospherics/unary/update_pipe_image()
. = ..()
if(parent)
for(var/mob/crawler in parent.crawlers)
var/mob/living/current_crawler = crawler
current_crawler.update_pipe_vision(src)
/obj/machinery/atmospherics/unary/build_network(remove_deferral = FALSE)
if(!parent)
parent = new /datum/pipeline()
@@ -88,8 +88,7 @@
vent_icon += "[on ? "[releasing ? "out" : "in"]" : "off"]"
. += GLOB.pipe_icon_manager.get_atmos_icon("device", state = vent_icon)
update_pipe_image()
update_pipe_image(.)
/obj/machinery/atmospherics/unary/vent_pump/update_underlays()
if(..())
@@ -83,7 +83,7 @@
scrubber_icon = "scrubberweld"
. += GLOB.pipe_icon_manager.get_atmos_icon("device", state = scrubber_icon)
update_pipe_image()
update_pipe_image(.)
/obj/machinery/atmospherics/unary/vent_scrubber/update_underlays()
if(..())
@@ -7,6 +7,8 @@
var/update = TRUE
var/list/crawlers = list()
/datum/pipeline/New()
SSair.pipenets += src
@@ -220,3 +222,12 @@
GL += C.portableConnectorReturnAir()
share_many_airs(GL)
/datum/pipeline/proc/add_ventcrawler(mob/living/crawler)
if(!(crawler in crawlers))
RegisterSignal(crawler, COMSIG_LIVING_EXIT_VENTCRAWL, PROC_REF(remove_ventcrawler), crawler)
crawlers += crawler
/datum/pipeline/proc/remove_ventcrawler(mob/living/crawler)
UnregisterSignal(crawler, COMSIG_LIVING_EXIT_VENTCRAWL)
crawlers -= crawler
+16 -5
View File
@@ -534,10 +534,15 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine, obj/machinery/atmospherics/target_move)
if(!istype(starting_machine) || !starting_machine.returnPipenet(target_move) || !starting_machine.can_see_pipes())
return
var/datum/pipeline/pipeline = starting_machine.returnPipenet(target_move)
var/datum/pipeline/pipenet = starting_machine.returnPipenet(target_move)
pipenet.add_ventcrawler(src)
add_ventcrawl_images(pipenet)
/mob/living/proc/add_ventcrawl_images(datum/pipeline/pipenet)
var/list/totalMembers = list()
totalMembers |= pipeline.members
totalMembers |= pipeline.other_atmosmch
totalMembers |= pipenet.members
totalMembers |= pipenet.other_atmosmch
for(var/obj/machinery/atmospherics/A in totalMembers)
if(!A.pipe_image)
A.update_pipe_image()
@@ -546,6 +551,10 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
client.images += A.pipe_image
/mob/living/proc/remove_ventcrawl()
SEND_SIGNAL(src, COMSIG_LIVING_EXIT_VENTCRAWL)
remove_ventcrawl_images()
/mob/living/proc/remove_ventcrawl_images()
if(client)
for(var/image/current_image in pipes_shown)
client.images -= current_image
@@ -567,8 +576,10 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
else
if(is_ventcrawling(src))
if(target_move)
remove_ventcrawl()
add_ventcrawl(loc, target_move)
remove_ventcrawl_images()
var/obj/machinery/atmospherics/current_pipe = loc
var/datum/pipeline/pipenet = current_pipe.returnPipenet(target_move)
add_ventcrawl_images(pipenet)
//Throwing stuff