Improve shuttle parallax stopping

This commit is contained in:
Tayyyyyyy
2019-08-19 21:29:13 -07:00
parent bb4a653695
commit 4fa093fb2c
6 changed files with 16 additions and 30 deletions
+6 -3
View File
@@ -8,7 +8,6 @@
var/last_parallax_shift //world.time of last update
var/parallax_throttle = 0 //ds between updates
var/parallax_movedir = 0
var/new_parallax_movedir = 0
var/parallax_layers_max = 3
var/parallax_animate_timer
@@ -155,7 +154,11 @@
var/area/areaobj = posobj.loc
// Update the movement direction of the parallax if necessary (for shuttles)
set_parallax_movedir(C.new_parallax_movedir)
var/area/shuttle/SA = areaobj
if(!SA || !SA.moving)
set_parallax_movedir(0)
else
set_parallax_movedir(SA.parallax_movedir)
var/force
if(!C.previous_turf || (C.previous_turf.z != posobj.z))
@@ -204,7 +207,7 @@
if(L.offset_y < -240)
L.offset_y += 480
if(!areaobj.parallax_movedir && C.dont_animate_parallax <= world.time && (offset_x || offset_y) && abs(offset_x) <= max(C.parallax_throttle/world.tick_lag+1,1) && abs(offset_y) <= max(C.parallax_throttle/world.tick_lag+1,1) && (round(abs(change_x)) > 1 || round(abs(change_y)) > 1))
if(!(areaobj.parallax_movedir && areaobj.moving) && C.dont_animate_parallax <= world.time && (offset_x || offset_y) && abs(offset_x) <= max(C.parallax_throttle/world.tick_lag+1,1) && abs(offset_y) <= max(C.parallax_throttle/world.tick_lag+1,1) && (round(abs(change_x)) > 1 || round(abs(change_y)) > 1))
L.transform = matrix(1, 0, offset_x*L.speed, 0, 1, offset_y*L.speed)
animate(L, transform=matrix(), time = last_delay)
+2
View File
@@ -100,6 +100,7 @@ var/list/ghostteleportlocs = list()
requires_power = FALSE
valid_territory = FALSE
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
parallax_movedir = NORTH
/area/shuttle/arrival
name = "\improper Arrival Shuttle"
@@ -247,6 +248,7 @@ var/list/ghostteleportlocs = list()
/area/shuttle/specops
name = "\improper Special Ops Shuttle"
icon_state = "shuttlered"
parallax_movedir = EAST
/area/shuttle/specops/centcom
name = "\improper Special Ops Shuttle"
+1
View File
@@ -68,6 +68,7 @@
var/hide_attacklogs = FALSE // For areas such as thunderdome, lavaland syndiebase, etc which generate a lot of spammy attacklogs. Reduces log priority.
var/parallax_movedir = 0
var/moving = FALSE
/area/Initialize(mapload)
GLOB.all_areas += src
-6
View File
@@ -106,12 +106,6 @@
..()
if((!(A) || !(src in A.locs)))
return
if(ismob(A))
var/mob/M = A
if(M && M.client && M.client.new_parallax_movedir)
M.client.new_parallax_movedir = 0
M.update_parallax_contents()
if(destination_z && destination_x && destination_y)
A.forceMove(locate(destination_x, destination_y, destination_z))
+3 -10
View File
@@ -30,7 +30,7 @@
if(id_tag == "s_docking_airlock")
INVOKE_ASYNC(src, .proc/lock)
/mob/onShuttleMove(turf/oldT, turf/T1, rotation, travelDir)
/mob/onShuttleMove(turf/oldT, turf/T1, rotation)
if(!move_on_shuttle)
return 0
. = ..()
@@ -44,7 +44,6 @@
else
shake_camera(src, 7, 1)
client.new_parallax_movedir = travelDir ? WEST : NORTH
update_parallax_contents()
/mob/living/carbon/onShuttleMove()
@@ -59,14 +58,8 @@
if(smooth)
queue_smooth(src)
/mob/postDock(obj/docking_port/S1, transit, list/parallax_mobs)
if(!client)
return
if(transit)
parallax_mobs.Add(src)
return
client.new_parallax_movedir = 0
update_parallax_contents()
/mob/postDock()
update_parallax_contents()
/obj/machinery/door/airlock/postDock(obj/docking_port/stationary/S1)
. = ..()
+4 -11
View File
@@ -215,7 +215,6 @@
var/roundstart_move //id of port to send shuttle to at roundstart
var/travelDir = 0 //direction the shuttle would travel in
var/rebuildable = 0 //can build new shuttle consoles for this one
var/list/parallax_mobs = list() //mobs to unparallax
var/obj/docking_port/stationary/destination
var/obj/docking_port/stationary/previous
@@ -493,9 +492,10 @@
var/turf/simulated/Ts1 = T1
Ts1.copy_air_with_tile(T0)
areaInstance.moving = TRUE
//move mobile to new location
for(var/atom/movable/AM in T0)
AM.onShuttleMove(T0, T1, rotation, travelDir)
AM.onShuttleMove(T0, T1, rotation)
if(rotation)
T1.shuttleRotate(rotation)
@@ -513,19 +513,12 @@
T0.CalculateAdjacentTurfs()
SSair.add_to_active(T0,1)
areaInstance.moving = transit
for(var/A1 in L1)
var/turf/T1 = A1
T1.postDock(S1)
for(var/atom/movable/M in T1)
M.postDock(S1, transit, parallax_mobs)
// For mobs who move away from a transiting shuttle for whatever reason (teleportation, jumping, etc) so that they don't get stuck parallaxing
if(!transit)
for(var/mob/M in parallax_mobs)
if(M.client && M.client.new_parallax_movedir)
M.client.new_parallax_movedir = 0
M.update_parallax_contents()
parallax_mobs = list()
M.postDock(S1)
loc = S1.loc
dir = S1.dir