Ventcrawl Fixes (#916)

Fixes #897 
Fixes #898 
Fixes #899
This commit is contained in:
Bedshaped
2016-09-13 15:46:59 +03:00
committed by skull132
parent c749c18b93
commit d8b656742c
4 changed files with 42 additions and 10 deletions
@@ -55,6 +55,9 @@
if (stat == CONSCIOUS && prob(speak_chance*0.1))
squeak_soft(0)
if(is_ventcrawling == 0)
sight = SEE_SELF // Returns mouse sight to normal when they leave a vent
if (squeals < maxSqueals)
var/diff = world.time - last_squealgain
if (diff > 600)
+29 -8
View File
@@ -62,8 +62,8 @@ var/list/ventcrawl_machinery = list(
return 1
/obj/machinery/atmospherics/AltClick(mob/living/user)
if(is_type_in_list(src,ventcrawl_machinery) && user.can_ventcrawl())
user.handle_ventcrawl()
if(is_type_in_list(src, ventcrawl_machinery) && user.can_ventcrawl())
user.handle_ventcrawl(src)
return 1
return ..()
@@ -111,6 +111,21 @@ var/list/ventcrawl_machinery = list(
var/delayticks = size * 3
return delayticks >= 3 ? delayticks : 3
/mob/living/proc/vent_trap_check(var/status, var/atom/location)
switch (status)
if ("departing")
for (var/obj/item/device/assembly/mousetrap/S in location.loc)
if (prob(25))
visible_message("<span class='danger'>[src] gets caught in the mousetrap while trying to crawl into the vent!</span>", "<span class='danger'>You get caught in the mousetrap while trying to crawl into the vent!</span>")
S.Crossed(src) // Triggers mousetrap
forceMove(location.loc)
if ("arriving")
for (var/obj/item/device/assembly/mousetrap/S in location.loc)
if (prob(75))
S.Crossed(src) // Triggers mousetrap
else
return
/mob/living/var/ventcrawl_layer = 3
/mob/living/proc/handle_ventcrawl(var/atom/clicked_on)
@@ -120,12 +135,16 @@ var/list/ventcrawl_machinery = list(
var/obj/machinery/atmospherics/unary/vent_found
if(clicked_on && Adjacent(clicked_on))
vent_found = clicked_on
if(!istype(vent_found) || !vent_found.can_crawl_through())
vent_found = null
if(clicked_on)
if (Adjacent(clicked_on))
vent_found = clicked_on
if(!is_type_in_list(vent_found, ventcrawl_machinery) || !vent_found.can_crawl_through())
vent_found = null
else
src << "<span class='warning'>Stand next to the selected vent!</span>"
return
if(!vent_found)
if(!vent_found && isnull(clicked_on))
for(var/obj/machinery/atmospherics/machine in range(1,src))
if(is_type_in_list(machine, ventcrawl_machinery))
vent_found = machine
@@ -140,6 +159,8 @@ var/list/ventcrawl_machinery = list(
src << "<span class='warning'>You can't crawl into a welded vent!</span>"
return
vent_trap_check("departing", vent_found)
if(vent_found)
if(vent_found.network && (vent_found.network.normal_members.len || vent_found.network.line_members.len))
@@ -178,7 +199,7 @@ var/list/ventcrawl_machinery = list(
visible_message("<B>[src] scrambles into the ventilation ducts!</B>", "You climb into the ventilation system.")
forceMove(vent_found)
add_ventcrawl(vent_found)
add_ventcrawl(vent_found.node)
sight = (SEE_TURFS|BLIND)
else
@@ -32,12 +32,13 @@
if(target_move)
if(is_type_in_list(target_move, ventcrawl_machinery) && target_move.can_crawl_through())
if(istype(target_move, /obj/machinery/atmospherics/unary/vent_pump/) && target_move:is_welded())
user.visible_message("<span class='warning'You hear something banging on \the [target_move.name]!</span>", "<span class='notice'>You can't escape from a welded vent.</span>")
user.visible_message("<span class='warning'>You hear something banging on \the [target_move.name]!</span>", "<span class='notice'>You can't escape from a welded vent.</span>")
else
user.remove_ventcrawl()
user.forceMove(target_move.loc) //handles entering and so on
user.sight &= ~(SEE_TURFS|BLIND)
user.visible_message("<span class='warning'>You hear something squeezing through the ducts.</span>", "You climb out the ventilation system.")
user.vent_trap_check("arriving", target_move)
else if(target_move.can_crawl_through())
if(target_move.return_network(target_move) != return_network(src))
user.remove_ventcrawl()
@@ -51,7 +52,9 @@
if((direction & initialize_directions) || is_type_in_list(src, ventcrawl_machinery) && src.can_crawl_through()) //if we move in a way the pipe can connect, but doesn't - or we're in a vent
user.remove_ventcrawl()
user.forceMove(src.loc)
user.sight &= ~(SEE_TURFS|BLIND)
user.visible_message("<span class='warning'>You hear something squeezing through the pipes.</span>", "You climb out the ventilation system.")
user.vent_trap_check("arriving", target_move)
user.canmove = 0
spawn(1)
user.canmove = 1
@@ -68,6 +71,11 @@
/obj/machinery/atmospherics/proc/isConnectable(var/obj/machinery/atmospherics/target)
return (target == node1 || target == node2)
/obj/machinery/atmospherics/omni/isConnectable(var/obj/machinery/atmospherics/target)
for (var/datum/omni_port/P in ports)
if (P.node == target)
return P.node
/obj/machinery/atmospherics/pipe/manifold/isConnectable(var/obj/machinery/atmospherics/target)
return (target == node3 || ..())
+1 -1
View File
@@ -6,4 +6,4 @@
return
var/pipe = start_ventcrawl()
if(pipe)
handle_ventcrawl()
handle_ventcrawl(pipe)