Refactor move code

This commit is contained in:
Aronai Sieyes
2020-04-26 16:42:50 -04:00
parent 5874df8756
commit d3da6ae4a5
45 changed files with 359 additions and 429 deletions
@@ -145,7 +145,7 @@
bound_height = width * world.icon_size
update_state()
Move()
Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
if(dir in list(EAST, WEST))
bound_width = width * world.icon_size
-9
View File
@@ -230,15 +230,6 @@ GLOBAL_LIST_BOILERPLATE(all_janitorial_carts, /obj/structure/janitorialcart)
to_chat(user, "<span class='notice'>You'll need the keys in one of your hands to drive this [callme].</span>")
/obj/structure/bed/chair/janicart/Move()
..()
if(has_buckled_mobs())
for(var/A in buckled_mobs)
var/mob/living/L = A
if(L.buckled == src)
L.loc = loc
/obj/structure/bed/chair/janicart/post_buckle_mob(mob/living/M)
update_mob()
return ..()
@@ -286,15 +286,10 @@
held = null
/obj/structure/bed/roller/Move()
..()
/obj/structure/bed/roller/Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
playsound(src, 'sound/effects/roll.ogg', 100, 1)
if(has_buckled_mobs())
for(var/A in buckled_mobs)
var/mob/living/L = A
if(L.buckled == src)
L.loc = src.loc
/obj/structure/bed/roller/post_buckle_mob(mob/living/M as mob)
if(M.buckled == src)
@@ -140,22 +140,24 @@
return
..()
/obj/structure/bed/chair/office/Move()
..()
/obj/structure/bed/chair/office/Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
playsound(src, 'sound/effects/roll.ogg', 100, 1)
if(has_buckled_mobs())
for(var/A in buckled_mobs)
var/mob/living/occupant = A
occupant.buckled = null
occupant.Move(src.loc)
occupant.buckled = src
if (occupant && (src.loc != occupant.loc))
if (propelled)
for (var/mob/O in src.loc)
if (O != occupant)
Bump(O)
else
unbuckle_mob()
/obj/structure/bed/chair/office/handle_buckled_mob_movement(atom/new_loc, direction)
for(var/A in buckled_mobs)
var/mob/living/occupant = A
occupant.buckled = null
occupant.Move(src.loc)
occupant.buckled = src
if (occupant && (src.loc != occupant.loc))
if (propelled)
for (var/mob/O in src.loc)
if (O != occupant)
Bump(O)
else
unbuckle_mob()
/obj/structure/bed/chair/office/Bump(atom/A)
..()
@@ -91,8 +91,9 @@
create_track()
driving = 0
/obj/structure/bed/chair/wheelchair/Move()
..()
/obj/structure/bed/chair/wheelchair/Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
cut_overlays()
playsound(src, 'sound/effects/roll.ogg', 75, 1)
if(has_buckled_mobs())
+3 -3
View File
@@ -8,11 +8,11 @@
w_class = ITEMSIZE_HUGE
var/obj/item/target/pinned_target // the current pinned target
Move()
..()
Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
// Move the pinned target along with the stake
if(pinned_target in view(3, src))
pinned_target.loc = loc
pinned_target.forceMove(loc)
else // Sanity check: if the pinned target can't be found in immediate view
pinned_target = null
+1 -1
View File
@@ -413,7 +413,7 @@
/obj/structure/window/Move()
var/ini_dir = dir
update_nearby_tiles(need_rebuild=1)
..()
. = ..()
set_dir(ini_dir)
update_nearby_tiles(need_rebuild=1)