Merge pull request #9296 from RemieRichards/VentcrawlingFixes

Ventcrawling Fixes
This commit is contained in:
Swag McYolosteinen
2015-05-14 12:25:11 +02:00
5 changed files with 36 additions and 28 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
if(ventcrawler)
src << "<span class='notice'>You can ventcrawl! Use alt+click on vents to quickly travel about the station.</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)
update_interface()
return .
+20 -15
View File
@@ -62,15 +62,20 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
src << "<span class='warning'>This ventilation duct is not connected to anything!</span>"
/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/unary/starting_machine)
if(!starting_machine)
/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine)
if(!istype(starting_machine) || !starting_machine.returnPipenet())
return
var/list/totalMembers = starting_machine.parent.members + starting_machine.parent.other_atmosmch
for(var/atom/A in totalMembers)
var/image/new_image = image(A, A.loc, dir = A.dir)
pipes_shown += new_image
var/list/totalMembers = list()
totalMembers |= starting_machine.parent.members
totalMembers |= starting_machine.parent.other_atmosmch
for(var/obj/machinery/atmospherics/A in totalMembers)
if(!A.pipe_vision_img)
A.pipe_vision_img = image(A, A.loc, layer = 20, dir = A.dir)
//20 for being above darkness
pipes_shown |= A.pipe_vision_img
if(client)
client.images += new_image
client.images |= A.pipe_vision_img
/mob/living/proc/remove_ventcrawl()
@@ -84,13 +89,13 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
//OOP
/atom/proc/update_pipe_vision()
/atom/proc/update_pipe_vision(var/atom/new_loc = null)
return
/mob/living/update_pipe_vision()
if(pipes_shown.len)
if(!istype(loc, /obj/machinery/atmospherics))
remove_ventcrawl()
else
if(istype(loc, /obj/machinery/atmospherics))
add_ventcrawl(loc)
/mob/living/update_pipe_vision(var/atom/new_loc = null)
. = loc
if(new_loc)
. = new_loc
remove_ventcrawl()
add_ventcrawl(.)