From 84f2ec81051c9963909f2d76a775c8228a192d04 Mon Sep 17 00:00:00 2001 From: Lohikar Date: Fri, 30 Jun 2017 05:09:19 -0500 Subject: [PATCH] Area fixes (#2875) changes: Fixes copy_contents_to not working. Fixes elevators attempting to spawn roofs when it didn't really make sense. Minor efficiency tweaks in move_contents_to and elevators. --- code/_helpers/area_movement.dm | 23 +++++++---------------- code/game/area/areas.dm | 1 + code/game/turfs/turf.dm | 3 ++- code/modules/turbolift/turbolift_areas.dm | 1 + code/modules/turbolift/turbolift_map.dm | 2 +- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/code/_helpers/area_movement.dm b/code/_helpers/area_movement.dm index 25c21e512a4..af2b1d3416a 100644 --- a/code/_helpers/area_movement.dm +++ b/code/_helpers/area_movement.dm @@ -34,8 +34,8 @@ ASSERT(z != -1) // Now use our information to build an *ordered* list of turfs. - for (var/x = xmin; x <= xmax; x++) - for (var/y = ymin; y <= ymax; y++) + for (var/x = xmin to xmax) + for (var/y = ymin to ymax) var/turf/T = locate(x, y, z) if (T.loc != src || T.type == ignore_type) // Not ours or ignored type, we don't give a crap. @@ -54,9 +54,7 @@ ASSERT(source_turfs.len == target_turfs.len) - var/list/simulated_turfs = list() - - for (var/i = 1; i <= source_turfs.len; i++) + for (var/i = 1 to source_turfs.len) var/turf/ST = source_turfs[i] if (!ST) // Excluded turfs are null to keep the list ordered. continue @@ -69,15 +67,8 @@ ST.ChangeTurf(ST.baseturf) - if (istype(TT, /turf/simulated)) - simulated_turfs += TT - - for (var/thing in simulated_turfs) - var/turf/simulated/T = thing - - T.update_icon() - if (istype(T.above)) - T.above.queue_icon_update() + TT.update_icon() + TT.update_above() // Called when a movable area wants to move this object. /atom/movable/proc/shuttle_move(turf/loc) @@ -108,10 +99,10 @@ baseturf = T.baseturf - for (var/i = 1; i <= source_turfs.len; i++) + for (var/i = 1 to source_turfs.len) var/turf/ST = source_turfs[i] var/turf/TTi = target_turfs[i] - if (!ST || (plating_required && TTi.type != baseturf)) // Excluded turfs are null to keep the list ordered. + if (!ST || (plating_required && TTi.type == baseturf)) // Excluded turfs are null to keep the list ordered. continue var/turf/TT = ST.copy_turf(TTi, ignore_air = TRUE) diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 50cbb9e9007..d1a9651fe94 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -7,6 +7,7 @@ var/global/global_uid = 0 var/uid var/holomap_color // Color of this area on the holomap. Must be a hex color (as string) or null. + var/no_roof /area/Initialize(mapload) icon_state = "white" diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 95d1ae7dff2..e609a732892 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -297,8 +297,9 @@ var/const/enterloopsanity = 100 return FALSE var/turf/simulated/open/above = GetAbove(src) + var/area/A = loc - if ((istype(above) || (flags & ROOF_FORCE_SPAWN)) && roof_type) + if (((istype(above) && !A.no_roof) || (flags & ROOF_FORCE_SPAWN)) && roof_type && above) above.ChangeTurf(roof_type) roof_flags |= flags return TRUE diff --git a/code/modules/turbolift/turbolift_areas.dm b/code/modules/turbolift/turbolift_areas.dm index 2b7ddbb7ebf..839dbc12a73 100644 --- a/code/modules/turbolift/turbolift_areas.dm +++ b/code/modules/turbolift/turbolift_areas.dm @@ -5,6 +5,7 @@ requires_power = 0 station_area = 1 sound_env = SMALL_ENCLOSED + no_roof = TRUE var/lift_floor_label = null var/lift_floor_name = null diff --git a/code/modules/turbolift/turbolift_map.dm b/code/modules/turbolift/turbolift_map.dm index 71b493b43c9..ac75ee99fe9 100644 --- a/code/modules/turbolift/turbolift_map.dm +++ b/code/modules/turbolift/turbolift_map.dm @@ -128,7 +128,7 @@ for(var/i = 1, i < uz, i++) lift.floors += null // This silly hack allows lifts to not start on the first zlevel - for(var/cz = uz;cz<=ez;cz++) + for(var/cz = uz to ez) var/datum/turbolift_floor/cfloor = new() lift.floors += cfloor