mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 09:35:30 +01:00
Jaunting no longer allows you to end up inside a wall (#59520)
Jaunting now keeps track of the last five non-blocked tiles you moved across while in the jaunt. Upon exit, it will attempt to deposit you into the last unblocked tile. Should it run out of tiles to try, you will be returned to your starting location. As such, jaunting mobs can no longer end up inside walls or dense objects. Tables, and anything else with the climbable element, are still allowed. Added support to /turf/proc/is_blocked_turf() to allow ignoring climbable atoms. Added the TRAIT_CLIMBABLE trait, applied by the climbable element, to accomplish the above.
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
var/jaunt_in_type = /obj/effect/temp_visual/wizard
|
||||
/// Visual for exiting the jaunt
|
||||
var/jaunt_out_type = /obj/effect/temp_visual/wizard/out
|
||||
/// List of valid exit points
|
||||
var/list/exit_point_list
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/cast_check(skipcharge = 0,mob/user = usr)
|
||||
. = ..()
|
||||
@@ -51,11 +53,28 @@
|
||||
ADD_TRAIT(target, TRAIT_IMMOBILIZED, type)
|
||||
sleep(jaunt_out_time)
|
||||
REMOVE_TRAIT(target, TRAIT_IMMOBILIZED, type)
|
||||
var/turf/exit_point = get_turf(holder) //Hopefully this gets updated, otherwise this is our fallback
|
||||
LAZYINITLIST(exit_point_list)
|
||||
RegisterSignal(holder, COMSIG_MOVABLE_MOVED, .proc/update_exit_point, target)
|
||||
sleep(jaunt_duration)
|
||||
|
||||
UnregisterSignal(holder, COMSIG_MOVABLE_MOVED)
|
||||
if(target.loc != holder) //mob warped out of the warp
|
||||
qdel(holder)
|
||||
return
|
||||
|
||||
var/found_exit = FALSE
|
||||
for(var/turf/possible_exit as anything in exit_point_list)
|
||||
if(possible_exit.is_blocked_turf_ignore_climbable())
|
||||
continue
|
||||
exit_point = possible_exit
|
||||
found_exit = TRUE
|
||||
break
|
||||
if(!found_exit)
|
||||
to_chat(target, "<span='danger'>Unable to find an unobstructed space, you find yourself ripped back to where you started.</span>")
|
||||
exit_point_list.Cut()
|
||||
holder.forceMove(exit_point)
|
||||
|
||||
mobloc = get_turf(target.loc)
|
||||
jaunt_steam(mobloc)
|
||||
ADD_TRAIT(target, TRAIT_IMMOBILIZED, type)
|
||||
@@ -75,6 +94,23 @@
|
||||
break
|
||||
REMOVE_TRAIT(target, TRAIT_IMMOBILIZED, type)
|
||||
|
||||
/**
|
||||
* Updates the exit point of the jaunt
|
||||
*
|
||||
* Called when the jaunting mob holder moves, this updates the backup exit-jaunt
|
||||
* location, in case the jaunt ends with the mob still in a wall. Five
|
||||
* spots are kept in the list, in case the last few changed since we passed
|
||||
* by (doors closing, engineers building walls, etc)
|
||||
*/
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/proc/update_exit_point(mob/living/target)
|
||||
SIGNAL_HANDLER
|
||||
var/turf/location = get_turf(target)
|
||||
if(location.is_blocked_turf_ignore_climbable())
|
||||
return
|
||||
exit_point_list.Insert(1, location)
|
||||
if(length(exit_point_list) >= 5)
|
||||
exit_point_list.Cut(5)
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/proc/jaunt_steam(mobloc)
|
||||
var/datum/effect_system/steam_spread/steam = new /datum/effect_system/steam_spread()
|
||||
steam.set_up(10, 0, mobloc)
|
||||
|
||||
Reference in New Issue
Block a user