Refactor spacemoves

This commit is contained in:
Aronai Sieyes
2020-05-19 10:40:40 -04:00
parent 99db51885c
commit 1eb783a81a
6 changed files with 43 additions and 48 deletions

View File

@@ -774,19 +774,18 @@ default behaviour is:
handle_footstep(loc)
if(pulling) // we were pulling a thing and didn't lose it during our move.
var/pull_dir = get_dir(src, pulling)
if(pulling.anchored || !isturf(pulling.loc))
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
else 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 it is too far away or across z-levels from old location, stop pulling.
if(get_dist(pulling.loc, oldloc) > 1 || pulling.loc.z != oldloc?.z)
stop_pulling()
return
// living might take damage from drags
if(isliving(pulling))
else if(isliving(pulling))
var/mob/living/M = pulling
M.dragged(src, oldloc)
@@ -794,6 +793,35 @@ default behaviour is:
if(pulling && get_dist(src, pulling) > 1) // the pullee couldn't keep up
stop_pulling()
if(!isturf(loc))
return
else if(lastarea?.has_gravity == 0)
inertial_drift()
//VOREStation Edit Start
else if(flying)
inertial_drift()
make_floating(1)
//VOREStation Edit End
else if(!isspace(loc))
inertia_dir = 0
make_floating(0)
/mob/living/proc/inertial_drift()
if(x > 1 && x < (world.maxx) && y > 1 && y < (world.maxy))
if(Process_Spacemove(1))
inertia_dir = 0
return
var/locthen = loc
spawn(5)
if(!anchored && !pulledby && loc == locthen)
var/stepdir = inertia_dir ? inertia_dir : last_move
if(!stepdir)
return
var/turf/T = get_step(src, stepdir)
if(!T)
return
Move(T, stepdir, 5)
/mob/living/proc/handle_footstep(turf/T)
return FALSE

View File

@@ -388,9 +388,9 @@
//Check to see if we slipped
if(prob(Process_Spaceslipping(5)) && !buckled)
to_chat(src, "<font color='blue'><B>You slipped!</B></font>")
src.inertia_dir = src.last_move
step(src, src.inertia_dir)
to_chat(src, "<span class='notice'><B>You slipped!</B></span>")
inertia_dir = last_move
step(src, src.inertia_dir) // Not using Move for smooth glide here because this is a 'slip' so should be sudden.
return 0
//If not then we can reset inertia and move
inertia_dir = 0
@@ -402,7 +402,7 @@
var/shoegrip
for(var/turf/turf in oview(1,src))
if(istype(turf,/turf/space))
if(isspace(turf))
continue
if(istype(turf,/turf/simulated/floor)) // Floors don't count if they don't have gravity