Convert turfs to use add_overlays(), eliminating the turf_overlay_holder!

- Converted as much as I could find about turf overlays to use add_overlay().
- This should be enough to stop BYOND from crashing, so we can eliminate the turf_overlay_holder hack.
- This also lets us remove the anti-corruption hacks from walls and open space.
- ZAS gas overlays can use priority overlays, so this also fixes the gas-goes-away-when-crowbarring-plating issue.
- Stuff like that
This commit is contained in:
Leshana
2018-02-25 02:02:57 -05:00
parent 07f89c26b7
commit 00f8ae5cd8
23 changed files with 99 additions and 250 deletions

View File

@@ -6,9 +6,9 @@
/turf/simulated/proc/update_graphic(list/graphic_add = null, list/graphic_remove = null) /turf/simulated/proc/update_graphic(list/graphic_add = null, list/graphic_remove = null)
if(LAZYLEN(graphic_add)) if(LAZYLEN(graphic_add))
overlays += graphic_add add_overlay(graphic_add, priority = TRUE)
if(LAZYLEN(graphic_remove)) if(LAZYLEN(graphic_remove))
overlays -= graphic_remove cut_overlay(graphic_remove, priority = TRUE)
/turf/proc/update_air_properties() /turf/proc/update_air_properties()
var/block = c_airblock(src) var/block = c_airblock(src)

View File

@@ -800,7 +800,6 @@ proc/GaussRandRound(var/sigma,var/roundto)
var/old_dir1 = T.dir var/old_dir1 = T.dir
var/old_icon_state1 = T.icon_state var/old_icon_state1 = T.icon_state
var/old_icon1 = T.icon var/old_icon1 = T.icon
var/old_overlays = T.overlays.Copy()
var/old_underlays = T.underlays.Copy() var/old_underlays = T.underlays.Copy()
var/old_decals = T.decals ? T.decals.Copy() : null var/old_decals = T.decals ? T.decals.Copy() : null
@@ -808,11 +807,9 @@ proc/GaussRandRound(var/sigma,var/roundto)
X.set_dir(old_dir1) X.set_dir(old_dir1)
X.icon_state = old_icon_state1 X.icon_state = old_icon_state1
X.icon = old_icon1 X.icon = old_icon1
X.overlays = old_overlays X.copy_overlays(T, TRUE)
X.underlays = old_underlays X.underlays = old_underlays
X.decals = old_decals X.decals = old_decals
if(old_decals)
X.apply_decals()
//Move the air from source to dest //Move the air from source to dest
var/turf/simulated/ST = T var/turf/simulated/ST = T
@@ -838,14 +835,10 @@ proc/GaussRandRound(var/sigma,var/roundto)
if(shuttlework) if(shuttlework)
var/turf/simulated/shuttle/SS = T var/turf/simulated/shuttle/SS = T
SS.landed_holder.leave_turf() SS.landed_holder.leave_turf()
else if(turftoleave) else if(turftoleave)
T.ChangeTurf(turftoleave) T.ChangeTurf(turftoleave)
T.apply_decals()
else else
T.ChangeTurf(get_base_turf_by_area(T)) T.ChangeTurf(get_base_turf_by_area(T))
T.apply_decals()
refined_src -= T refined_src -= T
refined_trg -= B refined_trg -= B

View File

@@ -1,28 +0,0 @@
//
// Floor Decals Initialization Subsystem
// This is part of the giant decal hack that works around a BYOND bug where DreamDaemon will crash if you
// update overlays on turfs too much.
// The master_controller on Polaris used to init decals prior to initializing areas (which initilized turfs)
// Now that we switched to subsystems we still want to do the same thing, so this takes care of it.
//
SUBSYSTEM_DEF(floor_decals)
name = "Floor Decals"
init_order = INIT_ORDER_DECALS
flags = SS_NO_FIRE
/datum/controller/subsystem/floor_decals/Initialize(timeofday)
if(floor_decals_initialized)
return ..()
to_world_log("Initializing Floor Decals")
admin_notice("<span class='danger'>Initializing Floor Decals</span>", R_DEBUG)
var/list/turfs_with_decals = list()
for(var/obj/effect/floor_decal/D in world)
var/T = D.add_to_turf_decals()
if(T) turfs_with_decals |= T
CHECK_TICK
for(var/item in turfs_with_decals)
var/turf/T = item
if(T.decals) T.apply_decals()
CHECK_TICK
floor_decals_initialized = TRUE
return ..()

View File

