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

@@ -50,11 +50,9 @@
if(. && client)
client.update_skybox(old_z != get_z(src))
/mob/forceMove()
var/old_z = get_z(src)
/mob/Moved()
. = ..()
if(. && client)
client.update_skybox(old_z != get_z(src))
client?.update_skybox()
/mob/set_viewsize()
. = ..()

View File

@@ -25,6 +25,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
requires_power = 1
always_unpowered = 1
dynamic_lighting = 0
has_gravity = 0
power_light = 0
power_equip = 0
power_environ = 0

View File

@@ -136,15 +136,10 @@
return
/turf/space/Entered(var/atom/movable/A)
..()
if (!A || src != A.loc)
return
inertial_drift(A)
. = ..()
if(edge && ticker?.mode)
A.touch_map_edge()
A?.touch_map_edge()
/turf/space/proc/Sandbox_Spacemove(atom/movable/A as mob|obj)
var/cur_x

View File

@@ -142,17 +142,6 @@ turf/attackby(obj/item/weapon/W as obj, mob/user as mob)
sleep(2)
O.update_transform()
/turf/Entered(var/atom/movable/A, var/old_loc)
. = ..()
if(ismob(A))
var/mob/M = A
if(M.lastarea?.has_gravity == 0)
inertial_drift(M)
else if(!is_space())
M.inertia_dir = 0
M.make_floating(0)
/turf/CanPass(atom/movable/mover, turf/target)
if(!target)
return FALSE
@@ -221,22 +210,6 @@ turf/attackby(obj/item/weapon/W as obj, mob/user as mob)
/turf/proc/is_plating()
return 0
/turf/proc/inertial_drift(atom/movable/A as mob|obj)
if(!(A.last_move)) return
if((istype(A, /mob/) && src.x > 1 && src.x < (world.maxx) && src.y > 1 && src.y < (world.maxy)))
var/mob/M = A
if(M.Process_Spacemove(1))
M.inertia_dir = 0
return
spawn(5)
if((M && !(M.anchored) && !(M.pulledby) && (M.loc == src)))
if(M.inertia_dir)
step(M, M.inertia_dir)
return
M.inertia_dir = M.last_move
step(M, M.inertia_dir)
return
/turf/proc/levelupdate()
for(var/obj/O in src)
O.hide(O.hides_under_flooring() && !is_plating())

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