mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 07:57:50 +00:00
* Pref code refactor * Empty database reference * Unit testing SQLite * Everything else * Disable unit testing. * Equivalent * more robust unit tests
73 lines
3.3 KiB
Plaintext
73 lines
3.3 KiB
Plaintext
/obj/machinery/atmospherics/pipe/zpipe/up/verb/ventcrawl_move_up()
|
|
set name = "Ventcrawl Upwards"
|
|
set desc = "Climb up through a pipe."
|
|
set category = "Abilities"
|
|
set src = usr.loc
|
|
var/obj/machinery/atmospherics/target = check_ventcrawl(GetAbove(loc))
|
|
if(target)
|
|
ventcrawl_to(usr, target, UP)
|
|
|
|
/obj/machinery/atmospherics/pipe/zpipe/down/verb/ventcrawl_move_down()
|
|
set name = "Ventcrawl Downwards"
|
|
set desc = "Climb down through a pipe."
|
|
set category = "Abilities"
|
|
set src = usr.loc
|
|
var/obj/machinery/atmospherics/target = check_ventcrawl(GetBelow(loc))
|
|
if(target)
|
|
ventcrawl_to(usr, target, DOWN)
|
|
|
|
/obj/machinery/atmospherics/pipe/zpipe/proc/check_ventcrawl(var/turf/target)
|
|
if(!istype(target))
|
|
return
|
|
if(node1 in target)
|
|
return node1
|
|
if(node2 in target)
|
|
return node2
|
|
return
|
|
|
|
|
|
//We used the relaymove in atmospherics.dm to handle this previously, but it was similar so now that calls this
|
|
/obj/machinery/atmospherics/proc/ventcrawl_to(var/mob/living/user, var/obj/machinery/atmospherics/target_move, var/direction)
|
|
if(target_move)
|
|
if(is_type_in_list(target_move, ventcrawl_machinery) && target_move.can_crawl_through())
|
|
if(user.special_delayer.blocked())
|
|
return
|
|
user.delayNextSpecial(10)
|
|
user.visible_message("Something is squeezing through the ducts...", "You start crawling out the ventilation system.")
|
|
target_move.shake(2, 3)
|
|
spawn(0)
|
|
if(do_after(user, target_move, 10))
|
|
user.remove_ventcrawl()
|
|
user.forceMove(target_move.loc) //handles entering and so on
|
|
user.visible_message("You hear something squeeze through the ducts.", "You climb out the ventilation system.")
|
|
else if(target_move.can_crawl_through())
|
|
if(istype(target_move,/obj/machinery/atmospherics/unary/cap/bluespace)) //if the target is a bluespace pipe cap, teleport to the next cap in bspipe_list
|
|
var/obj/machinery/atmospherics/unary/cap/bluespace/bscap = target_move
|
|
var/list_len = bspipe_list.len
|
|
var/starting_index = bspipe_list.Find(bscap)
|
|
if(bscap.network)
|
|
for(var/i=0 to list_len-2)
|
|
var/pointer = ((i + starting_index) % list_len)+1
|
|
if(bscap.network == bspipe_list[pointer].network)
|
|
target_move = bspipe_list[pointer]
|
|
break
|
|
if(target_move.return_network(target_move) != return_network(src))
|
|
user.remove_ventcrawl()
|
|
user.add_ventcrawl(target_move)
|
|
if (user.client.prefs.get_pref(/datum/preference_setting/toggle/stumble) && ((world.time - user.last_movement) > 5))
|
|
user.delayNextMove(3) //if set, delays the second step when a mob starts moving to attempt to make precise high ping movement easier
|
|
user.forceMove(target_move)
|
|
user.client.eye = target_move //if we don't do this, Byond only updates the eye every tick - required for smooth movement
|
|
user.last_movement=world.time
|
|
if(world.time - user.last_played_vent > VENT_SOUND_DELAY)
|
|
user.last_played_vent = world.time
|
|
playsound(src, 'sound/machines/ventcrawl.ogg', 50, 1, -3)
|
|
else
|
|
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, glide_size_override = DELAY2GLIDESIZE(1))
|
|
user.visible_message("You hear something squeezing through the pipes.", "You climb out the ventilation system.")
|
|
user.canmove = 0
|
|
spawn(1)
|
|
user.canmove = 1
|