@@ -14,17 +14,29 @@ var/list/floor_decals = list()
if(newcolour) color = newcolour if(newcolour) color = newcolour
..(newloc) ..(newloc)
// Hack to workaround byond crash bug
/obj/effect/floor_decal/initialize() /obj/effect/floor_decal/initialize()
if(!floor_decals_initialized || !loc || QDELETED(src))
return
add_to_turf_decals() add_to_turf_decals()
var/turf/T = get_turf(src)
if(T) //VOREStation Edit
T.apply_decals()
initialized = TRUE initialized = TRUE
return INITIALIZE_HINT_QDEL return INITIALIZE_HINT_QDEL
// This is a separate proc from initialize() to facilitiate its caching and other stuff. Look into it someday.
/obj/effect/floor_decal/proc/add_to_turf_decals()
if(supplied_dir)
set_dir(supplied_dir) // TODO - Why can't this line be done in initialize/New()?
var/turf/T = get_turf(src)
if(istype(T, /turf/simulated/floor) || istype(T, /turf/unsimulated/floor) || istype(T, /turf/simulated/shuttle/floor))
var/cache_key = "[alpha]-[color]-[dir]-[icon_state]-[T.layer]"
var/image/I = floor_decals[cache_key]
if(!I)
I = image(icon = icon, icon_state = icon_state, dir = dir)
I.layer = T.layer
I.color = color
I.alpha = alpha
floor_decals[cache_key] = I
LAZYADD(T.decals, I) // Add to its decals list (so it remembers to re-apply after it cuts overlays)
T.add_overlay(I) // Add to its current overlays too.
return T
/obj/effect/floor_decal/reset /obj/effect/floor_decal/reset
name = "reset marker" name = "reset marker"

View File

@@ -230,9 +230,8 @@
oxygen = 0 oxygen = 0
nitrogen = 0 nitrogen = 0
/turf/simulated/floor/reinforced/n20/New() /turf/simulated/floor/reinforced/n20/initialize()
..() . = ..()
sleep(-1)
if(!air) make_air() if(!air) make_air()
air.adjust_gas("sleeping_agent", ATMOSTANK_NITROUSOXIDE) air.adjust_gas("sleeping_agent", ATMOSTANK_NITROUSOXIDE)
@@ -411,11 +410,11 @@
. = ..() . = ..()
/turf/snow/update_icon() /turf/snow/update_icon()
overlays.Cut() cut_overlays()
for(var/d in crossed_dirs) for(var/d in crossed_dirs)
var/amt = crossed_dirs[d] var/amt = crossed_dirs[d]
for(var/i in 1 to amt) for(var/i in 1 to amt)
overlays += icon(icon, "footprint[i]", text2num(d)) add_overlay(image(icon, "footprint[i]", text2num(d)))
//**** Here ends snow **** //**** Here ends snow ****

View File

@@ -1,95 +0,0 @@
//
// Initialize floor decals! Woo! This is crazy.
//
var/global/floor_decals_initialized = FALSE
// The Turf Decal Holder
// Since it is unsafe to add overlays to turfs, we hold them here for now.
// Since I want this object to basically not exist, I am modeling it in part after lighting_overlay
/atom/movable/turf_overlay_holder
name = "turf overlay holder"
density = 0
simulated = 0
anchored = 1
layer = TURF_LAYER
icon = null
icon_state = null
mouse_opacity = 0
// auto_init = 0
/atom/movable/turf_overlay_holder/initialize()
// doesn't need special init
initialized = TRUE
return INITIALIZE_HINT_NORMAL
/atom/movable/turf_overlay_holder/New(var/atom/newloc)
..()
verbs.Cut()
var/turf/T = loc
T.overlay_holder = src
/atom/movable/turf_overlay_holder/Destroy()
if(loc)
var/turf/T = loc
if(T.overlay_holder == src)
T.overlay_holder = null
. = ..()
// Variety of overrides so the overlays don't get affected by weird things.
/atom/movable/turf_overlay_holder/ex_act()
return
/atom/movable/turf_overlay_holder/singularity_act()
return
/atom/movable/turf_overlay_holder/singularity_pull()
return
/atom/movable/turf_overlay_holder/forceMove()
return 0 //should never move
/atom/movable/turf_overlay_holder/Move()
return 0
/atom/movable/turf_overlay_holder/throw_at()
return 0
/obj/effect/floor_decal/proc/add_to_turf_decals()
if(src.supplied_dir) src.set_dir(src.supplied_dir)
var/turf/T = get_turf(src)
if(istype(T, /turf/simulated/floor) || istype(T, /turf/unsimulated/floor) || istype(T, /turf/simulated/shuttle/floor))
var/cache_key = "[src.alpha]-[src.color]-[src.dir]-[src.icon_state]-[T.layer]"
var/image/I = floor_decals[cache_key]
if(!I)
I = image(icon = src.icon, icon_state = src.icon_state, dir = src.dir)
I.layer = T.layer
I.color = src.color
I.alpha = src.alpha
floor_decals[cache_key] = I
if(!T.decals) T.decals = list()
//world.log << "About to add img:\ref[I] onto decals at turf:\ref[T] ([T.x],[T.y],[T.z]) which has appearance:\ref[T.appearance] and decals.len=[T.decals.len]"
T.decals += I
return T
// qdel(D)
src.loc = null
src.tag = null
// Changes to turf to let us do this
/turf
var/atom/movable/turf_overlay_holder/overlay_holder = null
// After a turf change, destroy the old overlay holder since we will have lost access to it.
/turf/post_change()
var/atom/movable/turf_overlay_holder/TOH = locate(/atom/movable/turf_overlay_holder, src)
if(TOH)
qdel(TOH)
..()
/turf/proc/apply_decals()
if(decals)
if(!overlay_holder)
overlay_holder = new(src)
overlay_holder.overlays = src.decals
else if(overlay_holder)
overlay_holder.overlays.Cut()

