From d3da6ae4a52edca57538147ac39e3a81255421cb Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Sun, 26 Apr 2020 16:42:50 -0400 Subject: [PATCH] Refactor move code --- code/datums/helper_datums/teleport.dm | 3 - code/game/atoms_movable.dm | 226 ++++++++++-------- code/game/gamemodes/meteor/meteors.dm | 13 +- code/game/machinery/CableLayer.dm | 6 +- code/game/machinery/computer/camera.dm | 19 +- code/game/machinery/doors/door.dm | 3 +- code/game/machinery/doors/multi_tile.dm | 2 +- code/game/machinery/floorlayer.dm | 6 +- code/game/machinery/machinery_power.dm | 24 +- code/game/machinery/pipe/construction.dm | 6 - code/game/machinery/pipe/pipelayer.dm | 10 +- code/game/mecha/mecha.dm | 6 +- code/game/objects/buckling.dm | 22 +- code/game/objects/effects/effect_system.dm | 17 +- .../objects/effects/explosion_particles.dm | 4 - code/game/objects/items/shooting_range.dm | 6 +- code/game/objects/items/weapons/weaponry.dm | 12 - code/game/objects/structures/door_assembly.dm | 2 +- code/game/objects/structures/janicart.dm | 9 - .../structures/stool_bed_chair_nest/bed.dm | 11 +- .../structures/stool_bed_chair_nest/chairs.dm | 32 +-- .../stool_bed_chair_nest/wheelchair.dm | 5 +- code/game/objects/structures/target_stake.dm | 6 +- code/game/objects/structures/window.dm | 2 +- code/modules/assembly/holder.dm | 4 +- code/modules/assembly/infrared.dm | 5 +- code/modules/assembly/proximity.dm | 4 +- code/modules/lighting/lighting_atom.dm | 19 +- code/modules/media/media_machinery.dm | 5 +- code/modules/mob/dead/observer/observer.dm | 5 +- .../mob/freelook/ai/update_triggers.dm | 40 ++-- .../mob/freelook/mask/update_triggers.dm | 21 +- code/modules/mob/living/carbon/carbon.dm | 13 +- .../living/silicon/robot/robot_movement.dm | 92 +++---- .../subtypes/animal/farm animals/goat.dm | 4 +- .../simple_mob/subtypes/animal/space/worm.dm | 30 +-- code/modules/mob/mob_movement.dm | 18 +- code/modules/multiz/zshadow.dm | 2 +- .../overmap/disperser/disperser_charge.dm | 6 +- code/modules/overmap/events/overmap_event.dm | 15 +- .../particle_accelerator.dm | 6 +- code/modules/projectiles/projectile.dm | 13 +- code/modules/vehicles/quad.dm | 21 +- code/modules/vehicles/train.dm | 9 +- .../xenoarcheaology/artifacts/artifact.dm | 4 +- 45 files changed, 359 insertions(+), 429 deletions(-) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index 684505aa57c..65576a52a72 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -98,7 +98,6 @@ var/turf/destturf var/turf/curturf = get_turf(teleatom) - var/area/destarea = get_area(destination) if(precision) var/list/posturfs = circlerangeturfs(destination,precision) destturf = safepick(posturfs) @@ -125,8 +124,6 @@ if(C) C.forceMove(destturf) - destarea.Entered(teleatom) - return 1 /datum/teleport/proc/teleport() diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 4323cb974f9..b711274be62 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -7,7 +7,6 @@ var/moving_diagonally var/move_speed = 10 var/l_move_time = 1 - var/m_flag = 1 var/throwing = 0 var/thrower var/turf/throw_source = null @@ -65,71 +64,80 @@ return ..() //////////////////////////////////////// -// Here's where we rewrite how byond handles movement except slightly different -// To be removed on step_ conversion -// All this work to prevent a second bump -/atom/movable/Move(atom/newloc, direct=0) - . = FALSE - if(!newloc || newloc == loc) - return - - if(!direct) - direct = get_dir(src, newloc) - set_dir(direct) - - if(!loc.Exit(src, newloc)) - return - - if(!newloc.Enter(src, src.loc)) - return - - if(!check_multi_tile_move_density_dir(direct, locs)) // We're big, and we can't move that way. - return - - // Past this is the point of no return - if(!locs || locs.len <= 1) // We're not a multi-tile object. - var/atom/oldloc = loc - var/area/oldarea = get_area(oldloc) - var/area/newarea = get_area(newloc) - loc = newloc - . = TRUE - oldloc.Exited(src, newloc) - if(oldarea != newarea) - oldarea.Exited(src, newloc) - - for(var/i in oldloc) - if(i == src) // Multi tile objects - continue - var/atom/movable/thing = i - thing.Uncrossed(src) - - newloc.Entered(src, oldloc) - if(oldarea != newarea) - newarea.Entered(src, oldloc) - - for(var/i in loc) - if(i == src) // Multi tile objects - continue - var/atom/movable/thing = i - thing.Crossed(src) - - else if(newloc) // We're a multi-tile object. - . = doMove(newloc) - -// -//////////////////////////////////////// - /atom/movable/Move(atom/newloc, direct = 0) + // Didn't pass enough info if(!loc || !newloc) return FALSE + + // Store this early before we might move, it's used several places var/atom/oldloc = loc + // If we're not moving to the same spot (why? does that even happen?) if(loc != newloc) if(!direct) direct = get_dir(oldloc, newloc) - if (!(direct & (direct - 1))) //Cardinal move - . = ..() - else //Diagonal move, split it into cardinal moves + if (IS_CARDINAL(direct)) //Cardinal move + // Track our failure if any in this value + . = TRUE + + // Face the direction of movement + set_dir(direct) + + // Check to make sure we can leave + if(!loc.Exit(src, newloc)) + . = FALSE + + // Check to make sure we can enter, if we haven't already failed + if(. && !newloc.Enter(src, src.loc)) + . = FALSE + + // Check to make sure if we're multi-tile we can move, if we haven't already failed + if(. && !check_multi_tile_move_density_dir(direct, locs)) + . = FALSE + + // Definitely moving if you enter this, no failures so far + if(. && locs.len <= 1) // We're not a multi-tile object. + var/area/oldarea = get_area(oldloc) + var/area/newarea = get_area(newloc) + var/old_z = get_z(oldloc) + var/dest_z = get_z(newloc) + + // Do The Move + loc = newloc + . = TRUE + + // So objects can be informed of z-level changes + if (old_z != dest_z) + onTransitZ(old_z, dest_z) + + // We don't call parent so we are calling this for byond + oldloc.Exited(src, newloc) + if(oldarea != newarea) + oldarea.Exited(src, newloc) + + // Multi-tile objects can't reach here, otherwise you'd need to avoid uncrossing yourself + for(var/i in oldloc) + var/atom/movable/thing = i + // We don't call parent so we are calling this for byond + thing.Uncrossed(src) + + // We don't call parent so we are calling this for byond + newloc.Entered(src, oldloc) + if(oldarea != newarea) + newarea.Entered(src, oldloc) + + // Multi-tile objects can't reach here, otherwise you'd need to avoid uncrossing yourself + for(var/i in loc) + var/atom/movable/thing = i + // We don't call parent so we are calling this for byond + thing.Crossed(src) + + // We're a multi-tile object (multiple locs) + else if(. && newloc) + . = doMove(newloc) + + //Diagonal move, split it into cardinal moves + else moving_diagonally = FIRST_DIAG_STEP var/first_step_dir // The `&& moving_diagonally` checks are so that a forceMove taking @@ -174,32 +182,32 @@ first_step_dir = WEST moving_diagonally = SECOND_DIAG_STEP . = step(src, SOUTH) - if(moving_diagonally == SECOND_DIAG_STEP) - if(!.) - set_dir(first_step_dir) - //else if (!inertia_moving) - // inertia_next_move = world.time + inertia_move_delay - // newtonian_move(direct) + // If we failed, turn to face the direction of the first step at least + if(!. && moving_diagonally == SECOND_DIAG_STEP) + set_dir(first_step_dir) + // Done, regardless! moving_diagonally = 0 + // We return because step above will call Move() and we don't want to do shenanigans back in here again return - if(!loc || (loc == oldloc && oldloc != newloc)) + else if(!loc || (loc == oldloc)) last_move = 0 return + // If we moved, call Moved() on ourselves if(.) - Moved(oldloc, direct) + Moved(oldloc, direct, FALSE) - //Polaris stuff + // Update timers/cooldown stuff move_speed = world.time - l_move_time l_move_time = world.time - m_flag = 1 - //End + last_move = direct // The direction you last moved + // set_dir(direct) //Don't think this is necessary - last_move = direct - set_dir(direct) - if(. && has_buckled_mobs() && !handle_buckled_mob_movement(loc,direct)) //movement failed due to buckled mob(s) - return FALSE + // Handle any buckled mobs on this movable + if(has_buckled_mobs()) + handle_buckled_mob_movement(oldloc,direct) + //VOREStation Add else if(. && riding_datum) riding_datum.handle_vehicle_layer() @@ -207,19 +215,12 @@ //VOREStation Add End //Called after a successful Move(). By this point, we've already moved -/atom/movable/proc/Moved(atom/OldLoc, Dir, Forced = FALSE) - //if (!inertia_moving) - // inertia_next_move = world.time + inertia_move_delay - // newtonian_move(Dir) - //if (length(client_mobs_in_contents)) - // update_parallax_contents() - +/atom/movable/proc/Moved(atom/old_loc, direction, forced = FALSE) return TRUE // Make sure you know what you're doing if you call this, this is intended to only be called by byond directly. // You probably want CanPass() /atom/movable/Cross(atom/movable/AM) - . = TRUE return CanPass(AM, loc) /atom/movable/CanPass(atom/movable/mover, turf/target) @@ -261,56 +262,87 @@ return doMove(null) /atom/movable/proc/doMove(atom/destination) - . = FALSE + var/atom/oldloc = loc + var/area/old_area = get_area(oldloc) + var/same_loc = oldloc == destination + if(destination) - var/atom/oldloc = loc - var/same_loc = oldloc == destination - var/area/old_area = get_area(oldloc) var/area/destarea = get_area(destination) + // Do The Move + last_move = 0 loc = destination + + // Unset this in case it was set in some other proc. We're no longer moving diagonally for sure. moving_diagonally = 0 + // We are moving to a different loc if(!same_loc) + // Not moving out of nullspace if(oldloc) oldloc.Exited(src, destination) + // If it's not the same area, Exited() it if(old_area && old_area != destarea) old_area.Exited(src, destination) - for(var/atom/movable/AM in oldloc) + + // Uncross everything where we left + for(var/i in oldloc) + var/atom/movable/AM = i + if(AM == src) + continue AM.Uncrossed(src) + + // Information about turf and z-levels for source and dest collected var/turf/oldturf = get_turf(oldloc) var/turf/destturf = get_turf(destination) var/old_z = (oldturf ? oldturf.z : null) var/dest_z = (destturf ? destturf.z : null) + + // So objects can be informed of z-level changes if (old_z != dest_z) onTransitZ(old_z, dest_z) + + // Destination atom Entered destination.Entered(src, oldloc) + + // Entered() the new area if it's not the same area if(destarea && old_area != destarea) destarea.Entered(src, oldloc) - for(var/atom/movable/AM in destination) + // We ignore ourselves because if we're multi-tile we might be in both old and new locs + for(var/i in destination) + var/atom/movable/AM = i if(AM == src) continue AM.Crossed(src, oldloc) + // Call our thingy to inform everyone we moved + Moved(oldloc, NONE, TRUE) + // Break pulling if we are too far to pull now. if(pulledby && (pulledby.z != src.z || get_dist(pulledby, src) > 1)) pulledby.stop_pulling() - Moved(oldloc, NONE, TRUE) - . = TRUE + // We moved + return TRUE //If no destination, move the atom into nullspace (don't do this unless you know what you're doing) - else - . = TRUE - if (loc) - var/atom/oldloc = loc - var/area/old_area = get_area(oldloc) - oldloc.Exited(src, null) - if(old_area) - old_area.Exited(src, null) + else if(oldloc) loc = null + // Uncross everything where we left (no multitile safety like above because we are definitely not still there) + for(var/i in oldloc) + var/atom/movable/AM = i + AM.Uncrossed(src) + + // Exited() our loc and area + oldloc.Exited(src, null) + if(old_area) + old_area.Exited(src, null) + + // We moved + return TRUE + /atom/movable/proc/onTransitZ(old_z,new_z) GLOB.z_moved_event.raise_event(src, old_z, new_z) for(var/item in src) // Notify contents of Z-transition. This can be overridden IF we know the items contents do not care. diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 020ab54f0ec..0b0b8d014c7 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -138,14 +138,13 @@ . = ..() //process movement... - if(.)//.. if did move, ram the turf we get in - var/turf/T = get_turf(loc) - ram_turf(T) +/obj/effect/meteor/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() + var/turf/T = get_turf(loc) + ram_turf(T) - if(prob(10) && !istype(T, /turf/space))//randomly takes a 'hit' from ramming - get_hit() - - return . + if(prob(10) && !istype(T, /turf/space)) //randomly takes a 'hit' from ramming + get_hit() /obj/effect/meteor/Destroy() walk(src,0) //this cancels the walk_towards() proc diff --git a/code/game/machinery/CableLayer.dm b/code/game/machinery/CableLayer.dm index aa6316033c0..c8991f79e8d 100644 --- a/code/game/machinery/CableLayer.dm +++ b/code/game/machinery/CableLayer.dm @@ -13,9 +13,9 @@ cable.amount = 100 ..() -/obj/machinery/cablelayer/Move(new_turf,M_Dir) - ..() - layCable(new_turf,M_Dir) +/obj/machinery/cablelayer/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() + layCable(loc,direction) /obj/machinery/cablelayer/attack_hand(mob/user as mob) if(!cable&&!on) diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 10eb6bda85c..fe0a9c8a628 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -119,6 +119,12 @@ check_eye(user) return 1 +/obj/machinery/computer/security/relaymove(mob/user,direct) + var/turf/T = get_turf(current_camera) + for(var/i; i < 10; i++) + T = get_step(T, direct) + jump_on_click(user, T) + //Camera control: moving. /obj/machinery/computer/security/proc/jump_on_click(var/mob/user,var/A) if(user.machine != src) @@ -185,22 +191,15 @@ update_use_power(USE_POWER_IDLE) //Camera control: mouse. +/* Oh my god /atom/DblClick() ..() if(istype(usr.machine,/obj/machinery/computer/security)) var/obj/machinery/computer/security/console = usr.machine console.jump_on_click(usr,src) -//Camera control: arrow keys. -/mob/Move(n,direct) - if(istype(machine,/obj/machinery/computer/security)) - var/obj/machinery/computer/security/console = machine - var/turf/T = get_turf(console.current_camera) - for(var/i;i<10;i++) - T = get_step(T,direct) - console.jump_on_click(src,T) - return - return ..(n,direct) +*/ +//Camera control: arrow keys. /obj/machinery/computer/security/telescreen name = "Telescreen" desc = "Used for watching an empty arena." diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index bf60a7dc1cf..49a1b6fc26b 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -490,8 +490,7 @@ else source.thermal_conductivity = initial(source.thermal_conductivity) -/obj/machinery/door/Move(new_loc, new_dir) - //update_nearby_tiles() +/obj/machinery/door/Moved(atom/old_loc, direction, forced = FALSE) . = ..() if(width > 1) if(dir in list(EAST, WEST)) diff --git a/code/game/machinery/doors/multi_tile.dm b/code/game/machinery/doors/multi_tile.dm index 608e02b9a08..f05419cb6d0 100644 --- a/code/game/machinery/doors/multi_tile.dm +++ b/code/game/machinery/doors/multi_tile.dm @@ -16,7 +16,7 @@ QDEL_NULL(filler2) return ..() -/obj/machinery/door/airlock/multi_tile/Move() +/obj/machinery/door/airlock/multi_tile/Moved(atom/old_loc, direction, forced = FALSE) . = ..() SetBounds() diff --git a/code/game/machinery/floorlayer.dm b/code/game/machinery/floorlayer.dm index e7f39ade5f7..2b25b445c98 100644 --- a/code/game/machinery/floorlayer.dm +++ b/code/game/machinery/floorlayer.dm @@ -12,8 +12,8 @@ T = new/obj/item/stack/tile/floor(src) ..() -/obj/machinery/floorlayer/Move(new_turf,M_Dir) - ..() +/obj/machinery/floorlayer/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() if(on) if(mode["dismantle"]) @@ -26,7 +26,7 @@ CollectTiles(old_turf) - old_turf = new_turf + old_turf = loc /obj/machinery/floorlayer/attack_hand(mob/user as mob) on=!on diff --git a/code/game/machinery/machinery_power.dm b/code/game/machinery/machinery_power.dm index a052ee01ceb..aa3d301e530 100644 --- a/code/game/machinery/machinery_power.dm +++ b/code/game/machinery/machinery_power.dm @@ -88,23 +88,13 @@ // Registering moved_event observers for all machines is too expensive. Instead we do it ourselves. // 99% of machines are always on a turf anyway, very few need recursive move handling. -/obj/machinery/Move() - var/old_loc = loc - if((. = ..())) - update_power_on_move(src, old_loc, loc) - if(ismovable(loc)) // Register for recursive movement (if the thing we're inside moves) - GLOB.moved_event.register(loc, src, .proc/update_power_on_move) - if(ismovable(old_loc)) // Unregister recursive movement. - GLOB.moved_event.unregister(old_loc, src, .proc/update_power_on_move) - -/obj/machinery/forceMove(atom/destination) - var/old_loc = loc - if((. = ..())) - update_power_on_move(src, old_loc, loc) - if(ismovable(loc)) // Register for recursive movement (if the thing we're inside moves) - GLOB.moved_event.register(loc, src, .proc/update_power_on_move) - if(ismovable(old_loc)) // Unregister recursive movement. - GLOB.moved_event.unregister(old_loc, src, .proc/update_power_on_move) +/obj/machinery/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() + update_power_on_move(src, old_loc, loc) + if(ismovable(loc)) // Register for recursive movement (if the thing we're inside moves) + GLOB.moved_event.register(loc, src, .proc/update_power_on_move) + if(ismovable(old_loc)) // Unregister recursive movement. + GLOB.moved_event.unregister(old_loc, src, .proc/update_power_on_move) /obj/machinery/proc/update_power_on_move(atom/movable/mover, atom/old_loc, atom/new_loc) var/area/old_area = get_area(old_loc) diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 13b1dc1bb75..f5f25320800 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -132,12 +132,6 @@ Buildable meters src.set_dir(turn(src.dir, 270)) fixdir() -// If you want to disable pipe dir changing when pulled, uncomment this -// /obj/item/pipe/Move() -// var/old_dir = dir -// . = ..() -// set_dir(old_dir) //pipes changing direction when moved is just annoying and buggy - // Don't let pulling a pipe straighten it out. /obj/item/pipe/binary/bendable/Move() var/old_bent = !IS_CARDINAL(dir) diff --git a/code/game/machinery/pipe/pipelayer.dm b/code/game/machinery/pipe/pipelayer.dm index 366a351d6b2..fa58f6a3fc1 100644 --- a/code/game/machinery/pipe/pipelayer.dm +++ b/code/game/machinery/pipe/pipelayer.dm @@ -42,15 +42,15 @@ ..() // Whenever we move, if enabled try and lay pipe -/obj/machinery/pipelayer/Move(new_turf,M_Dir) - ..() +/obj/machinery/pipelayer/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() if(on && a_dis) dismantleFloor(old_turf) - layPipe(old_turf, M_Dir, old_dir) + layPipe(old_turf, direction, old_dir) - old_turf = new_turf - old_dir = turn(M_Dir, 180) + old_turf = loc + old_dir = turn(direction, 180) /obj/machinery/pipelayer/attack_hand(mob/user as mob) if(..()) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 1e4f4dc8ae6..78b22a13e04 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -382,11 +382,9 @@ //////// Movement procs //////// ////////////////////////////////// -/obj/mecha/Move() +/obj/mecha/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(.) - MoveAction() - return + MoveAction() /obj/mecha/proc/MoveAction() //Allows mech equipment to do an action once the mech moves if(!equipment.len) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index cc1e327478b..7d1319ab85c 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -176,19 +176,15 @@ add_fingerprint(user) return M -/atom/movable/proc/handle_buckled_mob_movement(newloc,direct) - if(has_buckled_mobs()) - for(var/A in buckled_mobs) - var/mob/living/L = A -// if(!L.Move(newloc, direct)) - if(!L.forceMove(newloc, direct)) - loc = L.loc - last_move = L.last_move - L.inertia_dir = last_move - return FALSE - else - L.set_dir(dir) - return TRUE +/atom/movable/proc/handle_buckled_mob_movement(atom/old_loc, direct) + for(var/A in buckled_mobs) + var/mob/living/L = A + L.forceMove(loc, direct) + L.last_move = last_move + L.inertia_dir = last_move + + if(!buckle_dir) + L.set_dir(dir) /atom/movable/proc/can_buckle_check(mob/living/M, forced = FALSE) if(!buckled_mobs) diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 00896e71073..b872f9b3d3b 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -113,12 +113,11 @@ steam.start() -- spawns the effect T.hotspot_expose(1000,100) return ..() -/obj/effect/effect/sparks/Move() - ..() - var/turf/T = src.loc - if (istype(T, /turf)) +/obj/effect/effect/sparks/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() + if(isturf(loc)) + var/turf/T = loc T.hotspot_expose(1000,100) - return /datum/effect/effect/system/spark_spread var/total_sparks = 0 // To stop it being spammed and lagging! @@ -225,8 +224,8 @@ steam.start() -- spawns the effect time_to_live = 600 //var/list/projectiles -/obj/effect/effect/smoke/bad/Move() - ..() +/obj/effect/effect/smoke/bad/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() for(var/mob/living/L in get_turf(src)) affect(L) @@ -281,8 +280,8 @@ steam.start() -- spawns the effect STOP_PROCESSING(SSobj, src) return ..() -/obj/effect/effect/smoke/elemental/Move() - ..() +/obj/effect/effect/smoke/elemental/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() for(var/mob/living/L in range(1, src)) affect(L) diff --git a/code/game/objects/effects/explosion_particles.dm b/code/game/objects/effects/explosion_particles.dm index 63b2a09c240..12a1e920201 100644 --- a/code/game/objects/effects/explosion_particles.dm +++ b/code/game/objects/effects/explosion_particles.dm @@ -12,10 +12,6 @@ qdel(src) return -/obj/effect/expl_particles/Move() - ..() - return - /datum/effect/system/expl_particles var/number = 10 var/turf/location diff --git a/code/game/objects/items/shooting_range.dm b/code/game/objects/items/shooting_range.dm index c3bc83d3b9d..982236f43c3 100644 --- a/code/game/objects/items/shooting_range.dm +++ b/code/game/objects/items/shooting_range.dm @@ -18,12 +18,12 @@ break ..() // delete target - Move() - ..() + Moved(atom/old_loc, direction, forced = FALSE) + . = ..() // After target moves, check for nearby stakes. If associated, move to target for(var/obj/structure/target_stake/M in view(3,src)) if(M.density == 0 && M.pinned_target == src) - M.loc = loc + M.forceMove(loc) // This may seem a little counter-intuitive but I assure you that's for a purpose. // Stakes are the ones that carry targets, yes, but in the stake code we set diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm index ff982da2570..e856dd280ed 100644 --- a/code/game/objects/items/weapons/weaponry.dm +++ b/code/game/objects/items/weapons/weaponry.dm @@ -122,18 +122,6 @@ if(!has_buckled_mobs()) qdel(src) -/obj/effect/energy_net/Move() - ..() - if(has_buckled_mobs()) - for(var/A in buckled_mobs) - var/mob/living/occupant = A - occupant.buckled = null - occupant.forceMove(src.loc) - occupant.buckled = src - if (occupant && (src.loc != occupant.loc)) - unbuckle_mob(occupant) - qdel(src) - /obj/effect/energy_net/user_unbuckle_mob(mob/living/buckled_mob, mob/user) user.setClickCooldown(user.get_attack_speed()) visible_message("[user] begins to tear at \the [src]!") diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index f8ea5d2f77c..e0a94e285b3 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -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 diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 93c48fe8a90..cb8fcfe02be 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -230,15 +230,6 @@ GLOBAL_LIST_BOILERPLATE(all_janitorial_carts, /obj/structure/janitorialcart) to_chat(user, "You'll need the keys in one of your hands to drive this [callme].") -/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 ..() diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index 1a9d4e7315f..b053e33805f 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -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) diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index 5be1d6d1984..59ea0014d30 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -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) ..() diff --git a/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm b/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm index 8a3902fa1d1..639020ba5df 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm @@ -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()) diff --git a/code/game/objects/structures/target_stake.dm b/code/game/objects/structures/target_stake.dm index 55d8b37d0ff..1e9c091ccb9 100644 --- a/code/game/objects/structures/target_stake.dm +++ b/code/game/objects/structures/target_stake.dm @@ -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 diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index d8542d0c96f..f3b6d1e08ed 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -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) diff --git a/code/modules/assembly/holder.dm b/code/modules/assembly/holder.dm index 3806bd60ba7..75b335154e1 100644 --- a/code/modules/assembly/holder.dm +++ b/code/modules/assembly/holder.dm @@ -84,8 +84,8 @@ if(a_right) a_right.on_found(finder) -/obj/item/device/assembly_holder/Move() - ..() +/obj/item/device/assembly_holder/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() if(a_left && a_right) a_left.holder_movement() a_right.holder_movement() diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index 2f10a91fdab..b34b2c0c118 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -79,8 +79,11 @@ /obj/item/device/assembly/infra/Move() var/t = dir - ..() + . = ..() set_dir(t) + +/obj/item/device/assembly/infra/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() QDEL_LIST_NULL(i_beams) /obj/item/device/assembly/infra/holder_movement() diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index a93bda48099..c439163fc22 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -88,8 +88,8 @@ var/obj/item/weapon/grenade/chem_grenade/grenade = holder.loc grenade.primed(scanning) -/obj/item/device/assembly/prox_sensor/Move() - ..() +/obj/item/device/assembly/prox_sensor/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() sense() /obj/item/device/assembly/prox_sensor/interact(mob/user as mob)//TODO: Change this to the wires thingy diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index 8700a65c6ec..39894b13947 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -65,20 +65,19 @@ T.reconsider_lights() return ..() -/atom/movable/Move() - var/turf/old_loc = loc +/atom/movable/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(loc != old_loc) - for(var/datum/light_source/L in light_sources) - L.source_atom.update_light() + for(var/datum/light_source/L in light_sources) + L.source_atom.update_light() - var/turf/new_loc = loc - if(istype(old_loc) && opacity) - old_loc.reconsider_lights() + var/turf/new_turf = loc + var/turf/old_turf = old_loc + if(istype(old_turf) && opacity) + old_turf.reconsider_lights() - if(istype(new_loc) && opacity) - new_loc.reconsider_lights() + if(istype(new_turf) && opacity) + new_turf.reconsider_lights() /atom/proc/set_opacity(new_opacity) if(new_opacity == opacity) diff --git a/code/modules/media/media_machinery.dm b/code/modules/media/media_machinery.dm index 02d4d9698d9..728cffd234e 100644 --- a/code/modules/media/media_machinery.dm +++ b/code/modules/media/media_machinery.dm @@ -54,13 +54,14 @@ master_area = null /obj/machinery/media/Move() - ..() + disconnect_media_source() + . = ..() if(anchored) update_music() /obj/machinery/media/forceMove(var/atom/destination) disconnect_media_source() - ..() + . = ..() if(anchored) update_music() diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index fb2af265273..e20d3740c9e 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -377,10 +377,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp following = null return ..() -/mob/Move() +/mob/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(.) - update_following() + update_following() /mob/Life() // to catch teleports etc which directly set loc diff --git a/code/modules/mob/freelook/ai/update_triggers.dm b/code/modules/mob/freelook/ai/update_triggers.dm index 5c21c6784da..c0b4adf0f61 100644 --- a/code/modules/mob/freelook/ai/update_triggers.dm +++ b/code/modules/mob/freelook/ai/update_triggers.dm @@ -6,30 +6,28 @@ // This might be laggy, comment it out if there are problems. /mob/living/silicon/var/updating = 0 -/mob/living/silicon/robot/Move() - var/oldLoc = src.loc +/mob/living/silicon/robot/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(.) - if(provides_camera_vision()) - if(!updating) - updating = 1 - spawn(BORG_CAMERA_BUFFER) - if(oldLoc != src.loc) - cameranet.updatePortableCamera(src.camera) - updating = 0 + if(!provides_camera_vision()) + return + if(!updating) + updating = 1 + spawn(BORG_CAMERA_BUFFER) + if(old_loc != src.loc) + cameranet.updatePortableCamera(src.camera) + updating = 0 -/mob/living/silicon/AI/Move() - var/oldLoc = src.loc +/mob/living/silicon/ai/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(.) - if(provides_camera_vision()) - if(!updating) - updating = 1 - spawn(BORG_CAMERA_BUFFER) - if(oldLoc != src.loc) - cameranet.updateVisibility(oldLoc, 0) - cameranet.updateVisibility(loc, 0) - updating = 0 + if(!provides_camera_vision()) + return + if(!updating) + updating = 1 + spawn(BORG_CAMERA_BUFFER) + if(old_loc != src.loc) + cameranet.updateVisibility(old_loc, 0) + cameranet.updateVisibility(loc, 0) + updating = 0 #undef BORG_CAMERA_BUFFER diff --git a/code/modules/mob/freelook/mask/update_triggers.dm b/code/modules/mob/freelook/mask/update_triggers.dm index 1dd520e7f1d..8008916220c 100644 --- a/code/modules/mob/freelook/mask/update_triggers.dm +++ b/code/modules/mob/freelook/mask/update_triggers.dm @@ -4,18 +4,17 @@ /mob/living/var/updating_cult_vision = 0 -/mob/living/Move() - var/oldLoc = src.loc +/mob/living/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(.) - if(cultnet.provides_vision(src)) - if(!updating_cult_vision) - updating_cult_vision = 1 - spawn(CULT_UPDATE_BUFFER) - if(oldLoc != src.loc) - cultnet.updateVisibility(oldLoc, 0) - cultnet.updateVisibility(loc, 0) - updating_cult_vision = 0 + if(!cultnet.provides_vision(src)) + return + if(!updating_cult_vision) + updating_cult_vision = 1 + spawn(CULT_UPDATE_BUFFER) + if(old_loc != src.loc) + cultnet.updateVisibility(old_loc, 0) + cultnet.updateVisibility(loc, 0) + updating_cult_vision = 0 #undef CULT_UPDATE_BUFFER diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index ddfca59db9f..36eb20a0a7e 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -33,15 +33,14 @@ touching.clear_reagents() ..() -/mob/living/carbon/Move(NewLoc, direct) +/mob/living/carbon/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(.) - if(src.nutrition && src.stat != 2) + if(src.nutrition && src.stat != 2) + src.nutrition -= DEFAULT_HUNGER_FACTOR/10 + if(src.m_intent == "run") src.nutrition -= DEFAULT_HUNGER_FACTOR/10 - if(src.m_intent == "run") - src.nutrition -= DEFAULT_HUNGER_FACTOR/10 - if((FAT in src.mutations) && src.m_intent == "run" && src.bodytemperature <= 360) - src.bodytemperature += 2 + if((FAT in src.mutations) && src.m_intent == "run" && src.bodytemperature <= 360) + src.bodytemperature += 2 // Moving around increases germ_level faster if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8)) diff --git a/code/modules/mob/living/silicon/robot/robot_movement.dm b/code/modules/mob/living/silicon/robot/robot_movement.dm index 858741988e1..b83b7bfee92 100644 --- a/code/modules/mob/living/silicon/robot/robot_movement.dm +++ b/code/modules/mob/living/silicon/robot/robot_movement.dm @@ -33,52 +33,52 @@ if (cell_use_power(A.active_usage)) return ..() -/mob/living/silicon/robot/Move(a, b, flag) - +/mob/living/silicon/robot/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(module) - if(module.type == /obj/item/weapon/robot_module/robot/janitor) - var/turf/tile = loc - if(isturf(tile)) - tile.clean_blood() - if (istype(tile, /turf/simulated)) - var/turf/simulated/S = tile - S.dirt = 0 - for(var/A in tile) - if(istype(A, /obj/effect)) - if(istype(A, /obj/effect/rune) || istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/overlay)) - qdel(A) - else if(istype(A, /obj/item)) - var/obj/item/cleaned_item = A - cleaned_item.clean_blood() - else if(istype(A, /mob/living/carbon/human)) - var/mob/living/carbon/human/cleaned_human = A - if(cleaned_human.lying) - if(cleaned_human.head) - cleaned_human.head.clean_blood() - cleaned_human.update_inv_head(0) - if(cleaned_human.wear_suit) - cleaned_human.wear_suit.clean_blood() - cleaned_human.update_inv_wear_suit(0) - else if(cleaned_human.w_uniform) - cleaned_human.w_uniform.clean_blood() - cleaned_human.update_inv_w_uniform(0) - if(cleaned_human.shoes) - cleaned_human.shoes.clean_blood() - cleaned_human.update_inv_shoes(0) - cleaned_human.clean_blood(1) - cleaned_human << "[src] cleans your face!" + if(!module) + return - if((module_state_1 && istype(module_state_1, /obj/item/weapon/storage/bag/ore)) || (module_state_2 && istype(module_state_2, /obj/item/weapon/storage/bag/ore)) || (module_state_3 && istype(module_state_3, /obj/item/weapon/storage/bag/ore))) //Borgs and drones can use their mining bags ~automagically~ if they're deployed in a slot. Only mining bags, as they're optimized for mass use. - var/obj/item/weapon/storage/bag/ore/B = null - if(istype(module_state_1, /obj/item/weapon/storage/bag/ore)) //First orebag has priority, if they for some reason have multiple. - B = module_state_1 - else if(istype(module_state_2, /obj/item/weapon/storage/bag/ore)) - B = module_state_2 - else if(istype(module_state_3, /obj/item/weapon/storage/bag/ore)) - B = module_state_3 - var/turf/tile = loc - if(isturf(tile)) - B.gather_all(tile, src, 1) //Shhh, unless the bag fills, don't spam the borg's chat with stuff that's going on every time they move! - return + //Borgs and drones can use their mining bags ~automagically~ if they're deployed in a slot. Only mining bags, as they're optimized for mass use. + if(istype(module_state_1, /obj/item/weapon/storage/bag/ore) || istype(module_state_2, /obj/item/weapon/storage/bag/ore) || istype(module_state_3, /obj/item/weapon/storage/bag/ore)) + var/obj/item/weapon/storage/bag/ore/B = null + if(istype(module_state_1, /obj/item/weapon/storage/bag/ore)) //First orebag has priority, if they for some reason have multiple. + B = module_state_1 + else if(istype(module_state_2, /obj/item/weapon/storage/bag/ore)) + B = module_state_2 + else if(istype(module_state_3, /obj/item/weapon/storage/bag/ore)) + B = module_state_3 + var/turf/tile = loc + if(isturf(tile)) + B.gather_all(tile, src, 1) //Shhh, unless the bag fills, don't spam the borg's chat with stuff that's going on every time they move! + + if(istype(module, /obj/item/weapon/robot_module/robot/janitor) && isturf(loc)) + var/turf/tile = loc + tile.clean_blood() + if (istype(tile, /turf/simulated)) + var/turf/simulated/S = tile + S.dirt = 0 + for(var/A in tile) + if(istype(A, /obj/effect)) + if(istype(A, /obj/effect/rune) || istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/overlay)) + qdel(A) + else if(istype(A, /obj/item)) + var/obj/item/cleaned_item = A + cleaned_item.clean_blood() + else if(istype(A, /mob/living/carbon/human)) + var/mob/living/carbon/human/cleaned_human = A + if(cleaned_human.lying) + if(cleaned_human.head) + cleaned_human.head.clean_blood() + cleaned_human.update_inv_head(0) + if(cleaned_human.wear_suit) + cleaned_human.wear_suit.clean_blood() + cleaned_human.update_inv_wear_suit(0) + else if(cleaned_human.w_uniform) + cleaned_human.w_uniform.clean_blood() + cleaned_human.update_inv_w_uniform(0) + if(cleaned_human.shoes) + cleaned_human.shoes.clean_blood() + cleaned_human.update_inv_shoes(0) + cleaned_human.clean_blood(1) + cleaned_human << "[src] cleans your face!" \ No newline at end of file diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/farm animals/goat.dm b/code/modules/mob/living/simple_mob/subtypes/animal/farm animals/goat.dm index 7ff82a81603..1e7991d6a26 100644 --- a/code/modules/mob/living/simple_mob/subtypes/animal/farm animals/goat.dm +++ b/code/modules/mob/living/simple_mob/subtypes/animal/farm animals/goat.dm @@ -54,8 +54,8 @@ var/step = get_step_to(src, food, 0) Move(step) -/mob/living/simple_mob/animal/goat/Move() - ..() +/mob/living/simple_mob/animal/goat/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() if(!stat) for(var/obj/effect/plant/SV in loc) SV.die_off(1) diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/space/worm.dm b/code/modules/mob/living/simple_mob/subtypes/animal/space/worm.dm index 9fbb2926bb3..b2ff320b522 100644 --- a/code/modules/mob/living/simple_mob/subtypes/animal/space/worm.dm +++ b/code/modules/mob/living/simple_mob/subtypes/animal/space/worm.dm @@ -196,29 +196,15 @@ next = null ..() -/mob/living/simple_mob/animal/space/space_worm/Move() - var/attachementNextPosition = loc +/mob/living/simple_mob/animal/space/space_worm/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(.) - if(previous) - if(previous.z != z) - previous.z_transitioning = TRUE - else - previous.z_transitioning = FALSE - previous.forceMove(attachementNextPosition) // None of this 'ripped in half by an airlock' business. - update_icon() - -/mob/living/simple_mob/animal/space/space_worm/forceMove() - var/attachementNextPosition = loc - . = ..() - if(.) - if(previous) - if(previous.z != z) - previous.z_transitioning = TRUE - else - previous.z_transitioning = FALSE - previous.forceMove(attachementNextPosition) // None of this 'ripped in half by an airlock' business. x 2 - update_icon() + if(previous) + if(previous.z != z) + previous.z_transitioning = TRUE + else + previous.z_transitioning = FALSE + previous.forceMove(old_loc) // None of this 'ripped in half by an airlock' business. + update_icon() /mob/living/simple_mob/animal/space/space_worm/head/Bump(atom/obstacle) if(open_maw && !stat && obstacle != previous) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 0e4a326cab6..da67e824822 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -366,17 +366,7 @@ anim(mobloc,mob,'icons/mob/mob.dmi',,"shadow",,mob.dir) mob.forceMove(get_step(mob, direct)) mob.dir = direct - // Crossed is always a bit iffy - for(var/obj/S in mob.loc) - if(istype(S,/obj/effect/step_trigger) || istype(S,/obj/effect/beam)) - S.Crossed(mob) - var/area/A = get_area_master(mob) - if(A) - A.Entered(mob) - if(isturf(mob.loc)) - var/turf/T = mob.loc - T.Entered(mob) mob.Post_Incorpmove() return 1 @@ -468,13 +458,7 @@ /mob/proc/update_gravity() return -/* -// The real Move() proc is above, but touching that massive block just to put this in isn't worth it. -/mob/Move(var/newloc, var/direct) - . = ..(newloc, direct) - if(.) - post_move(newloc, direct) -*/ + // Called when a mob successfully moves. // Would've been an /atom/movable proc but it caused issues. /mob/Moved(atom/oldloc) diff --git a/code/modules/multiz/zshadow.dm b/code/modules/multiz/zshadow.dm index 540dfddada6..949f9a7a943 100644 --- a/code/modules/multiz/zshadow.dm +++ b/code/modules/multiz/zshadow.dm @@ -61,7 +61,7 @@ if(shadow) shadow.sync_icon(src) -/mob/living/Move() +/mob/living/Moved() . = ..() check_shadow() diff --git a/code/modules/overmap/disperser/disperser_charge.dm b/code/modules/overmap/disperser/disperser_charge.dm index 22026086d5e..b09557ebd1a 100644 --- a/code/modules/overmap/disperser/disperser_charge.dm +++ b/code/modules/overmap/disperser/disperser_charge.dm @@ -15,13 +15,13 @@ ) // make a screeching noise to drive people mad -/obj/structure/ship_munition/disperser_charge/Move(atom/newloc, direct = 0) - if((. = ..()) && prob(50)) +/obj/structure/ship_munition/disperser_charge/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() + if(prob(50)) var/turf/T = get_turf(src) if(!isspace(T) && !istype(T, /turf/simulated/floor/carpet)) playsound(T, pick(move_sounds), 50, 1) - /obj/structure/ship_munition/disperser_charge/fire name = "FR1-ENFER charge" color = "#b95a00" diff --git a/code/modules/overmap/events/overmap_event.dm b/code/modules/overmap/events/overmap_event.dm index 9add25a5c1b..ff1b4ae105f 100644 --- a/code/modules/overmap/events/overmap_event.dm +++ b/code/modules/overmap/events/overmap_event.dm @@ -19,19 +19,10 @@ icon_state = pick(event_icon_states) GLOB.overmap_event_handler.update_hazards(loc) -/obj/effect/overmap/event/Move() - var/turf/old_loc = loc +/obj/effect/overmap/event/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(.) - GLOB.overmap_event_handler.update_hazards(old_loc) - GLOB.overmap_event_handler.update_hazards(loc) - -/obj/effect/overmap/event/forceMove(atom/destination) - var/old_loc = loc - . = ..() - if(.) - GLOB.overmap_event_handler.update_hazards(old_loc) - GLOB.overmap_event_handler.update_hazards(loc) + GLOB.overmap_event_handler.update_hazards(old_loc) + GLOB.overmap_event_handler.update_hazards(loc) /obj/effect/overmap/event/Destroy()//takes a look at this one as well, make sure everything is A-OK var/turf/T = loc diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index f5481afd4cc..7b36dd7347a 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -135,9 +135,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin return -/obj/structure/particle_accelerator/Move() - ..() - if(master && master.active) +/obj/structure/particle_accelerator/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() + if(master?.active) master.toggle_power() log_game("PACCEL([x],[y],[z]) Was moved while active and turned off.") investigate_log("was moved whilst active; it powered down.","singulo") diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 3ed65642296..47e9c5f6d63 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -338,14 +338,13 @@ START_PROCESSING(SSprojectiles, src) pixel_move(1, FALSE) //move it now! -/obj/item/projectile/Move(atom/newloc, dir = NONE) +/obj/item/projectile/Moved(atom/old_loc, direction, forced = FALSE) . = ..() - if(.) - if(temporary_unstoppable_movement) - temporary_unstoppable_movement = FALSE - DISABLE_BITFIELD(movement_type, UNSTOPPABLE) - if(fired && can_hit_target(original, permutated, TRUE)) - Bump(original) + if(temporary_unstoppable_movement) + temporary_unstoppable_movement = FALSE + DISABLE_BITFIELD(movement_type, UNSTOPPABLE) + if(fired && can_hit_target(original, permutated, TRUE)) + Bump(original) /obj/item/projectile/proc/after_z_change(atom/olcloc, atom/newloc) diff --git a/code/modules/vehicles/quad.dm b/code/modules/vehicles/quad.dm index 99adccf4597..657d4976f42 100644 --- a/code/modules/vehicles/quad.dm +++ b/code/modules/vehicles/quad.dm @@ -45,19 +45,18 @@ icon_state = "quad_keys" w_class = ITEMSIZE_TINY -/obj/vehicle/train/engine/quadbike/Move(var/turf/destination) - var/turf/T = get_turf(src) - ..() //Move it move it, so we can test it test it. - if(T != get_turf(src) && !istype(destination, T.type)) //Did we move at all, and are we changing turf types? - if(istype(destination, /turf/simulated/floor/water)) +/obj/vehicle/train/engine/quadbike/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() //Move it move it, so we can test it test it. + if(!istype(loc, old_loc.type) && !istype(old_loc, loc.type)) //Did we move at all, and are we changing turf types? + if(istype(loc, /turf/simulated/floor/water)) speed_mod = outdoors_speed_mod * 4 //It kind of floats due to its tires, but it is slow. - else if(istype(destination, /turf/simulated/floor/outdoors/rocks)) + else if(istype(loc, /turf/simulated/floor/outdoors/rocks)) speed_mod = initial(speed_mod) //Rocks are good, rocks are solid. - else if(istype(destination, /turf/simulated/floor/outdoors/dirt) || istype(destination, /turf/simulated/floor/outdoors/grass)) + else if(istype(loc, /turf/simulated/floor/outdoors/dirt) || istype(loc, /turf/simulated/floor/outdoors/grass)) speed_mod = outdoors_speed_mod //Dirt and grass are the outdoors bench mark. - else if(istype(destination, /turf/simulated/floor/outdoors/mud)) + else if(istype(loc, /turf/simulated/floor/outdoors/mud)) speed_mod = outdoors_speed_mod * 1.5 //Gets us roughly 1. Mud may be fun, but it's not the best. - else if(istype(destination, /turf/simulated/floor/outdoors/snow)) + else if(istype(loc, /turf/simulated/floor/outdoors/snow)) speed_mod = outdoors_speed_mod * 1.7 //Roughly a 1.25. Snow is coarse and wet and gets everywhere, especially your electric motors. else speed_mod = initial(speed_mod) @@ -193,8 +192,8 @@ ..() update_icon() -/obj/vehicle/train/trolley/trailer/Move() - ..() +/obj/vehicle/train/trolley/trailer/Moved(atom/old_loc, direction, forced = FALSE) + . = ..() if(lead) switch(dir) //Due to being a Big Boy sprite, it has to have special pixel shifting to look 'normal'. if(1) diff --git a/code/modules/vehicles/train.dm b/code/modules/vehicles/train.dm index 24d24b11798..67fc0735a3b 100644 --- a/code/modules/vehicles/train.dm +++ b/code/modules/vehicles/train.dm @@ -29,14 +29,11 @@ /obj/vehicle/train/Move() var/old_loc = get_turf(src) - if(..()) + if((. = ..())) if(tow) tow.Move(old_loc) - return 1 - else - if(lead) - unattach() - return 0 + else if(lead) + unattach() /obj/vehicle/train/Bump(atom/Obstacle) if(!istype(Obstacle, /atom/movable)) diff --git a/code/modules/xenoarcheaology/artifacts/artifact.dm b/code/modules/xenoarcheaology/artifacts/artifact.dm index 840c2096c50..7ecf912cfb1 100644 --- a/code/modules/xenoarcheaology/artifacts/artifact.dm +++ b/code/modules/xenoarcheaology/artifacts/artifact.dm @@ -336,8 +336,8 @@ secondary_effect.ToggleActivate(0) return -/obj/machinery/artifact/Move() - ..() +/obj/machinery/artifact/Moved() + . = ..() if(my_effect) my_effect.UpdateMove() if(secondary_effect)