diff --git a/code/game/turfs/flooring/flooring.dm b/code/game/turfs/flooring/flooring.dm index aa6f3b0e6f4..70ea20a3781 100644 --- a/code/game/turfs/flooring/flooring.dm +++ b/code/game/turfs/flooring/flooring.dm @@ -64,6 +64,7 @@ var/list/flooring_types /decl/flooring/grass/sif // Subtype for Sif's grass. name = "growth" desc = "A natural moss that has adapted to the sheer cold climate." + flags = TURF_REMOVE_SHOVEL icon = 'icons/turf/outdoors.dmi' icon_base = "grass_sif" has_base_range = 1 @@ -112,7 +113,7 @@ var/list/flooring_types desc = "Gritty and unpleasant." icon = 'icons/turf/flooring/asteroid.dmi' icon_base = "asteroid" - flags = TURF_HAS_EDGES | TURF_REMOVE_SHOVEL + flags = TURF_REMOVE_SHOVEL build_type = null footstep_sounds = list("human" = list( 'sound/effects/footstep/asteroid1.ogg', diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index af6d6811223..e12e168fb51 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -41,6 +41,7 @@ floortype = initial_flooring if(floortype) set_flooring(get_flooring_data(floortype), TRUE) + . = INITIALIZE_HINT_LATELOAD // We'll update our icons after everyone is ready else footstep_sounds = base_footstep_sounds if(can_dirty && can_start_dirty) @@ -48,6 +49,10 @@ dirt += rand(50,100) update_dirt() //5% chance to start with dirt on a floor tile- give the janitor something to do +/turf/simulated/floor/LateInitialize() + . = ..() + update_icon(1) + /turf/simulated/floor/proc/swap_decals() var/current_decals = decals decals = old_decals @@ -59,7 +64,7 @@ swap_decals() flooring = newflooring footstep_sounds = newflooring.footstep_sounds - update_icon(1) + //update_icon(1) // We'll do it in late initialize levelupdate() //This proc will set floor_type to null and the update_icon() proc will then change the icon_state of the turf diff --git a/code/game/turfs/simulated/floor_icon.dm b/code/game/turfs/simulated/floor_icon.dm index e11ad7e9982..5f426857d62 100644 --- a/code/game/turfs/simulated/floor_icon.dm +++ b/code/game/turfs/simulated/floor_icon.dm @@ -1,4 +1,4 @@ -GLOBAL_LIST_EMPTY(flooring_cache) +var/list/flooring_cache = list() var/image/no_ceiling_image = null @@ -36,40 +36,39 @@ var/image/no_ceiling_image = null if(flooring.flags & TURF_HAS_EDGES) for(var/step_dir in cardinal) var/turf/simulated/floor/T = get_step(src, step_dir) - if(!istype(T) || !T.flooring || T.flooring.name != flooring.name) + if(!test_link(T)) has_border |= 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. - if((has_border & NORTH) && (has_border & EAST)) + //Note: Doesn't actually check northeast, this is bitmath to check if we're edge'd (aka not smoothed) to NORTH and EAST + //North = 0001, East = 0100, Northeast = 0101, so (North|East) == Northeast, therefore (North|East)&Northeast == Northeast + if((has_border & NORTHEAST) == 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 & NORTHWEST) == 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 & SOUTHEAST) == 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 & SOUTHWEST) == SOUTHWEST) add_overlay(get_flooring_overlay("[flooring.icon_base]-edge-[SOUTHWEST]", "[flooring.icon_base]_edges", SOUTHWEST)) if(flooring.flags & TURF_HAS_CORNERS) - // As above re: concise numerical way to do this. - if(!(has_border & NORTH)) - if(!(has_border & EAST)) - var/turf/simulated/floor/T = get_step(src, NORTHEAST) - if(!(istype(T) && T.flooring && T.flooring.name == flooring.name)) - add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[NORTHEAST]", "[flooring.icon_base]_corners", NORTHEAST)) - if(!(has_border & WEST)) - var/turf/simulated/floor/T = get_step(src, NORTHWEST) - if(!(istype(T) && T.flooring && T.flooring.name == flooring.name)) - add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[NORTHWEST]", "[flooring.icon_base]_corners", NORTHWEST)) - if(!(has_border & SOUTH)) - if(!(has_border & EAST)) - var/turf/simulated/floor/T = get_step(src, SOUTHEAST) - if(!(istype(T) && T.flooring && T.flooring.name == flooring.name)) - add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHEAST]", "[flooring.icon_base]_corners", SOUTHEAST)) - if(!(has_border & WEST)) - var/turf/simulated/floor/T = get_step(src, SOUTHWEST) - if(!(istype(T) && T.flooring && T.flooring.name == flooring.name)) - add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHWEST]", "[flooring.icon_base]_corners", SOUTHWEST)) + //Like above but checking for NO similar bits rather than both similar bits. + if((has_border & NORTHEAST) == 0) //Are connected NORTH and EAST + var/turf/simulated/floor/T = get_step(src, NORTHEAST) + if(!test_link(T)) //But not NORTHEAST + add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[NORTHEAST]", "[flooring.icon_base]_corners", NORTHEAST)) + if((has_border & NORTHWEST) == 0) + var/turf/simulated/floor/T = get_step(src, NORTHWEST) + if(!test_link(T)) + add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[NORTHWEST]", "[flooring.icon_base]_corners", NORTHWEST)) + if((has_border & SOUTHEAST) == 0) + var/turf/simulated/floor/T = get_step(src, SOUTHEAST) + if(!test_link(T)) + add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHEAST]", "[flooring.icon_base]_corners", SOUTHEAST)) + if((has_border & SOUTHWEST) == 0) + var/turf/simulated/floor/T = get_step(src, SOUTHWEST) + if(!test_link(T)) + add_overlay(get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHWEST]", "[flooring.icon_base]_corners", SOUTHWEST)) // Re-apply floor decals if(LAZYLEN(decals)) @@ -79,11 +78,10 @@ var/image/no_ceiling_image = null icon = 'icons/turf/flooring/plating.dmi' icon_state = "dmg[rand(1,4)]" else if(flooring) - var/rand_key = rand(0,2) if(!isnull(broken) && (flooring.flags & TURF_CAN_BREAK)) - add_overlay(get_flooring_overlay("[flooring.icon_base]-broken-[rand_key]","broken[rand_key]")) + add_overlay(get_flooring_overlay("[flooring.icon_base]-broken-[broken]","broken[broken]")) // VOREStation Edit - Eris overlays if(!isnull(burnt) && (flooring.flags & TURF_CAN_BURN)) - add_overlay(get_flooring_overlay("[flooring.icon_base]-burned-[rand_key]","burned[rand_key]")) + add_overlay(get_flooring_overlay("[flooring.icon_base]-burned-[burnt]","burned[burnt]")) // VOREStation Edit - Eris overlays if(update_neighbors) for(var/turf/simulated/floor/F in range(src, 1)) @@ -96,9 +94,49 @@ var/image/no_ceiling_image = null 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. add_overlay(no_ceiling_image) + // Update our 'them-to-us' edges, aka edges from external turfs we feel should spill onto us + if(edge_blending_priority && !forbid_turf_edge()) + update_icon_edge() + +// This updates an edge from an adjacent turf onto us, not our own 'internal' edges. +// For e.g. we might be outdoor metal plating, and we want to find sand next to us to have it 'spill onto' our turf with an overlay. +/turf/simulated/proc/update_icon_edge() + for(var/checkdir in cardinal) // Check every direction + var/turf/simulated/T = get_step(src, checkdir) // Get the turf in that direction + // Our conditions: + // Has to be a /turf/simulated + // Has to have it's own edge_blending_priority + // Has to have a higher priority than us + // Their icon_state is not our icon_state + // They don't forbid_turf_edge + if(istype(T) && T.edge_blending_priority && edge_blending_priority < T.edge_blending_priority && icon_state != T.icon_state && !T.forbid_turf_edge()) + var/cache_key = "[T.get_edge_icon_state()]-[checkdir]" // Usually [icon_state]-[dirnum] + if(!turf_edge_cache[cache_key]) + var/image/I = image(icon = 'icons/turf/outdoors_edge.dmi', icon_state = "[T.get_edge_icon_state()]-edge", dir = checkdir, layer = ABOVE_TURF_LAYER) // Icon should be abstracted out + I.plane = TURF_PLANE + turf_edge_cache[cache_key] = I + add_overlay(turf_edge_cache[cache_key]) + +// We will take this state and use it for a cache key, and append '-edge' to it to get the edge overlay (edges *from other turfs*, not our own internal edges) +/turf/simulated/proc/get_edge_icon_state() + return icon_state + +// Tests if we shouldn't apply a turf edge. +// Returns the blocker if one exists. +/turf/simulated/proc/forbid_turf_edge() + for(var/obj/structure/S in contents) + if(S.block_turf_edges) + return S + return null + + +/turf/simulated/floor/proc/test_link(var/turf/simulated/floor/them) + return (istype(them) && them.flooring?.name == src.flooring.name) + /turf/simulated/floor/proc/get_flooring_overlay(var/cache_key, var/icon_base, var/icon_dir = 0) - if(!GLOB.flooring_cache[cache_key]) + if(!flooring_cache[cache_key]) var/image/I = image(icon = flooring.icon, icon_state = icon_base, dir = icon_dir) I.layer = layer - GLOB.flooring_cache[cache_key] = I - return GLOB.flooring_cache[cache_key] + flooring_cache[cache_key] = I + return flooring_cache[cache_key] + diff --git a/code/game/turfs/simulated/lava.dm b/code/game/turfs/simulated/lava.dm index 902c38c16af..237a28635c2 100644 --- a/code/game/turfs/simulated/lava.dm +++ b/code/game/turfs/simulated/lava.dm @@ -33,11 +33,6 @@ ..() name = "magma" -/turf/simulated/floor/lava/update_icon() - cut_overlays() - ..() - update_icon_edge() - /turf/simulated/floor/lava/Entered(atom/movable/AM) if(burn_stuff(AM)) START_PROCESSING(SSturfs, src) diff --git a/code/game/turfs/simulated/outdoors/outdoors.dm b/code/game/turfs/simulated/outdoors/outdoors.dm index bbc71d536bc..5f438f698f2 100644 --- a/code/game/turfs/simulated/outdoors/outdoors.dm +++ b/code/game/turfs/simulated/outdoors/outdoors.dm @@ -20,10 +20,6 @@ var/list/turf_edge_cache = list() // When a turf gets demoted or promoted, this list gets adjusted. The top-most layer is the layer on the bottom of the list, due to how pop() works. var/list/turf_layers = list(/turf/simulated/floor/outdoors/rocks) -/turf/simulated/floor/outdoors/Initialize() - update_icon() - . = ..() - /turf/simulated/floor/Initialize(mapload) if(outdoors) SSplanets.addTurf(src) @@ -50,33 +46,6 @@ var/list/turf_edge_cache = list() else make_indoors() -/turf/simulated/proc/update_icon_edge() - if(edge_blending_priority && !forbid_turf_edge()) - for(var/checkdir in cardinal) - var/turf/simulated/T = get_step(src, checkdir) - if(istype(T) && T.edge_blending_priority && edge_blending_priority < T.edge_blending_priority && icon_state != T.icon_state && !T.forbid_turf_edge()) - var/cache_key = "[T.get_edge_icon_state()]-[checkdir]" - if(!turf_edge_cache[cache_key]) - var/image/I = image(icon = 'icons/turf/outdoors_edge.dmi', icon_state = "[T.get_edge_icon_state()]-edge", dir = checkdir, layer = ABOVE_TURF_LAYER) - I.plane = TURF_PLANE - turf_edge_cache[cache_key] = I - add_overlay(turf_edge_cache[cache_key]) - -/turf/simulated/proc/get_edge_icon_state() - return icon_state - -// Tests if we shouldn't apply a turf edge. -// Returns the blocker if one exists. -/turf/simulated/proc/forbid_turf_edge() - for(var/obj/structure/S in contents) - if(S.block_turf_edges) - return S - return null - -/turf/simulated/floor/outdoors/update_icon() - ..() - update_icon_edge() - /turf/simulated/floor/outdoors/mud name = "mud" icon_state = "mud_dark" diff --git a/code/game/turfs/simulated/water.dm b/code/game/turfs/simulated/water.dm index 0093f848496..071499c2973 100644 --- a/code/game/turfs/simulated/water.dm +++ b/code/game/turfs/simulated/water.dm @@ -32,8 +32,6 @@ var/image/water_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = water_state, layer = WATER_LAYER) add_overlay(water_sprite) - update_icon_edge() - /turf/simulated/floor/water/get_edge_icon_state() return "water_shallow" diff --git a/icons/turf/outdoors.dmi b/icons/turf/outdoors.dmi index 8bcc4308f6e..6409a23e1f2 100644 Binary files a/icons/turf/outdoors.dmi and b/icons/turf/outdoors.dmi differ diff --git a/icons/turf/outdoors_edge.dmi b/icons/turf/outdoors_edge.dmi index fb0b04168e4..53577559734 100644 Binary files a/icons/turf/outdoors_edge.dmi and b/icons/turf/outdoors_edge.dmi differ diff --git a/maps/tether/tether_turfs.dm b/maps/tether/tether_turfs.dm index d0b2953e102..0b99a2a8d7e 100644 --- a/maps/tether/tether_turfs.dm +++ b/maps/tether/tether_turfs.dm @@ -15,10 +15,16 @@ VIRGO3B_TURF_CREATE(/turf/simulated/floor) return 0 VIRGO3B_TURF_CREATE(/turf/simulated/floor/reinforced) + VIRGO3B_TURF_CREATE(/turf/simulated/floor/tiled/steel_dirty) VIRGO3B_TURF_CREATE(/turf/simulated/floor/outdoors/dirt) +/turf/simulated/floor/outdoors/dirt/virgo3b + icon = 'icons/turf/flooring/asteroid.dmi' + icon_state = "asteroid" + VIRGO3B_TURF_CREATE(/turf/simulated/floor/outdoors/rocks) + VIRGO3B_TURF_CREATE(/turf/simulated/floor/outdoors/grass/sif) /turf/simulated/floor/outdoors/grass/sif turf_layers = list( @@ -26,8 +32,6 @@ VIRGO3B_TURF_CREATE(/turf/simulated/floor/outdoors/grass/sif) /turf/simulated/floor/outdoors/dirt/virgo3b ) - - // Overriding these for the sake of submaps that use them on other planets. // This means that mining on tether base and space is oxygen-generating, but solars and mining should use the virgo3b subtype /turf/simulated/mineral