View File

@@ -21,16 +21,15 @@
spawn(0) spawn(0)
wet = wet_val wet = wet_val
if(wet_overlay) if(wet_overlay)
overlays -= wet_overlay cut_overlay(wet_overlay)
wet_overlay = null wet_overlay = image('icons/effects/water.dmi', icon_state = "wet_floor")
wet_overlay = image('icons/effects/water.dmi',src,"wet_floor") add_overlay(wet_overlay)
overlays += wet_overlay
sleep(800) sleep(800)
if(wet == 2) if(wet == 2)
sleep(3200) sleep(3200)
wet = 0 wet = 0
if(wet_overlay) if(wet_overlay)
overlays -= wet_overlay cut_overlay(wet_overlay)
wet_overlay = null wet_overlay = null
/turf/simulated/proc/freeze_floor() /turf/simulated/proc/freeze_floor()
@@ -38,14 +37,14 @@
return return
wet = 3 // icy wet = 3 // icy
if(wet_overlay) if(wet_overlay)
overlays -= wet_overlay cut_overlay(wet_overlay)
wet_overlay = null wet_overlay = null
wet_overlay = image('icons/turf/overlays.dmi',src,"snowfloor") wet_overlay = image('icons/turf/overlays.dmi',src,"snowfloor")
overlays += wet_overlay add_overlay(wet_overlay)
spawn(5 MINUTES) spawn(5 MINUTES)
wet = 0 wet = 0
if(wet_overlay) if(wet_overlay)
overlays -= wet_overlay cut_overlay(wet_overlay)
wet_overlay = null wet_overlay = null
/turf/simulated/clean_blood() /turf/simulated/clean_blood()

View File

@@ -60,7 +60,7 @@
//This proc auto corrects the grass tiles' siding. //This proc auto corrects the grass tiles' siding.
/turf/simulated/floor/proc/make_plating(var/place_product, var/defer_icon_update) /turf/simulated/floor/proc/make_plating(var/place_product, var/defer_icon_update)
overlays.Cut() cut_overlays()
// VOREStation Edit - We are flooring switching to plating, swap out old_decals for decals. // VOREStation Edit - We are flooring switching to plating, swap out old_decals for decals.
if(flooring) if(flooring)
var/tmp/list/underfloor_decals = old_decals var/tmp/list/underfloor_decals = old_decals

View File

