mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 04:57:12 +01:00
@@ -613,31 +613,13 @@
|
||||
if(restrained() || HAS_TRAIT(src, TRAIT_CANNOT_PULL))
|
||||
stop_pulling()
|
||||
|
||||
var/turf/old_loc = loc
|
||||
. = ..()
|
||||
if(.)
|
||||
step_count++
|
||||
pull_pulled(old_loc, pullee, glide_size_override)
|
||||
|
||||
if(s_active && !(s_active in contents) && get_turf(s_active) != get_turf(src)) //check !( s_active in contents) first so we hopefully don't have to call get_turf() so much.
|
||||
s_active.close(src)
|
||||
|
||||
/mob/living/proc/pull_pulled(turf/dest, atom/movable/pullee, glide_size_override)
|
||||
if(pulling && pulling == pullee) // we were pulling a thing and didn't lose it during our move.
|
||||
if(pulling.anchored)
|
||||
stop_pulling()
|
||||
return
|
||||
|
||||
var/pull_dir = get_dir(src, pulling)
|
||||
if(get_dist(src, pulling) > 1 || (moving_diagonally != SECOND_DIAG_STEP && ((pull_dir - 1) & pull_dir))) // puller and pullee more than one tile away or in diagonal position
|
||||
if(isliving(pulling))
|
||||
var/mob/living/M = pulling
|
||||
if(IS_HORIZONTAL(M) && !M.buckled && (prob(M.getBruteLoss() * 200 / M.maxHealth))) // So once you reach 50 brute damage you hit 100% chance to leave a blood trail for every tile you're pulled
|
||||
M.makeTrail(dest)
|
||||
pulling.Move(dest, get_dir(pulling, dest), glide_size_override) // the pullee tries to reach our previous position
|
||||
if(pulling && get_dist(src, pulling) > 1) // the pullee couldn't keep up
|
||||
stop_pulling()
|
||||
|
||||
/mob/living/proc/makeTrail(turf/turf_to_trail_on)
|
||||
if(!has_gravity(src))
|
||||
return
|
||||
|
||||
@@ -142,8 +142,16 @@
|
||||
if(!isalienhunter(mob)) // i hate grab code
|
||||
add_delay += 7
|
||||
|
||||
var/new_glide_size = DELAY_TO_GLIDE_SIZE(add_delay * ((NSCOMPONENT(direct) && EWCOMPONENT(direct)) ? sqrt(2) : 1))
|
||||
mob.set_glide_size(new_glide_size) // set it now in case of pulled objects
|
||||
var/diagonal_factor = 1
|
||||
if(IS_DIR_DIAGONAL(direct))
|
||||
// For some reason, LONG_GLIDE mobs need to slow down here, but other mobs need to speed up.
|
||||
// I'd expect one or the other to change, not both.
|
||||
// If you can figure out why, please update this comment.
|
||||
if(mob.appearance_flags & LONG_GLIDE)
|
||||
diagonal_factor = sqrt(2)
|
||||
else
|
||||
diagonal_factor = 1 / sqrt(2)
|
||||
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay * diagonal_factor)) // set it now in case of pulled objects
|
||||
|
||||
//If the move was recent, count using old_move_delay
|
||||
//We want fractional behavior and all
|
||||
@@ -179,22 +187,28 @@
|
||||
|
||||
. = ..()
|
||||
|
||||
var/new_glide_size = 0
|
||||
// Only adjust for diagonal movement if the move was *actually* diagonal
|
||||
if(mob.loc == new_loc)
|
||||
// Similar to the glide size calculation above, LONG_GLIDE mobs need to slow down and other mobs speed up.
|
||||
// Unline before, we also want to calculate the new movement delay, which is increased for LONG_GLIDE mobs, and unchanged for other mobs.
|
||||
mob.last_movement = world.time
|
||||
if(IS_DIR_DIAGONAL(direct))
|
||||
// only incur the extra delay if the move was *actually* diagonal
|
||||
// There would be a bit of visual jank if we try to walk diagonally next to a wall
|
||||
// and the move ends up being cardinal, rather than diagonal,
|
||||
// but that's better than it being jank on every *successful* diagonal move.
|
||||
if(IS_DIR_DIAGONAL(direct) && (mob.appearance_flags & LONG_GLIDE))
|
||||
add_delay *= sqrt(2)
|
||||
|
||||
var/after_glide = 0
|
||||
if(visual_delay)
|
||||
after_glide = visual_delay
|
||||
else
|
||||
after_glide = DELAY_TO_GLIDE_SIZE(add_delay)
|
||||
if(visual_delay)
|
||||
new_glide_size = visual_delay
|
||||
else
|
||||
new_glide_size = DELAY_TO_GLIDE_SIZE(add_delay)
|
||||
|
||||
mob.set_glide_size(after_glide)
|
||||
if(IS_DIR_DIAGONAL(direct) && !(mob.appearance_flags & LONG_GLIDE))
|
||||
new_glide_size *= sqrt(2)
|
||||
|
||||
mob.set_glide_size(new_glide_size)
|
||||
else if(visual_delay)
|
||||
mob.set_glide_size(visual_delay)
|
||||
else
|
||||
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay))
|
||||
|
||||
move_delay += add_delay
|
||||
|
||||
|
||||
Reference in New Issue
Block a user