diff --git a/code/_globalvars/lists/mobs.dm b/code/_globalvars/lists/mobs.dm index 1c6b4b90bc6..d2257aee5a7 100644 --- a/code/_globalvars/lists/mobs.dm +++ b/code/_globalvars/lists/mobs.dm @@ -6,13 +6,6 @@ GLOBAL_LIST_EMPTY(deadmins) //all ckeys who have used the de-admin verb. GLOBAL_LIST_EMPTY(directory) //all ckeys with associated client GLOBAL_LIST_EMPTY(stealthminID) //reference list with IDs that store ckeys, for stealthmins -GLOBAL_LIST_INIT(dangerous_turfs, typecacheof(list( - /turf/open/lava, - /turf/open/chasm, - /turf/open/space, - /turf/open/openspace))) - - //Since it didn't really belong in any other category, I'm putting this here //This is for procs to replace all the goddamn 'in world's that are chilling around the code diff --git a/code/datums/ai/idle_behaviors/idle_random_walk.dm b/code/datums/ai/idle_behaviors/idle_random_walk.dm index 1187d8786c1..7c302a57261 100644 --- a/code/datums/ai/idle_behaviors/idle_random_walk.dm +++ b/code/datums/ai/idle_behaviors/idle_random_walk.dm @@ -8,5 +8,7 @@ if(DT_PROB(walk_chance, delta_time) && (living_pawn.mobility_flags & MOBILITY_MOVE) && isturf(living_pawn.loc) && !living_pawn.pulledby) var/move_dir = pick(GLOB.alldirs) - living_pawn.Move(get_step(living_pawn, move_dir), move_dir) - + var/turf/destination_turf = get_step(living_pawn, move_dir) + if(!destination_turf?.can_cross_safely(living_pawn)) + return + living_pawn.Move(destination_turf, move_dir) diff --git a/code/datums/ai/movement/ai_movement_basic_avoidance.dm b/code/datums/ai/movement/ai_movement_basic_avoidance.dm index 8a610a5aabc..a57998564b5 100644 --- a/code/datums/ai/movement/ai_movement_basic_avoidance.dm +++ b/code/datums/ai/movement/ai_movement_basic_avoidance.dm @@ -15,6 +15,6 @@ . = ..() var/turf/target_turf = get_step_towards(source.moving, source.target) - if(is_type_in_typecache(target_turf, GLOB.dangerous_turfs)) - . = FALSE + if(!target_turf?.can_cross_safely(source.moving)) + . = MOVELOOP_SKIP_STEP return . diff --git a/code/datums/ai/movement/ai_movement_dumb.dm b/code/datums/ai/movement/ai_movement_dumb.dm index a38024ff2cc..041f1a967c2 100644 --- a/code/datums/ai/movement/ai_movement_dumb.dm +++ b/code/datums/ai/movement/ai_movement_dumb.dm @@ -15,6 +15,6 @@ . = ..() var/turf/target_turf = get_step_towards(source.moving, source.target) - if(is_type_in_typecache(target_turf, GLOB.dangerous_turfs)) - . = FALSE + if(!target_turf?.can_cross_safely(source.moving)) + . = MOVELOOP_SKIP_STEP return . diff --git a/code/game/turfs/open/chasm.dm b/code/game/turfs/open/chasm.dm index 233d45c0277..1ea8ede3d09 100644 --- a/code/game/turfs/open/chasm.dm +++ b/code/game/turfs/open/chasm.dm @@ -75,6 +75,9 @@ else if(istype(C, /obj/item/stack/tile/iron)) build_with_floor_tiles(C, user) +/turf/open/chasm/can_cross_safely(atom/movable/crossing) + return HAS_TRAIT(crossing, TRAIT_MOVE_FLYING) + // Chasms for Lavaland, with planetary atmos and lava glow /turf/open/chasm/lavaland initial_gas = PLANETARY_ATMOS diff --git a/code/game/turfs/open/lava.dm b/code/game/turfs/open/lava.dm index 626e4bc1fd0..0b91f430484 100644 --- a/code/game/turfs/open/lava.dm +++ b/code/game/turfs/open/lava.dm @@ -297,6 +297,9 @@ burn_living.adjust_fire_stacks(lava_firestacks * delta_time) burn_living.ignite_mob() +/turf/open/lava/can_cross_safely(atom/movable/crossing) + return HAS_TRAIT(crossing, immunity_trait) || HAS_TRAIT(crossing, TRAIT_MOVE_FLYING) + /turf/open/lava/smooth name = "lava" baseturfs = /turf/open/lava/smooth diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm index 0b676818b87..083fb306ee9 100644 --- a/code/game/turfs/open/openspace.dm +++ b/code/game/turfs/open/openspace.dm @@ -171,6 +171,9 @@ GLOBAL_DATUM_INIT(openspace_backdrop_one_for_all, /atom/movable/openspace_backdr return TRUE return FALSE +/turf/open/openspace/can_cross_safely(atom/movable/crossing) + return HAS_TRAIT(crossing, TRAIT_MOVE_FLYING) + /turf/open/openspace/icemoon name = "ice chasm" baseturfs = /turf/open/openspace/icemoon diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm index af0baf2d2bb..85cd316d067 100644 --- a/code/game/turfs/open/space/space.dm +++ b/code/game/turfs/open/space/space.dm @@ -200,6 +200,9 @@ destination_y = dest_y destination_z = dest_z +/turf/open/space/can_cross_safely(atom/movable/crossing) + return HAS_TRAIT(crossing, TRAIT_SPACEWALK) + /turf/open/space/openspace icon = 'icons/turf/floors.dmi' icon_state = "invisible" diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index b8ee3a2e36c..93c0f4bf43e 100755 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -59,7 +59,6 @@ GLOBAL_LIST_EMPTY(station_turfs) var/lighting_uses_jen = FALSE - ///Which directions does this turf block the vision of, taking into account both the turf's opacity and the movable opacity_sources. var/directional_opacity = NONE ///Lazylist of movable atoms providing opacity sources. @@ -710,3 +709,7 @@ GLOBAL_LIST_EMPTY(station_turfs) /turf/proc/TakeTemperature(temp) temperature += temp + +/// Returns whether it is safe for an atom to move across this turf +/turf/proc/can_cross_safely(atom/movable/crossing) + return TRUE