@@ -15,7 +15,7 @@ var/image/no_ceiling_image = null
if(lava) if(lava)
return return
overlays.Cut() cut_overlays()
if(flooring) if(flooring)
// Set initial icon and strings. // Set initial icon and strings.
@@ -38,17 +38,17 @@ var/image/no_ceiling_image = null
var/turf/simulated/floor/T = get_step(src, step_dir) var/turf/simulated/floor/T = get_step(src, step_dir)
if(!istype(T) || !T.flooring || T.flooring.name != flooring.name) if(!istype(T) || !T.flooring || T.flooring.name != flooring.name)
has_border |= step_dir has_border |= step_dir
overlays |= get_flooring_overlay("[flooring.icon_base]-edge-[step_dir]", "[flooring.icon_base]_edges", step_dir) add_overlay(get_flooring_overlay("[flooring.icon_base]-edge-[step_dir]", "[flooring.icon_base]_edges", step_dir))
// There has to be a concise numerical way to do this but I am too noob. // There has to be a concise numerical way to do this but I am too noob.
if((has_border & NORTH) && (has_border & EAST)) if((has_border & NORTH) && (has_border & EAST))
overlays |= get_flooring_overlay("[flooring.icon_base]-edge-[NORTHEAST]", "[flooring.icon_base]_edges", NORTHEAST) add_overlay(get_flooring_overlay("[flooring.icon_base]-edge-[NORTHEAST]", "[flooring.icon_base]_edges", NORTHEAST))
if((has_border & NORTH) && (has_border & WEST)) if((has_border & NORTH) && (has_border & WEST))
overlays |= get_flooring_overlay("[flooring.icon_base]-edge-[NORTHWEST]", "[flooring.icon_base]_edges", NORTHWEST) add_overlay(get_flooring_overlay("[flooring.icon_base]-edge-[NORTHWEST]", "[flooring.icon_base]_edges", NORTHWEST))
if((has_border & SOUTH) && (has_border & EAST)) if((has_border & SOUTH) && (has_border & EAST))
overlays |= get_flooring_overlay("[flooring.icon_base]-edge-[SOUTHEAST]", "[flooring.icon_base]_edges", SOUTHEAST) add_overlay(get_flooring_overlay("[flooring.icon_base]-edge-[SOUTHEAST]", "[flooring.icon_base]_edges", SOUTHEAST))
if((has_border & SOUTH) && (has_border & WEST)) if((has_border & SOUTH) && (has_border & WEST))
overlays |= get_flooring_overlay("[flooring.icon_base]-edge-[SOUTHWEST]", "[flooring.icon_base]_edges", SOUTHWEST) add_overlay(get_flooring_overlay("[flooring.icon_base]-edge-[SOUTHWEST]", "[flooring.icon_base]_edges", SOUTHWEST))
if(flooring.flags & TURF_HAS_CORNERS) if(flooring.flags & TURF_HAS_CORNERS)
// As above re: concise numerical way to do this. // As above re: concise numerical way to do this.
@@ -56,37 +56,36 @@ var/image/no_ceiling_image = null
if(!(has_border & EAST)) if(!(has_border & EAST))
var/turf/simulated/floor/T = get_step(src, NORTHEAST) var/turf/simulated/floor/T = get_step(src, NORTHEAST)
if(!(istype(T) && T.flooring && T.flooring.name == flooring.name)) if(!(istype(T) && T.flooring && T.flooring.name == flooring.name))
overlays |= get_flooring_overlay("[flooring.icon_base]-corner-[NORTHEAST]", "[flooring.icon_base]_corners", NORTHEAST) add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[NORTHEAST]", "[flooring.icon_base]_corners", NORTHEAST))
if(!(has_border & WEST)) if(!(has_border & WEST))
var/turf/simulated/floor/T = get_step(src, NORTHWEST) var/turf/simulated/floor/T = get_step(src, NORTHWEST)
if(!(istype(T) && T.flooring && T.flooring.name == flooring.name)) if(!(istype(T) && T.flooring && T.flooring.name == flooring.name))
overlays |= get_flooring_overlay("[flooring.icon_base]-corner-[NORTHWEST]", "[flooring.icon_base]_corners", NORTHWEST) add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[NORTHWEST]", "[flooring.icon_base]_corners", NORTHWEST))
if(!(has_border & SOUTH)) if(!(has_border & SOUTH))
if(!(has_border & EAST)) if(!(has_border & EAST))
var/turf/simulated/floor/T = get_step(src, SOUTHEAST) var/turf/simulated/floor/T = get_step(src, SOUTHEAST)
if(!(istype(T) && T.flooring && T.flooring.name == flooring.name)) if(!(istype(T) && T.flooring && T.flooring.name == flooring.name))
overlays |= get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHEAST]", "[flooring.icon_base]_corners", SOUTHEAST) add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHEAST]", "[flooring.icon_base]_corners", SOUTHEAST))
if(!(has_border & WEST)) if(!(has_border & WEST))
var/turf/simulated/floor/T = get_step(src, SOUTHWEST) var/turf/simulated/floor/T = get_step(src, SOUTHWEST)
if(!(istype(T) && T.flooring && T.flooring.name == flooring.name)) if(!(istype(T) && T.flooring && T.flooring.name == flooring.name))
overlays |= get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHWEST]", "[flooring.icon_base]_corners", SOUTHWEST) add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHWEST]", "[flooring.icon_base]_corners", SOUTHWEST))
// Hack workaround to byond crash bug // Re-apply floor decals
//if(decals && decals.len) if(LAZYLEN(decals))
//overlays |= decals add_overlay(decals)
apply_decals()
if(is_plating() && !(isnull(broken) && isnull(burnt))) //temp, todo if(is_plating() && !(isnull(broken) && isnull(burnt))) //temp, todo
icon = 'icons/turf/flooring/plating.dmi' icon = 'icons/turf/flooring/plating.dmi'
icon_state = "dmg[rand(1,4)]" icon_state = "dmg[rand(1,4)]"
else if(flooring) else if(flooring)
if(!isnull(broken) && (flooring.flags & TURF_CAN_BREAK)) if(!isnull(broken) && (flooring.flags & TURF_CAN_BREAK))
overlays |= get_flooring_overlay("[flooring.icon_base]-broken-[broken]","broken[broken]") // VOREStation Edit - Eris overlays add_overlay(get_flooring_overlay("[flooring.icon_base]-broken-[broken]","broken[broken]")) // VOREStation Edit - Eris overlays
if(!isnull(burnt) && (flooring.flags & TURF_CAN_BURN)) if(!isnull(burnt) && (flooring.flags & TURF_CAN_BURN))
overlays |= get_flooring_overlay("[flooring.icon_base]-burned-[burnt]","burned[burnt]") // VOREStation Edit - Eris overlays add_overlay(get_flooring_overlay("[flooring.icon_base]-burned-[burnt]","burned[burnt]")) // VOREStation Edit - Eris overlays
if(weather_overlay) if(weather_overlay)
overlays += weather_overlay add_overlay(weather_overlay)
if(update_neighbors) if(update_neighbors)
for(var/turf/simulated/floor/F in range(src, 1)) for(var/turf/simulated/floor/F in range(src, 1))
@@ -97,7 +96,7 @@ var/image/no_ceiling_image = null
// Show 'ceilingless' overlay. // Show 'ceilingless' overlay.
var/turf/above = GetAbove(src) var/turf/above = GetAbove(src)
if(above && isopenspace(above) && !istype(src, /turf/simulated/floor/outdoors)) // This won't apply to outdoor turfs since its assumed they don't have a ceiling anyways. if(above && isopenspace(above) && !istype(src, /turf/simulated/floor/outdoors)) // This won't apply to outdoor turfs since its assumed they don't have a ceiling anyways.
overlays |= no_ceiling_image add_overlay(no_ceiling_image)
/turf/simulated/floor/proc/get_flooring_overlay(var/cache_key, var/icon_base, var/icon_dir = 0) /turf/simulated/floor/proc/get_flooring_overlay(var/cache_key, var/icon_base, var/icon_dir = 0)
if(!flooring_cache[cache_key]) if(!flooring_cache[cache_key])

