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)
|
if(old_z != new_z)
|
||||||
client?.update_skybox(TRUE)
|
client?.update_skybox(TRUE)
|
||||||
|
|
||||||
/mob/doMove()
|
/mob/Moved()
|
||||||
if((. = ..()))
|
. = ..()
|
||||||
client?.update_skybox()
|
client?.update_skybox()
|
||||||
|
|
||||||
/mob/set_viewsize()
|
/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
|
requires_power = 1
|
||||||
always_unpowered = 1
|
always_unpowered = 1
|
||||||
dynamic_lighting = 0
|
dynamic_lighting = 0
|
||||||
|
has_gravity = 0
|
||||||
power_light = 0
|
power_light = 0
|
||||||
power_equip = 0
|
power_equip = 0
|
||||||
power_environ = 0
|
power_environ = 0
|
||||||
|
|||||||
@@ -134,15 +134,10 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
/turf/space/Entered(var/atom/movable/A)
|
/turf/space/Entered(var/atom/movable/A)
|
||||||
..()
|
. = ..()
|
||||||
|
|
||||||
if (!A || src != A.loc)
|
|
||||||
return
|
|
||||||
|
|
||||||
inertial_drift(A)
|
|
||||||
|
|
||||||
if(edge && ticker?.mode)
|
if(edge && ticker?.mode)
|
||||||
A.touch_map_edge()
|
A?.touch_map_edge()
|
||||||
|
|
||||||
/turf/space/proc/Sandbox_Spacemove(atom/movable/A as mob|obj)
|
/turf/space/proc/Sandbox_Spacemove(atom/movable/A as mob|obj)
|
||||||
var/cur_x
|
var/cur_x
|
||||||
|
|||||||
@@ -142,20 +142,6 @@ turf/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|||||||
sleep(2)
|
sleep(2)
|
||||||
O.update_transform()
|
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)
|
/turf/CanPass(atom/movable/mover, turf/target)
|
||||||
if(!target)
|
if(!target)
|
||||||
return FALSE
|
return FALSE
|
||||||
@@ -224,22 +210,6 @@ turf/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|||||||
/turf/proc/is_plating()
|
/turf/proc/is_plating()
|
||||||
return 0
|
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()
|
/turf/proc/levelupdate()
|
||||||
for(var/obj/O in src)
|
for(var/obj/O in src)
|
||||||
O.hide(O.hides_under_flooring() && !is_plating())
|
O.hide(O.hides_under_flooring() && !is_plating())
|
||||||
|
|||||||
@@ -826,19 +826,18 @@ default behaviour is:
|
|||||||
handle_footstep(loc)
|
handle_footstep(loc)
|
||||||
|
|
||||||
if(pulling) // we were pulling a thing and didn't lose it during our move.
|
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))
|
if(pulling.anchored || !isturf(pulling.loc))
|
||||||
stop_pulling()
|
stop_pulling()
|
||||||
return
|
|
||||||
|
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
|
||||||
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 it is too far away or across z-levels from old location, stop pulling.
|
// 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)
|
if(get_dist(pulling.loc, oldloc) > 1 || pulling.loc.z != oldloc?.z)
|
||||||
stop_pulling()
|
stop_pulling()
|
||||||
return
|
|
||||||
|
|
||||||
// living might take damage from drags
|
// living might take damage from drags
|
||||||
if(isliving(pulling))
|
else if(isliving(pulling))
|
||||||
var/mob/living/M = pulling
|
var/mob/living/M = pulling
|
||||||
M.dragged(src, oldloc)
|
M.dragged(src, oldloc)
|
||||||
|
|
||||||
@@ -846,6 +845,35 @@ default behaviour is:
|
|||||||
if(pulling && get_dist(src, pulling) > 1) // the pullee couldn't keep up
|
if(pulling && get_dist(src, pulling) > 1) // the pullee couldn't keep up
|
||||||
stop_pulling()
|
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)
|
/mob/living/proc/handle_footstep(turf/T)
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|||||||
@@ -391,9 +391,9 @@
|
|||||||
|
|
||||||
//Check to see if we slipped
|
//Check to see if we slipped
|
||||||
if(prob(Process_Spaceslipping(5)) && !buckled)
|
if(prob(Process_Spaceslipping(5)) && !buckled)
|
||||||
to_chat(src, "<font color='blue'><B>You slipped!</B></font>")
|
to_chat(src, "<span class='notice'><B>You slipped!</B></span>")
|
||||||
src.inertia_dir = src.last_move
|
inertia_dir = last_move
|
||||||
step(src, src.inertia_dir)
|
step(src, src.inertia_dir) // Not using Move for smooth glide here because this is a 'slip' so should be sudden.
|
||||||
return 0
|
return 0
|
||||||
//If not then we can reset inertia and move
|
//If not then we can reset inertia and move
|
||||||
inertia_dir = 0
|
inertia_dir = 0
|
||||||
@@ -405,7 +405,7 @@
|
|||||||
var/shoegrip
|
var/shoegrip
|
||||||
|
|
||||||
for(var/turf/turf in oview(1,src))
|
for(var/turf/turf in oview(1,src))
|
||||||
if(istype(turf,/turf/space))
|
if(isspace(turf))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if(istype(turf,/turf/simulated/floor)) // Floors don't count if they don't have gravity
|
if(istype(turf,/turf/simulated/floor)) // Floors don't count if they don't have gravity
|
||||||
|
|||||||
Reference in New Issue
Block a user