diff --git a/code/controllers/subsystem/planets.dm b/code/controllers/subsystem/planets.dm
index 70dd00954e7..f3bc7495de5 100644
--- a/code/controllers/subsystem/planets.dm
+++ b/code/controllers/subsystem/planets.dm
@@ -21,7 +21,7 @@ SUBSYSTEM_DEF(planets)
admin_notice("Initializing planetary weather.", R_DEBUG)
createPlanets()
allocateTurfs(TRUE)
- ..()
+ return ..()
/datum/controller/subsystem/planets/proc/createPlanets()
var/list/planet_datums = GLOB.using_map.planet_datums_to_make
@@ -36,59 +36,82 @@ SUBSYSTEM_DEF(planets)
continue
z_to_planet[Z] = NP
-/datum/controller/subsystem/planets/proc/addTurf(var/turf/T,var/is_edge)
- if(is_edge)
- new_outdoor_walls |= T
- else
- new_outdoor_turfs |= T
+/datum/controller/subsystem/planets/proc/addTurf(turf/T)
+ new_outdoor_turfs += T
-/datum/controller/subsystem/planets/proc/removeTurf(var/turf/T,var/is_edge)
- if(is_edge)
- new_outdoor_walls -= T
- else
- new_outdoor_turfs -= T
+/datum/controller/subsystem/planets/proc/addWall(turf/T)
+ new_outdoor_walls += T
+/datum/controller/subsystem/planets/proc/removeTurf(turf/T)
+ new_outdoor_turfs -= T
if(z_to_planet.len >= T.z)
var/datum/planet/P = z_to_planet[T.z]
if(!P)
return
- if(is_edge)
- P.planet_floors -= T
- else
- P.planet_walls -= T
- T.vis_contents -= P.weather_holder.visuals
- T.vis_contents -= P.weather_holder.special_visuals
-
-/datum/controller/subsystem/planets/proc/allocateTurfs(var/initial = FALSE)
- var/list/currentlist = new_outdoor_turfs
- while(currentlist.len)
- var/turf/simulated/OT = currentlist[currentlist.len]
- currentlist.len--
- if(istype(OT) && OT.outdoors && z_to_planet.len >= OT.z && z_to_planet[OT.z])
- var/datum/planet/P = z_to_planet[OT.z]
- P.planet_floors |= OT
- OT.vis_contents |= P.weather_holder.visuals
- OT.vis_contents |= P.weather_holder.special_visuals
- if(!initial && MC_TICK_CHECK)
- return
-
- currentlist = new_outdoor_walls
- while(currentlist.len)
- var/turf/unsimulated/wall/planetary/PW = currentlist[currentlist.len]
- currentlist.len--
- if(istype(PW) && z_to_planet.len >= PW.z && z_to_planet[PW.z])
- var/datum/planet/P = z_to_planet[PW.z]
- P.planet_walls |= PW
- if(!initial && MC_TICK_CHECK)
- return
-
-/datum/controller/subsystem/planets/proc/unallocateTurf(var/turf/simulated/T)
- if(istype(T) && z_to_planet[T.z])
- var/datum/planet/P = z_to_planet[T.z]
P.planet_floors -= T
T.vis_contents -= P.weather_holder.visuals
T.vis_contents -= P.weather_holder.special_visuals
+/datum/controller/subsystem/planets/proc/removeWall(turf/T)
+ new_outdoor_walls -= T
+ if(z_to_planet.len >= T.z)
+ var/datum/planet/P = z_to_planet[T.z]
+ if(!P)
+ return
+ P.planet_walls -= T
+ T.vis_contents -= P.weather_holder.visuals
+ T.vis_contents -= P.weather_holder.special_visuals
+
+/datum/controller/subsystem/planets/proc/allocateTurfs(initial)
+ // if initial we're going to do optimizations
+ var/planet_z_count = z_to_planet.len
+ if(initial)
+ // make sure no duplicates are there
+ for(var/turf/simulated/S in new_outdoor_turfs)
+ if(planet_z_count < S.z)
+ continue
+ var/datum/planet/P = z_to_planet[S.z]
+ if(!P)
+ continue
+ P.planet_floors |= S
+ S.vis_contents |= P.weather_holder.visuals
+ S.vis_contents |= P.weather_holder.special_visuals
+ for(var/turf/unsimulated/wall/planetary/S in new_outdoor_walls)
+ if(planet_z_count < S.z)
+ continue
+ var/datum/planet/P = z_to_planet[S.z]
+ if(!P)
+ continue
+ P.planet_walls |= S
+ new_outdoor_turfs = list()
+ new_outdoor_walls = list()
+ return
+ var/list/curr = new_outdoor_turfs
+ while(curr)
+ var/turf/simulated/S = curr[curr.len]
+ curr.len--
+ if(!istype(S))
+ continue
+ if(planet_z_count < S.z)
+ continue
+ var/datum/planet/P = z_to_planet[S.z]
+ P.planet_floors |= S
+ S.vis_contents |= P.weather_holder.visuals
+ S.vis_contents |= P.weather_holder.special_visuals
+ if(MC_TICK_CHECK)
+ return
+ curr = new_outdoor_walls
+ while(curr)
+ var/turf/unsimulated/wall/planetary/S = curr[curr.len]
+ curr.len--
+ if(!istype(S))
+ continue
+ if(planet_z_count < S.z)
+ continue
+ var/datum/planet/P = z_to_planet[S.z]
+ P.planet_walls |= S
+ if(MC_TICK_CHECK)
+ return
/datum/controller/subsystem/planets/fire(resumed = 0)
if(new_outdoor_turfs.len || new_outdoor_walls.len)
diff --git a/code/game/machinery/floorlayer.dm b/code/game/machinery/floorlayer.dm
index 274eb5e4469..a92fd861d68 100644
--- a/code/game/machinery/floorlayer.dm
+++ b/code/game/machinery/floorlayer.dm
@@ -1,3 +1,4 @@
+// TODO: allow different tile types in storage??
/obj/machinery/floorlayer
name = "automatic floor layer"
icon = 'icons/obj/stationobjs.dmi'
@@ -85,11 +86,6 @@
return 1
return 0
-/obj/machinery/floorlayer/proc/SortStacks()
- for(var/obj/item/stack/tile/tile1 in contents)
- for(var/obj/item/stack/tile/tile2 in contents)
- tile2.transfer_to(tile1)
-
/obj/machinery/floorlayer/proc/layFloor(var/turf/w_turf)
if(!T)
if(!TakeNewStack())
@@ -98,10 +94,11 @@
return 1
/obj/machinery/floorlayer/proc/TakeTile(var/obj/item/stack/tile/tile)
- if(!T) T = tile
- tile.loc = src
-
- SortStacks()
+ if(!T)
+ T = tile
+ tile.forceMove(src)
+ else
+ tile.merge(T)
/obj/machinery/floorlayer/proc/CollectTiles(var/turf/w_turf)
for(var/obj/item/stack/tile/tile in w_turf)
diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm
index f844608f9c4..68f1b4cc28f 100644
--- a/code/game/turfs/simulated/floor.dm
+++ b/code/game/turfs/simulated/floor.dm
@@ -30,7 +30,6 @@
thermal_conductivity = 0.040
heat_capacity = 10000
- var/lava = 0
/turf/simulated/floor/is_plating()
return !flooring
@@ -43,7 +42,7 @@
set_flooring(get_flooring_data(floortype))
else
footstep_sounds = base_footstep_sounds
- if(can_dirty && can_start_dirty)
+ if(mapload && can_dirty && can_start_dirty)
if(prob(dirty_prob))
dirt += rand(50,100)
update_dirt() //5% chance to start with dirt on a floor tile- give the janitor something to do
diff --git a/code/game/turfs/simulated/floor_attackby.dm b/code/game/turfs/simulated/floor_attackby.dm
index 14bf99ca0f8..a4ee0cde814 100644
--- a/code/game/turfs/simulated/floor_attackby.dm
+++ b/code/game/turfs/simulated/floor_attackby.dm
@@ -42,7 +42,7 @@
return
// Create a ceiling to shield from the weather
- if(src.outdoors)
+ if(outdoors)
for(var/dir in GLOB.cardinal)
var/turf/A = get_step(src, dir)
if(A && !A.outdoors)
diff --git a/code/game/turfs/simulated/floor_icon.dm b/code/game/turfs/simulated/floor_icon.dm
index 65d7c8d5442..f575d1c56bd 100644
--- a/code/game/turfs/simulated/floor_icon.dm
+++ b/code/game/turfs/simulated/floor_icon.dm
@@ -11,10 +11,6 @@ var/image/no_ceiling_image = null
no_ceiling_image.plane = PLANE_MESONS
/turf/simulated/floor/update_icon(var/update_neighbors)
-
- if(lava)
- return
-
cut_overlays()
if(flooring)
diff --git a/code/game/turfs/simulated/lava.dm b/code/game/turfs/simulated/lava.dm
index 2dfac221a71..7ffc5a29d1c 100644
--- a/code/game/turfs/simulated/lava.dm
+++ b/code/game/turfs/simulated/lava.dm
@@ -32,11 +32,6 @@
..()
name = "magma"
-/turf/simulated/floor/outdoors/lava/update_icon()
- cut_overlays()
- ..()
- update_icon_edge()
-
/turf/simulated/floor/outdoors/lava/Entered(atom/movable/AM)
..()
if(burn_stuff(AM))
diff --git a/code/game/turfs/simulated/outdoors/outdoors.dm b/code/game/turfs/simulated/outdoors/outdoors.dm
index a031492da51..66c492d0281 100644
--- a/code/game/turfs/simulated/outdoors/outdoors.dm
+++ b/code/game/turfs/simulated/outdoors/outdoors.dm
@@ -43,14 +43,12 @@ var/list/turf_edge_cache = list()
/turf/simulated/AfterChange(flags, oldType)
. = ..()
// If it was outdoors and still is, it will not get added twice when the planet controller gets around to putting it in.
- if(outdoors)
- make_outdoors()
- else
- make_indoors()
-
-/turf/simulated/floor/outdoors/update_icon()
- ..()
- update_icon_edge()
+ if(flags & CHANGETURF_PRESERVE_OUTDOORS)
+ // if it didn't preserve then we don't need to recheck now do we
+ if(outdoors)
+ make_outdoors()
+ else
+ make_indoors()
/turf/simulated/floor/outdoors/mud
name = "mud"
diff --git a/code/game/turfs/simulated/outdoors/sky.dm b/code/game/turfs/simulated/outdoors/sky.dm
index b4b7f207b20..d240b5f7736 100644
--- a/code/game/turfs/simulated/outdoors/sky.dm
+++ b/code/game/turfs/simulated/outdoors/sky.dm
@@ -11,7 +11,6 @@
/turf/simulated/sky/Initialize(mapload)
. = ..()
- SSplanets.addTurf(src)
set_light(2, 2, "#FFFFFF")
/turf/simulated/sky/north
diff --git a/code/game/turfs/simulated/water.dm b/code/game/turfs/simulated/water.dm
index 4bbb396d2a4..16973427e4d 100644
--- a/code/game/turfs/simulated/water.dm
+++ b/code/game/turfs/simulated/water.dm
@@ -219,10 +219,6 @@ turf/simulated/floor/water/contaminated/Entered(atom/movable/AM, atom/oldloc)
depth = 4
layer = WATER_FLOOR_LAYER
-/turf/simulated/floor/water/acid/Initialize(mapload)
- . = ..()
- update_icon()
-
/turf/simulated/floor/water/acid/update_icon()
..() // To get the edges.
@@ -230,8 +226,6 @@ turf/simulated/floor/water/contaminated/Entered(atom/movable/AM, atom/oldloc)
var/image/acid_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = acid_state, layer = WATER_LAYER)
add_overlay(acid_sprite)
- update_icon_edge()
-
/turf/simulated/floor/water/acid/get_edge_icon_state()
return "acid_shallow"
@@ -340,18 +334,12 @@ turf/simulated/floor/water/contaminated/Entered(atom/movable/AM, atom/oldloc)
layer = WATER_FLOOR_LAYER
depth = 6
-/turf/simulated/floor/water/blood/Initialize(mapload)
- . = ..()
- update_icon()
-
/turf/simulated/floor/water/blood/update_icon()
..()
icon_state = under_state // This isn't set at compile time in order for it to show as water in the map editor.
var/image/blood_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = blood_state, layer = WATER_LAYER)
add_overlay(blood_sprite)
- update_icon_edge()
-
/turf/simulated/floor/water/blood/get_edge_icon_state()
return "acidb_shallow"
diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm
index 9b7b5e01e3e..3b2ceee12c6 100644
--- a/code/game/turfs/space/space.dm
+++ b/code/game/turfs/space/space.dm
@@ -83,7 +83,7 @@
qdel(L)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
S.use(1)
- ChangeTurf(/turf/simulated/floor/airless)
+ ChangeTurf(/turf/simulated/floor/plating, flags = CHANGETURF_INHERIT_AIR)
return
else
to_chat(user, "The plating is going to need some support.")
@@ -105,7 +105,7 @@
if(R.use(1)) // Cost of roofing tiles is 1:1 with cost to place lattice and plating
T.ReplaceWithLattice()
- T.ChangeTurf(/turf/simulated/floor)
+ T.ChangeTurf(/turf/simulated/floor, flags = CHANGETURF_INHERIT_AIR)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
user.visible_message("[user] expands the ceiling.", "You expand the ceiling.")
else
diff --git a/code/game/turfs/unsimulated/planetary.dm b/code/game/turfs/unsimulated/planetary.dm
index 88e4399532e..2a941006b16 100644
--- a/code/game/turfs/unsimulated/planetary.dm
+++ b/code/game/turfs/unsimulated/planetary.dm
@@ -14,10 +14,10 @@
/turf/unsimulated/wall/planetary/Initialize(mapload)
. = ..()
- SSplanets.addTurf(src)
+ SSplanets.addWall(src)
/turf/unsimulated/wall/planetary/Destroy()
- SSplanets.removeTurf(src)
+ SSplanets.removeWall(src)
return ..()
/turf/unsimulated/wall/planetary/proc/set_temperature(var/new_temperature)
diff --git a/code/modules/maps/tether/levels/tether_turfs.dm b/code/modules/maps/tether/levels/tether_turfs.dm
index 9069ac33d2f..483285dfa07 100644
--- a/code/modules/maps/tether/levels/tether_turfs.dm
+++ b/code/modules/maps/tether/levels/tether_turfs.dm
@@ -2,10 +2,6 @@
VIRGO3B_TURF_CREATE(/turf/simulated/open)
/turf/simulated/open/virgo3b
edge_blending_priority = 0.5 //Turfs which also have e_b_p and higher than this will plop decorative edges onto this turf
-/turf/simulated/open/virgo3b/Initialize(mapload)
- . = ..()
- if(outdoors)
- SSplanets.addTurf(src)
VIRGO3B_TURF_CREATE(/turf/simulated/floor)
@@ -230,7 +226,6 @@ turf/simulated/mineral/rich/make_ore(var/rare_ore)
/turf/simulated/sky/virgo3b/Initialize()
. = ..()
- SSplanets.addTurf(src)
set_light(2, 2, "#FFBBBB")
/turf/simulated/sky/virgo3b/north
diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm
index 184ede71bda..1cbf3e39108 100644
--- a/code/modules/mining/mine_turfs.dm
+++ b/code/modules/mining/mine_turfs.dm
@@ -102,6 +102,7 @@ turf/simulated/mineral/floor/light_corner
reconsider_lights()
blocks_air = 1
can_build_into_floor = FALSE
+ SSplanets.removeTurf(src)
update_general()
/turf/simulated/mineral/proc/update_general()
@@ -367,7 +368,7 @@ turf/simulated/mineral/floor/light_corner
return
qdel(L)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
- ChangeTurf(/turf/simulated/floor)
+ PlaceOnTop(/turf/simulated/floor/plating, flags = CHANGETURF_INHERIT_AIR)
S.use(1)
return
else
diff --git a/code/modules/multiz/turf.dm b/code/modules/multiz/turf.dm
index 52936b0df4a..11fb07c5c5a 100644
--- a/code/modules/multiz/turf.dm
+++ b/code/modules/multiz/turf.dm
@@ -140,7 +140,7 @@
if (R.use(1))
to_chat(user, "Constructing support lattice ...")
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
- ReplaceWithLattice()
+ new /obj/structure/lattice(src)
return
if (istype(C, /obj/item/stack/tile/floor))
@@ -152,7 +152,7 @@
qdel(L)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
S.use(1)
- ChangeTurf(/turf/simulated/floor/airless)
+ ChangeTurf(/turf/simulated/floor, flags = CHANGETURF_INHERIT_AIR)
return
else
to_chat(user, "The plating is going to need some support.")
@@ -161,8 +161,6 @@
if(istype(C, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = C
coil.turf_place(src, user)
- return
- return
// Most things use is_plating to test if there is a cover tile on top (like regular floors)
/turf/simulated/open/is_plating()