View File

@@ -15,17 +15,19 @@
var/list/decals var/list/decals
New(var/location = null, var/turf/simulated/shuttle/turf) New(var/location = null, var/turf/simulated/shuttle/turf)
..(null)
my_turf = turf my_turf = turf
/obj/landed_holder/proc/land_on(var/turf/T) /obj/landed_holder/proc/land_on(var/turf/T)
//Gather destination information //Gather destination information
var/old_dest_type = T.type var/obj/landed_holder/new_holder = new(null)
var/old_dest_dir = T.dir new_holder.turf_type = T.type
var/old_dest_icon_state = T.icon_state new_holder.dir = T.dir
var/old_dest_icon = T.icon new_holder.icon = T.icon
var/list/old_dest_overlays = T.overlays.Copy() new_holder.icon_state = T.icon_state
var/list/old_dest_underlays = T.underlays.Copy() new_holder.copy_overlays(T, TRUE)
var/list/old_dest_decals = T.decals ? T.decals.Copy() : null new_holder.underlays = T.underlays.Copy()
new_holder.decals = T.decals ? T.decals.Copy() : null
//Set the destination to be like us //Set the destination to be like us
T.Destroy() T.Destroy()
@@ -33,7 +35,7 @@
new_dest.set_dir(my_turf.dir) new_dest.set_dir(my_turf.dir)
new_dest.icon_state = my_turf.icon_state new_dest.icon_state = my_turf.icon_state
new_dest.icon = my_turf.icon new_dest.icon = my_turf.icon
new_dest.overlays = my_turf.overlays new_dest.copy_overlays(my_turf, TRUE)
new_dest.underlays = my_turf.underlays new_dest.underlays = my_turf.underlays
new_dest.decals = my_turf.decals new_dest.decals = my_turf.decals
//Shuttle specific stuff //Shuttle specific stuff
@@ -43,18 +45,9 @@
new_dest.join_flags = my_turf.join_flags new_dest.join_flags = my_turf.join_flags
new_dest.join_group = my_turf.join_group new_dest.join_group = my_turf.join_group
if(new_dest.decals) // Associate the holder with the new turf.
new_dest.apply_decals() new_holder.my_turf = new_dest
new_dest.landed_holder = new_holder
//Tell the new turf about what was there before
new_dest.landed_holder = new(turf = new_dest)
new_dest.landed_holder.turf_type = old_dest_type
new_dest.landed_holder.dir = old_dest_dir
new_dest.landed_holder.icon = old_dest_icon
new_dest.landed_holder.icon_state = old_dest_icon_state
new_dest.landed_holder.overlays = old_dest_overlays
new_dest.landed_holder.underlays = old_dest_underlays
new_dest.landed_holder.decals = old_dest_decals
//Update underlays if necessary (interior corners won't have changed). //Update underlays if necessary (interior corners won't have changed).
if(new_dest.takes_underlays && !new_dest.interior_corner) if(new_dest.takes_underlays && !new_dest.interior_corner)
@@ -70,11 +63,9 @@
new_source.set_dir(dir) new_source.set_dir(dir)
new_source.icon_state = icon_state new_source.icon_state = icon_state
new_source.icon = icon new_source.icon = icon
new_source.overlays = overlays new_source.copy_overlays(src, TRUE)
new_source.underlays = underlays new_source.underlays = underlays
new_source.decals = decals new_source.decals = decals
if(new_source.decals)
new_source.apply_decals()
else else
new_source = my_turf.ChangeTurf(get_base_turf_by_area(my_turf),,1) new_source = my_turf.ChangeTurf(get_base_turf_by_area(my_turf),,1)

View File

@@ -44,7 +44,9 @@ var/list/outdoor_turfs = list()
planet_controller.unallocateTurf(src) planet_controller.unallocateTurf(src)
else // This is happening during map gen, if there's no planet_controller (hopefully). else // This is happening during map gen, if there's no planet_controller (hopefully).
outdoor_turfs -= src outdoor_turfs -= src
qdel(weather_overlay) if(weather_overlay)
cut_overlay(weather_overlay)
qdel_null(weather_overlay)
update_icon() update_icon()
/turf/simulated/post_change() /turf/simulated/post_change()
@@ -67,15 +69,14 @@ var/list/outdoor_turfs = list()
var/image/I = image(icon = 'icons/turf/outdoors_edge.dmi', icon_state = "[T.get_edge_icon_state()]-edge", dir = checkdir) var/image/I = image(icon = 'icons/turf/outdoors_edge.dmi', icon_state = "[T.get_edge_icon_state()]-edge", dir = checkdir)
I.plane = 0 I.plane = 0
turf_edge_cache[cache_key] = I turf_edge_cache[cache_key] = I
overlays += turf_edge_cache[cache_key] add_overlay(turf_edge_cache[cache_key])
/turf/simulated/proc/get_edge_icon_state() /turf/simulated/proc/get_edge_icon_state()
return icon_state return icon_state
/turf/simulated/floor/outdoors/update_icon() /turf/simulated/floor/outdoors/update_icon()
overlays.Cut()
update_icon_edge()
..() ..()
update_icon_edge()
/turf/simulated/floor/outdoors/mud /turf/simulated/floor/outdoors/mud
name = "mud" name = "mud"

