Ensures update_pipe_vision is called only when you switch pipenets. Fixes lag caused by ventcrawlers (#19620)

* Ensures update_pipe_vision is called only when you switch pipenets

* Comments baby
This commit is contained in:
Farie82
2022-11-06 13:25:55 +01:00
committed by GitHub
parent eb54090eeb
commit 118f5708da
5 changed files with 15 additions and 4 deletions
@@ -157,6 +157,13 @@ Pipelines + Other Objects -> Pipe network
/obj/machinery/atmospherics/proc/returnPipenet()
return
/**
* Whether or not this atmos machine has multiple pipenets attached to it
* Used to determine if a ventcrawler should update their vision or not
*/
/obj/machinery/atmospherics/proc/is_pipenet_split()
return FALSE
/obj/machinery/atmospherics/proc/returnPipenetAir()
return
@@ -317,7 +324,7 @@ Pipelines + Other Objects -> Pipe network
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.")
else if(target_move.can_crawl_through())
if(returnPipenet(target_move) != target_move.returnPipenet())
if(is_pipenet_split()) // Going away from a split means we want to update the view of the pipenet
user.update_pipe_vision(target_move)
user.forceMove(target_move)
if(world.time - user.last_played_vent > VENT_SOUND_DELAY)
@@ -128,6 +128,9 @@
else if(A == node2)
return parent2
/obj/machinery/atmospherics/binary/is_pipenet_split()
return TRUE
/obj/machinery/atmospherics/binary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
if(Old == parent1)
parent1 = New
@@ -181,6 +181,9 @@
else if(A == node3)
return parent3
/obj/machinery/atmospherics/trinary/is_pipenet_split()
return FALSE
/obj/machinery/atmospherics/trinary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
if(Old == parent1)
parent1 = New
@@ -39,8 +39,6 @@
parent = null
/obj/machinery/atmospherics/pipe/returnPipenet(obj/machinery/atmospherics/A)
if(A)
return // It's called by a moving mob that's already in the pipenet
return parent
/obj/machinery/atmospherics/pipe/detailed_examine()
+1 -1
View File
@@ -19,6 +19,6 @@
ranged_ability.add_ranged_ability(src, "<span class='notice'>You currently have <b>[ranged_ability]</b> active!</span>")
//Should update regardless of if we can ventcrawl, since we can end up in pipes in other ways.
update_pipe_vision()
update_pipe_vision(loc)
return .