Merge pull request #3019 from Citadel-Station-13/upstream-merge-31071

[MIRROR] Small refactor to movement
This commit is contained in:
LetterJay
2017-09-30 12:55:24 -04:00
committed by GitHub
2 changed files with 29 additions and 6 deletions
+26 -5
View File
@@ -225,6 +225,17 @@
A.CollidedWith(src)
/atom/movable/proc/forceMove(atom/destination)
. = FALSE
if(destination)
. = doMove(destination)
else
CRASH("No valid destination passed into forceMove")
/atom/movable/proc/moveToNullspace()
return doMove(null)
/atom/movable/proc/doMove(atom/destination)
. = FALSE
if(destination)
if(pulledby)
pulledby.stop_pulling()
@@ -251,8 +262,17 @@
AM.Crossed(src, oldloc)
Moved(oldloc, 0)
return 1
return 0
. = TRUE
//If no destination, move the atom into nullspace (don't do this unless you know what you're doing)
else
. = TRUE
var/atom/oldloc = loc
var/area/old_area = get_area(oldloc)
oldloc.Exited(src, null)
if(old_area)
old_area.Exited(src, null)
loc = null
/mob/living/forceMove(atom/destination)
stop_pulling()
@@ -261,9 +281,10 @@
if(has_buckled_mobs())
unbuckle_all_mobs(force=1)
. = ..()
if(client)
reset_perspective(destination)
update_canmove() //if the mob was asleep inside a container and then got forceMoved out we need to make them fall.
if(.)
if(client)
reset_perspective(destination)
update_canmove() //if the mob was asleep inside a container and then got forceMoved out we need to make them fall.
/mob/living/brain/forceMove(atom/destination)
if(container)
@@ -4,7 +4,9 @@
/mob/living/silicon/forceMove(atom/destination)
. = ..()
update_camera_location(destination)
//Only bother updating the camera if we actually managed to move
if(.)
update_camera_location(destination)
/mob/living/silicon/proc/do_camera_update(oldLoc)
if(!QDELETED(builtInCamera) && oldLoc != get_turf(src))