View File

@@ -17,10 +17,9 @@
. = ..() . = ..()
/turf/simulated/floor/outdoors/snow/update_icon() /turf/simulated/floor/outdoors/snow/update_icon()
overlays.Cut()
..() ..()
for(var/d in crossed_dirs) for(var/d in crossed_dirs)
overlays += image(icon = 'icons/turf/outdoors.dmi', icon_state = "snow_footprints", dir = text2num(d)) add_overlay(image(icon = 'icons/turf/outdoors.dmi', icon_state = "snow_footprints", dir = text2num(d)))
/turf/simulated/floor/outdoors/snow/attackby(var/obj/item/W, var/mob/user) /turf/simulated/floor/outdoors/snow/attackby(var/obj/item/W, var/mob/user)
if(istype(W, /obj/item/weapon/shovel)) if(istype(W, /obj/item/weapon/shovel))

View File

@@ -47,36 +47,36 @@
if(!damage_overlays[1]) //list hasn't been populated if(!damage_overlays[1]) //list hasn't been populated
generate_overlays() generate_overlays()
overlays.Cut() cut_overlays()
var/image/I var/image/I
if(!density) if(!density)
I = image('icons/turf/wall_masks.dmi', "[material.icon_base]fwall_open") I = image('icons/turf/wall_masks.dmi', "[material.icon_base]fwall_open")
I.color = material.icon_colour I.color = material.icon_colour
overlays += I add_overlay(I)
return return
for(var/i = 1 to 4) for(var/i = 1 to 4)
I = image('icons/turf/wall_masks.dmi', "[material.icon_base][wall_connections[i]]", dir = 1<<(i-1)) I = image('icons/turf/wall_masks.dmi', "[material.icon_base][wall_connections[i]]", dir = 1<<(i-1))
I.color = material.icon_colour I.color = material.icon_colour
overlays += I add_overlay(I)
if(reinf_material) if(reinf_material)
if(construction_stage != null && construction_stage < 6) if(construction_stage != null && construction_stage < 6)
I = image('icons/turf/wall_masks.dmi', "reinf_construct-[construction_stage]") I = image('icons/turf/wall_masks.dmi', "reinf_construct-[construction_stage]")
I.color = reinf_material.icon_colour I.color = reinf_material.icon_colour
overlays += I add_overlay(I)
else else
if("[reinf_material.icon_reinf]0" in icon_states('icons/turf/wall_masks.dmi')) if("[reinf_material.icon_reinf]0" in icon_states('icons/turf/wall_masks.dmi'))
// Directional icon // Directional icon
for(var/i = 1 to 4) for(var/i = 1 to 4)
I = image('icons/turf/wall_masks.dmi', "[reinf_material.icon_reinf][wall_connections[i]]", dir = 1<<(i-1)) I = image('icons/turf/wall_masks.dmi', "[reinf_material.icon_reinf][wall_connections[i]]", dir = 1<<(i-1))
I.color = reinf_material.icon_colour I.color = reinf_material.icon_colour
overlays += I add_overlay(I)
else else
I = image('icons/turf/wall_masks.dmi', reinf_material.icon_reinf) I = image('icons/turf/wall_masks.dmi', reinf_material.icon_reinf)
I.color = reinf_material.icon_colour I.color = reinf_material.icon_colour
overlays += I add_overlay(I)
if(damage != 0) if(damage != 0)
var/integrity = material.integrity var/integrity = material.integrity
@@ -87,7 +87,7 @@
if(overlay > damage_overlays.len) if(overlay > damage_overlays.len)
overlay = damage_overlays.len overlay = damage_overlays.len
overlays += damage_overlays[overlay] add_overlay(damage_overlays[overlay])
return return
/turf/simulated/wall/proc/generate_overlays() /turf/simulated/wall/proc/generate_overlays()

View File

@@ -224,15 +224,7 @@
/turf/simulated/shuttle/wall/voidcraft/update_icon() /turf/simulated/shuttle/wall/voidcraft/update_icon()
if(stripe_color) if(stripe_color)
overlays = list() //VOREStation Edit - Another place with overlay nonsense. cut_overlays()
var/image/I = image(icon = src.icon, icon_state = "o_[icon_state]") var/image/I = image(icon = src.icon, icon_state = "o_[icon_state]")
I.color = stripe_color I.color = stripe_color
//VOREStation Add - Shenanigans around this because of the bullshit byond bug add_overlay(I)
var/pre_overlays = overlays.len
overlays.Add(I)
var/post_overlays = overlays.len
if(post_overlays != (pre_overlays + 1))
world.log << "Corrupted overlays on [x],[y],[z] voidcraft wall"
new type(src)
return
//VOREStation Add End

