Shuttle refactor (#2171)

Rewrites the area movement code used by shuttles & elevators in an effort to make it faster, more extensible, and generally easier to read. Also fixes some bugs relating to lighting & moving areas, such as lighting overlays suddenly being teleported into space for absolutely no reason.

Fixes #2161.
Fixes #2166.
This commit is contained in:
Lohikar
2017-05-05 10:16:53 +03:00
committed by skull132
parent a14654b197
commit 52a4f3a4e3
14 changed files with 204 additions and 292 deletions
+2 -16
View File
@@ -80,7 +80,7 @@
//just moves the shuttle from A to B, if it can be moved
//A note to anyone overriding move in a subtype. move() must absolutely not, under any circumstances, fail to move the shuttle.
//If you want to conditionally cancel shuttle launches, that logic must go in short_jump() or long_jump()
/datum/shuttle/proc/move(var/area/origin, var/area/destination, var/direction=null)
/datum/shuttle/proc/move(var/area/origin, var/area/destination)
//world << "move_shuttle() called for [shuttle_tag] leaving [origin] en route to [destination]."
@@ -115,7 +115,7 @@
for(var/mob/living/simple_animal/pest in destination)
pest.gib()
origin.move_contents_to(destination, direction=direction)
origin.move_contents_to(destination)
for(var/mob/M in destination)
if(M.client)
@@ -130,20 +130,6 @@
if(!M.buckled)
M.Weaken(3)
// Power-related checks. If shuttle contains power related machinery, update powernets.
var/update_power = 0
for(var/obj/machinery/power/P in destination)
update_power = 1
break
for(var/obj/structure/cable/C in destination)
update_power = 1
break
if(update_power)
makepowernets()
return
//returns 1 if the shuttle has a valid arrive time
/datum/shuttle/proc/has_arrive_time()
return (moving_status == SHUTTLE_INTRANSIT)