diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index fc13cd479be..8e0343348e6 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -25,8 +25,11 @@ density = 1 opacity = 1 anchored = 1 + canSmoothWith = list(/obj/structure/alien/resin) var/health = 200 var/resintype = null + + /obj/structure/alien/resin/New(location) relativewall_neighbours() ..() @@ -54,8 +57,8 @@ resintype = "wall" /obj/structure/alien/resin/wall/New() - relativewall_neighbours() ..() + relativewall_neighbours() /obj/structure/alien/resin/wall/BlockSuperconductivity() return 1 diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index 4be1750b3d7..9f5415d64e0 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -12,9 +12,16 @@ density = 1 opacity = 1 + canSmoothWith = list( + /turf/simulated/wall, + /obj/structure/falsewall, + /obj/structure/falsewall/reinforced // WHY DO WE SMOOTH WITH FALSE R-WALLS WHEN WE DON'T SMOOTH WITH REAL R-WALLS. + ) + + /obj/structure/falsewall/New() - relativewall_neighbours() ..() + relativewall_neighbours() /obj/structure/falsewall/Destroy() @@ -35,16 +42,7 @@ icon_state = "[walltype]fwall_open" return - var/junction = 0 //will be used to determine from which side the wall is connected to other walls - - for(var/turf/simulated/wall/W in orange(src,1)) - if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls - if(mineral == W.mineral)//Only 'like' walls connect -Sieve - junction |= get_dir(src,W) - for(var/obj/structure/falsewall/W in orange(src,1)) - if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls - if(mineral == W.mineral) - junction |= get_dir(src,W) + var/junction = findSmoothingNeighbors() icon_state = "[walltype][junction]" return diff --git a/code/game/smoothwall.dm b/code/game/smoothwall.dm index e98c839150a..44835824c48 100644 --- a/code/game/smoothwall.dm +++ b/code/game/smoothwall.dm @@ -1,112 +1,87 @@ -//Separate dm because it relates to two types of atoms + ease of removal in case it's needed. -//Also assemblies.dm for falsewall checking for this when used. -//I should really make the shuttle wall check run every time it's moved, but centcom uses unsimulated floors so !effort +// OKAY I DON'T KNOW WHO THE FUCK ORIGINALLY CODED THIS BUT THEY ARE OFFICIALLY FIRED FOR BEING DRUNK AND STUPID +// FUCK YOU MYSTERY CODERS +// FOR THIS SHIT I'M GOING TO MAKE ALL MY COMMENTS IN CAPS -/atom/proc/relativewall() //atom because it should be useable both for walls and false walls - if(istype(src,/turf/simulated/floor/vault)||istype(src,/turf/simulated/wall/vault)) //HACK!!! - return +/atom + var/list/canSmoothWith=list() // TYPE PATHS I CAN SMOOTH WITH~~~~~ - var/junction = 0 //will be used to determine from which side the wall is connected to other walls +// MOVED INTO UTILITY FUNCTION FOR LESS DUPLICATED CODE. +/atom/proc/findSmoothingNeighbors() + // THIS IS A BITMAP BECAUSE NORTH/SOUTH/ETC ARE ALL BITFLAGS BECAUSE BYOND IS DUMB AND + // DOESN'T FUCKING MAKE SENSE, BUT IT WORKS TO OUR ADVANTAGE + var/junction = 0 + for(var/cdir in cardinal) + var/turf/T = get_step(src,cdir) + if(isSmoothableNeighbor(T)) + junction |= cdir + continue // NO NEED FOR FURTHER SEARCHING IN THIS TILE + for(var/atom/A in T) + if(isSmoothableNeighbor(A)) + junction |= cdir + break // NO NEED FOR FURTHER SEARCHING IN THIS TILE - if(!istype(src,/turf/simulated/shuttle/wall)) //or else we'd have wacky shuttle merging with walls action - for(var/turf/simulated/wall/W in orange(src,1)) - if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls - junction |= get_dir(src,W) - for(var/obj/structure/falsewall/W in orange(src,1)) - if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls - junction |= get_dir(src,W) + return junction -/* Commenting this out for now until we figure out what to do with shuttle smooth walls, if anything. - As they are now, they sort of work screwy and may need further coding. Or just be scrapped.*/ - /*else - for(var/turf/simulated/shuttle/wall/W in orange(src,1)) - if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls - junction |= get_dir(src,W) - for(var/obj/machinery/shuttle/W in orange(src,1)) //stuff like engine and propulsion should merge with walls - if(abs(src.x-W.x)-abs(src.y-W.y)) - junction |= get_dir(src,W) - for(var/obj/machinery/door/W in orange(src,1)) //doors should not result in diagonal walls, it just looks ugly. checking if area is shuttle so it won't merge with the station - if((abs(src.x-W.x)-abs(src.y-W.y)) && (istype(W.loc.loc,/area/shuttle) || istype(W.loc.loc,/area/supply))) - junction |= get_dir(src,W) - for(var/obj/structure/grille/W in orange(src,1)) //same for grilles. checking if area is shuttle so it won't merge with the station - if((abs(src.x-W.x)-abs(src.y-W.y)) && (istype(W.loc.loc,/area/shuttle) || istype(W.loc.loc,/area/supply))) - junction |= get_dir(src,W)*/ +/atom/proc/isSmoothableNeighbor(var/atom/A) + return is_type_in_list(A,canSmoothWith) - if(istype(src,/turf/simulated/wall)) - var/turf/simulated/wall/wall = src - wall.icon_state = "[wall.walltype][junction]" - else if (istype(src,/obj/structure/falsewall)) - if(istype(src,/obj/structure/falsewall/reinforced)) - icon_state = "rwall[junction]" - else - var/obj/structure/falsewall/fwall = src - fwall.icon_state = "[fwall.mineral][junction]" -/* else if(istype(src,/turf/simulated/shuttle/wall)) - var/newicon = icon; - var/newiconstate = icon_state; - if(junction!=5 && junction!=6 && junction!=9 && junction!=10) //if it's not diagonal, all is well, no additional calculations needed - src.icon_state = "swall[junction]" - else //if it's diagonal, we need to figure out if we're using the floor diagonal or the space diagonal sprite - var/is_floor = 0 - for(var/turf/unsimulated/floor/F in orange(src,1)) - if(abs(src.x-F.x)-abs(src.y-F.y)) - if((15-junction) & get_dir(src,F)) //if there's a floor in at least one of the empty space directions, return 1 - is_floor = 1 - newicon = F.icon - newiconstate = F.icon_state //we'll save these for later - for(var/turf/simulated/floor/F in orange(src,1)) - if(abs(src.x-F.x)-abs(src.y-F.y)) - if((15-junction) & get_dir(src,F)) //if there's a floor in at least one of the empty space directions, return 1 - is_floor = 1 - newicon = F.icon - newiconstate = F.icon_state //we'll save these for later - for(var/turf/simulated/shuttle/floor/F in orange(src,1)) - if(abs(src.x-F.x)-abs(src.y-F.y)) - if((15-junction) & get_dir(src,F)) //if there's a floor in at least one of the empty space directions, return 1 - is_floor = 1 - newicon = F.icon - newiconstate = F.icon_state //we'll save these for later - if(is_floor) //if is_floor = 1, we use the floor diagonal sprite - src.icon = newicon; //we'll set the floor's icon to the floor next to it and overlay the wall segment. shuttle floor sprites have priority - src.icon_state = newiconstate; // - src.overlays += icon('icons/turf/shuttle.dmi',"swall_f[junction]") - else //otherwise, the space one - src.icon_state = "swall_s[junction]"*/ +/turf/simulated/wall/isSmoothableNeighbor(var/atom/A) + if(is_type_in_list(A,canSmoothWith)) + // COLON OPERATORS ARE TERRIBLE BUT I HAVE NO CHOICE + if(src.mineral == A:mineral) //mineral not walltype so reinf still smooths with normal and vice versa + return 1 + return 0 - return +/** + * WALL SMOOTHING SHIT + * + * IN /ATOM BECAUSE /TURFS ARE /ATOMS AND SO ARE /OBJ/STRUCTURE/FALSEWALLS + * THIS IS STUPID BUT IS FAIRLY ELEGANT FOR BYOND + * + * HOWEVER, INSTEAD OF MAKING ONE BIG GODDAMN MONOLITHIC PROC LIKE A FUCKING + * SHITTY FUNCTIONAL PROGRAMMER, WE WILL BE COOL AND MODERN AND USE INHERITANCE. + */ +/atom/proc/relativewall() + return // DOES JACK SHIT BY DEFAULT. OLD BEHAVIOR WAS TO SPAM LOOPS ANYWAY. +/* + * SEE? NOW WE ONLY HAVE TO PROGRAM THIS SHIT INTO WHAT WE WANT TO SMOOTH + * INSTEAD OF BEING DUMB AND HAVING A BIG FUCKING IFTREE WITH TYPECHECKS + * MY GOD, WE COULD EVEN MOVE THE CODE TO BE WITH THE REST OF THE WALL'S CODE! + * HOW FUCKING INNOVATIVE. ISN'T INHERITANCE NICE? + * + * WE COULD STANDARDIZE THIS BUT EVERYONE'S A FUCKING SNOWFLAKE + */ +/turf/simulated/wall/relativewall() + var/junction=findSmoothingNeighbors() + icon_state = "[walltype][junction]" // WHY ISN'T THIS IN UPDATE_ICON OR SIMILAR + +// AND NOW WE HAVE TO YELL AT THE NEIGHBORS FOR BEING LOUD AND NOT PAINTING WITH HOA-APPROVED COLORS /atom/proc/relativewall_neighbours() - for(var/turf/simulated/wall/W in range(src,1)) - W.relativewall() - for(var/obj/structure/falsewall/W in range(src,1)) - W.relativewall() - W.update_icon()//Refreshes the wall to make sure the icons don't desync - for(var/obj/structure/alien/resin/W in range(src,1)) - W.relativewall() - W.update_icon() - return + // OPTIMIZE BY NOT CHECKING FOR NEIGHBORS IF WE DON'T FUCKING SMOOTH + if(canSmoothWith.len>0) + relativewall() + for(var/cdir in cardinal) + var/turf/T = get_step(src,cdir) + if(isSmoothableNeighbor(T)) + T.relativewall() + for(var/atom/A in T) + if(isSmoothableNeighbor(A)) + A.relativewall() /turf/simulated/wall/New() - relativewall_neighbours() ..() + relativewall_neighbours() -/*/turf/simulated/shuttle/wall/New() +/turf/simulated/wall/Destroy() - spawn(20) //testing if this will make /obj/machinery/shuttle and /door count - It does, it stays. - if(src.icon_state in list("wall1", "wall", "diagonalWall", "wall_floor", "wall_space")) //so wizard den, syndie shuttle etc will remain black - for(var/turf/simulated/shuttle/wall/W in range(src,1)) - W.relativewall() + var/temploc = src.loc - ..()*/ - -/turf/simulated/wall/Del() - spawn(10) - for(var/turf/simulated/wall/W in range(src,1)) - W.relativewall() - - for(var/obj/structure/falsewall/W in range(src,1)) - W.relativewall() + if(!del_suppress_resmoothing) + spawn(10) + relativewall_neighbours(at=temploc) + // JESUS WHY for(var/direction in cardinal) for(var/obj/effect/glowshroom/shroom in get_step(src,direction)) if(!shroom.floor) //shrooms drop to the floor @@ -114,35 +89,15 @@ shroom.icon_state = "glowshroomf" shroom.pixel_x = 0 shroom.pixel_y = 0 + ..() -/turf/simulated/wall/relativewall() - if(istype(src,/turf/simulated/wall/vault)) //HACK!!! - return - - var/junction = 0 //will be used to determine from which side the wall is connected to other walls - - for(var/turf/simulated/wall/W in orange(src,1)) - if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls - if(src.mineral == W.mineral)//Only 'like' walls connect -Sieve - junction |= get_dir(src,W) - for(var/obj/structure/falsewall/W in orange(src,1)) - if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls - if(src.mineral == W.mineral) - junction |= get_dir(src,W) - var/turf/simulated/wall/wall = src - wall.icon_state = "[wall.walltype][junction]" +// DE-HACK +/turf/simulated/wall/vault/relativewall() return /obj/structure/alien/resin/relativewall() - - var/junction = 0 //will be used to determine from which side the wall is connected to other walls - - for(var/obj/structure/alien/resin/W in orange(src,1)) - if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls - junction |= get_dir(src,W) - var/obj/structure/alien/resin/resin = src - resin.icon_state = "[resin.resintype][junction]" - - return \ No newline at end of file + var/junction = findSmoothingNeighbors() + icon_state = "[resintype][junction]" + return diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 2acd66e25ac..6be1052605e 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -16,6 +16,14 @@ var/sheet_type = /obj/item/stack/sheet/metal var/obj/item/stack/sheet/builtin_sheet = null + + var/del_suppress_resmoothing = 0 // Do not resmooth neighbors on Destroy. (smoothwall.dm) + canSmoothWith = list( + /turf/simulated/wall, + /obj/structure/falsewall, + /obj/structure/falsewall/reinforced // WHY DO WE SMOOTH WITH FALSE R-WALLS WHEN WE DON'T SMOOTH WITH REAL R-WALLS. + ) + /turf/simulated/wall/New() ..() builtin_sheet = new sheet_type