mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Refactor spacemoves
This commit is contained in:
@@ -49,9 +49,9 @@
|
||||
if(old_z != new_z)
|
||||
client?.update_skybox(TRUE)
|
||||
|
||||
/mob/doMove()
|
||||
if((. = ..()))
|
||||
client?.update_skybox()
|
||||
/mob/Moved()
|
||||
. = ..()
|
||||
client?.update_skybox()
|
||||
|
||||
/mob/set_viewsize()
|
||||
. = ..()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -134,15 +134,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
|
||||
|
||||
@@ -142,20 +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)
|
||||
if(M.flying) //VORESTATION Edit Start. This overwrites the above is_space without touching it all that much.
|
||||
inertial_drift(M)
|
||||
M.make_floating(1) //VOREStation Edit End.
|
||||
else if(!is_space())
|
||||
M.inertia_dir = 0
|
||||
M.make_floating(0)
|
||||
|
||||
/turf/CanPass(atom/movable/mover, turf/target)
|
||||
if(!target)
|
||||
return FALSE
|
||||
@@ -224,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())
|
||||
|
||||
@@ -826,19 +826,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)
|
||||
|
||||
@@ -846,6 +845,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
|
||||
|
||||
@@ -391,9 +391,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
|
||||
@@ -405,7 +405,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
|
||||
|
||||
Reference in New Issue
Block a user