View File

@@ -26,7 +26,7 @@
var/list/flesh_overlay_cache = list() var/list/flesh_overlay_cache = list()
/turf/simulated/flesh/update_icon(var/update_neighbors) /turf/simulated/flesh/update_icon(var/update_neighbors)
overlays.Cut() cut_overlays()
if(density) if(density)
icon = 'icons/turf/stomach_vr.dmi' icon = 'icons/turf/stomach_vr.dmi'
@@ -37,7 +37,7 @@ var/list/flesh_overlay_cache = list()
var/place_dir = turn(direction, 180) var/place_dir = turn(direction, 180)
if(!flesh_overlay_cache["flesh_side_[place_dir]"]) if(!flesh_overlay_cache["flesh_side_[place_dir]"])
flesh_overlay_cache["flesh_side_[place_dir]"] = image('icons/turf/stomach_vr.dmi', "flesh_side", dir = place_dir) flesh_overlay_cache["flesh_side_[place_dir]"] = image('icons/turf/stomach_vr.dmi', "flesh_side", dir = place_dir)
T.overlays += flesh_overlay_cache["flesh_side_[place_dir]"] add_overlay(flesh_overlay_cache["flesh_side_[place_dir]"])
if(update_neighbors) if(update_neighbors)
for(var/direction in alldirs) for(var/direction in alldirs)

View File

@@ -16,7 +16,6 @@
update_icon() update_icon()
/turf/simulated/floor/water/update_icon() /turf/simulated/floor/water/update_icon()
overlays.Cut()
..() // To get the edges. ..() // To get the edges.
icon_state = water_state icon_state = water_state
var/image/floorbed_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = under_state) var/image/floorbed_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = under_state)
@@ -129,16 +128,16 @@ var/list/shoreline_icon_cache = list()
// Water sprites are really annoying, so let BYOND sort it out. // Water sprites are really annoying, so let BYOND sort it out.
/turf/simulated/floor/water/shoreline/update_icon() /turf/simulated/floor/water/shoreline/update_icon()
underlays.Cut() underlays.Cut()
overlays.Cut() cut_overlays()
..() // Get the underlay first. ..() // Get the underlay first.
var/cache_string = "[initial(icon_state)]_[water_state]_[dir]" var/cache_string = "[initial(icon_state)]_[water_state]_[dir]"
if(cache_string in shoreline_icon_cache) // Check to see if an icon already exists. if(cache_string in shoreline_icon_cache) // Check to see if an icon already exists.
overlays += shoreline_icon_cache[cache_string] add_overlay(shoreline_icon_cache[cache_string])
else // If not, make one, but only once. else // If not, make one, but only once.
var/icon/shoreline_water = icon(src.icon, "shoreline_water", src.dir) var/icon/shoreline_water = icon(src.icon, "shoreline_water", src.dir)
var/icon/shoreline_subtract = icon(src.icon, "[initial(icon_state)]_subtract", src.dir) var/icon/shoreline_subtract = icon(src.icon, "[initial(icon_state)]_subtract", src.dir)
shoreline_water.Blend(shoreline_subtract,ICON_SUBTRACT) shoreline_water.Blend(shoreline_subtract,ICON_SUBTRACT)
shoreline_icon_cache[cache_string] = shoreline_water shoreline_icon_cache[cache_string] = shoreline_water
overlays += shoreline_icon_cache[cache_string] add_overlay(shoreline_icon_cache[cache_string])

View File

@@ -26,12 +26,12 @@
. = ..() . = ..()
/turf/snow/update_icon() /turf/snow/update_icon()
overlays.Cut() cut_overlays()
for(var/d in crossed_dirs) for(var/d in crossed_dirs)
var/amt = crossed_dirs[d] var/amt = crossed_dirs[d]
for(var/i in 1 to amt) for(var/i in 1 to amt)
overlays += icon(icon, "footprint[i]", text2num(d)) add_overlay(image(icon, "footprint[i]", text2num(d)))
/turf/snow/snow2 /turf/snow/snow2
name = "snow" name = "snow"

View File

@@ -10,7 +10,8 @@
/turf/space/cracked_asteroid/is_space() // So people don't start floating when standing on it. /turf/space/cracked_asteroid/is_space() // So people don't start floating when standing on it.
return FALSE return FALSE
/turf/space/cracked_asteroid/New() // u wot m8? ~Leshana
..() // /turf/space/cracked_asteroid/New()
spawn(2 SECONDS) // ..()
overlays.Cut() // spawn(2 SECONDS)
// overlays.Cut()

View File

