Refactor Move() code

This commit is contained in:
Aronai Sieyes
2020-04-27 10:08:55 -04:00
parent ab179d74a2
commit bc1fa7bd05
42 changed files with 345 additions and 407 deletions
-3
View File
@@ -96,7 +96,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)
@@ -122,8 +121,6 @@
if(C)
C.forceMove(destturf)
destarea.Entered(teleatom)
return 1
/datum/teleport/proc/teleport()
+128 -97
View File
@@ -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
@@ -52,71 +51,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
@@ -161,47 +169,39 @@
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)
//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)
@@ -243,56 +243,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.
+6 -7
View File
@@ -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
+3 -3
View File
@@ -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)
+9 -10
View File
@@ -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."
+1 -2
View File
@@ -479,8 +479,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))
+1 -1
View File
@@ -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()
+3 -3
View File
@@ -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
-6
View File
@@ -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)
+5 -5
View File
@@ -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(..())
+2 -4
View File
@@ -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)
+9 -13
View File
@@ -151,19 +151,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)
+8 -9
View File
@@ -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)
@@ -12,10 +12,6 @@
qdel(src)
return
/obj/effect/expl_particles/Move()
..()
return
/datum/effect/system/expl_particles
var/number = 10
var/turf/location
+3 -3
View File
@@ -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
@@ -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("<span class='danger'>[user] begins to tear at \the [src]!</span>")
@@ -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)
@@ -139,22 +139,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
@@ -412,7 +412,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)
+2 -2
View File
@@ -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()
+4 -1
View File
@@ -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()
+2 -2
View File
@@ -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
+9 -10
View File
@@ -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)
+2 -3
View File
@@ -372,10 +372,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
+19 -21
View File
@@ -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
@@ -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
+6 -7
View File
@@ -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))
@@ -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)
to_chat(cleaned_human, "<font color='red'>[src] cleans your face!</font>")
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 << "<font color='red'>[src] cleans your face!</font>"
@@ -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)
@@ -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)
+1 -17
View File
@@ -362,17 +362,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
@@ -462,13 +452,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)
+1 -1
View File
@@ -61,7 +61,7 @@
if(shadow)
shadow.sync_icon(src)
/mob/living/Move()
/mob/living/Moved()
. = ..()
check_shadow()
+3 -12
View File
@@ -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
@@ -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 <font color='red'>powered down</font>.","singulo")
+6 -7
View File
@@ -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)
+10 -11
View File
@@ -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)
+3 -6
View File
@@ -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))
@@ -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)