Improve Open Turf Traversal (#2337)

Aims to improve open turf traversal and interaction by doing two things:

If a mob is wearing magboots and has enabled magboots, they are now unable to walk onto an open turf. This includes open space turfs. It makes magboots useful again for miners, on the asteroid!
If a mob is wearing a jetpack with jetpack stabilization enabled (and the jetpack active), they can walk onto the open turf but will not fall down. They can now also, simply by having the jetpack active, move upwards. Keeping stabilization off in this stage will allow them to pop-up and down if they want, leading to hilarity.
Touches mob/proc/Check_Shoegrip() and makes it more useful + more used.
This commit is contained in:
skull132
2017-05-21 03:07:41 +03:00
committed by GitHub
parent c6b643a472
commit a498a8988c
8 changed files with 102 additions and 22 deletions
+49 -1
View File
@@ -34,7 +34,7 @@
return 0
var/area/area = get_area(src)
if(direction == UP && area.has_gravity)
if(direction == UP && area.has_gravity && !usr.CanAvoidGravity())
to_chat(usr, "<span class='warning'>Gravity stops you from moving upward.</span>")
return 0
@@ -66,6 +66,35 @@
else
to_chat(usr, "<span class='notice'>There is nothing of interest in this direction.</span>")
/**
* @brief Used to determine whether or not a given mob can override gravity when
* attempting to Z-move UP.
*
* Returns FALSE in standard mob cases. Exists for carbon/human and other child overrides.
*
* @return TRUE if the mob can Z-move up despite gravity.
* FALSE otherwise.
*/
/mob/proc/CanAvoidGravity()
return FALSE
/mob/living/carbon/human/CanAvoidGravity()
if (!restrained())
var/obj/item/weapon/tank/jetpack/thrust = GetJetpack(src)
if (thrust && !lying && thrust.allow_thrust(0.01, src))
return TRUE
return ..()
/mob/living/silicon/robot/CanAvoidGravity()
var/obj/item/weapon/tank/jetpack/thrust = GetJetpack(src)
if (thrust && thrust.allow_thrust(0.02, src))
return TRUE
return ..()
/mob/proc/can_ztravel()
return 0
@@ -155,6 +184,25 @@
if((locate(/obj/structure/disposalpipe/up) in below) || locate(/obj/machinery/atmospherics/pipe/zpipe/up in below))
return FALSE
/mob/living/carbon/human/can_fall()
// Special condition for jetpack mounted folk!
if (!restrained())
var/obj/item/weapon/tank/jetpack/thrust = GetJetpack(src)
if (thrust && thrust.stabilization_on &&\
!lying && thrust.allow_thrust(0.01, src))
return FALSE
return ..()
/mob/living/silicon/robot/can_fall()
var/obj/item/weapon/tank/jetpack/thrust = GetJetpack(src)
if (thrust && thrust.stabilization_on && thrust.allow_thrust(0.02, src))
return FALSE
return ..()
/atom/movable/proc/handle_fall(var/turf/landing)
Move(landing)
if(locate(/obj/structure/stairs) in landing)
+12 -1
View File
@@ -29,6 +29,17 @@
var/tmp/depth
// An override of turf/Enter() to make it so that magboots allow you to stop
// falling off the damned rock.
/turf/simulated/open/Enter(mob/living/carbon/human/mover, atom/oldloc)
if (istype(mover) && isturf(oldloc) && !istype(oldloc, /turf/simulated/open))
if (mover.Check_Shoegrip(FALSE))
to_chat(mover,span("notice",
"You are stopped from falling off the edge by \the [mover.shoes] you're wearing!"))
return 0
return ..()
/turf/simulated/open/proc/is_above_space()
var/turf/T = GetBelow(src)
while (T && T.is_hole)
@@ -49,7 +60,7 @@
if (istype(above))
above.update()
above = null
below = null
return ..()