@@ -17,7 +17,7 @@
/turf/unsimulated/beach/water/New() /turf/unsimulated/beach/water/New()
..() ..()
overlays += image("icon"='icons/misc/beach.dmi',"icon_state"="water2","layer"=MOB_LAYER+0.1) add_overlay(image("icon"='icons/misc/beach.dmi',"icon_state"="water2","layer"=MOB_LAYER+0.1))
/turf/simulated/floor/beach /turf/simulated/floor/beach
name = "Beach" name = "Beach"
@@ -56,4 +56,4 @@
/turf/simulated/floor/beach/water/New() /turf/simulated/floor/beach/water/New()
..() ..()
overlays += image("icon"='icons/misc/beach.dmi',"icon_state"="water5","layer"=MOB_LAYER+0.1) add_overlay(image("icon"='icons/misc/beach.dmi',"icon_state"="water5","layer"=MOB_LAYER+0.1))

View File

@@ -107,7 +107,7 @@
/turf/simulated/floor/holofloor/desert/New() /turf/simulated/floor/holofloor/desert/New()
..() ..()
if(prob(10)) if(prob(10))
overlays += "asteroid[rand(0,9)]" add_overlay("asteroid[rand(0,9)]")
/obj/structure/holostool /obj/structure/holostool
name = "stool" name = "stool"

View File

@@ -73,7 +73,7 @@
* Update icon and overlays of open space to be that of the turf below, plus any visible objects on that turf. * Update icon and overlays of open space to be that of the turf below, plus any visible objects on that turf.
*/ */
/turf/simulated/open/update_icon() /turf/simulated/open/update_icon()
overlays = list() // Edit - Overlays are being crashy when modified. cut_overlays() // Edit - Overlays are being crashy when modified.
update_icon_edge()// Add - Get grass into open spaces and whatnot. update_icon_edge()// Add - Get grass into open spaces and whatnot.
var/turf/below = GetBelow(src) var/turf/below = GetBelow(src)
if(below) if(below)
@@ -86,12 +86,7 @@
bottom_turf.plane = src.plane bottom_turf.plane = src.plane
bottom_turf.color = below.color bottom_turf.color = below.color
underlays = list(bottom_turf) underlays = list(bottom_turf)
// Hack workaround to byond crash bug - Include the magic overlay holder object. copy_overlays(below)
overlays += below.overlays
// if(below.overlay_holder)
// overlays += (below.overlays + below.overlay_holder.overlays)
// else
// overlays += below.overlays
// get objects (not mobs, they are handled by /obj/zshadow) // get objects (not mobs, they are handled by /obj/zshadow)
var/list/o_img = list() var/list/o_img = list()
@@ -104,16 +99,10 @@
temp2.overlays += O.overlays temp2.overlays += O.overlays
// TODO Is pixelx/y needed? // TODO Is pixelx/y needed?
o_img += temp2 o_img += temp2
var/overlays_pre = overlays.len add_overlay(o_img)
overlays += o_img
var/overlays_post = overlays.len
if(overlays_post != (overlays_pre + o_img.len)) //Here we go!
world.log << "Corrupted openspace turf at [x],[y],[z] being replaced. Pre: [overlays_pre], Post: [overlays_post]"
new /turf/simulated/open(src)
return //Let's get out of here.
if(!below_is_open) if(!below_is_open)
overlays += over_OS_darkness add_overlay(over_OS_darkness)
return 0 return 0
return PROCESS_KILL return PROCESS_KILL

View File

@@ -147,7 +147,7 @@
/turf/simulated/floor/beach/coastwater/New() /turf/simulated/floor/beach/coastwater/New()
..() ..()
overlays += image("icon"='icons/misc/beach.dmi',"icon_state"="water","layer"=MOB_LAYER+0.1) add_overlay(image("icon"='icons/misc/beach.dmi',"icon_state"="water","layer"=MOB_LAYER+0.1))
// -- Areas -- // // -- Areas -- //

View File

@@ -196,7 +196,6 @@
#include "code\controllers\subsystems\air.dm" #include "code\controllers\subsystems\air.dm"
#include "code\controllers\subsystems\airflow.dm" #include "code\controllers\subsystems\airflow.dm"
#include "code\controllers\subsystems\atoms.dm" #include "code\controllers\subsystems\atoms.dm"
#include "code\controllers\subsystems\floor_decals.dm"
#include "code\controllers\subsystems\garbage.dm" #include "code\controllers\subsystems\garbage.dm"
#include "code\controllers\subsystems\lighting.dm" #include "code\controllers\subsystems\lighting.dm"
#include "code\controllers\subsystems\machines.dm" #include "code\controllers\subsystems\machines.dm"
@@ -1211,7 +1210,6 @@
#include "code\game\turfs\flooring\flooring_premade.dm" #include "code\game\turfs\flooring\flooring_premade.dm"
#include "code\game\turfs\flooring\flooring_vr.dm" #include "code\game\turfs\flooring\flooring_vr.dm"
#include "code\game\turfs\flooring\shuttle_vr.dm" #include "code\game\turfs\flooring\shuttle_vr.dm"
#include "code\game\turfs\flooring\turf_overlay_holder.dm"
#include "code\game\turfs\initialization\init.dm" #include "code\game\turfs\initialization\init.dm"
#include "code\game\turfs\initialization\maintenance.dm" #include "code\game\turfs\initialization\maintenance.dm"
#include "code\game\turfs\simulated\floor.dm" #include "code\game\turfs\simulated\floor.dm"