diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index e483731f1c4..05173cb2c43 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -76,6 +76,12 @@ var/mineral = "metal" var/opening = 0 + canSmoothWith = list( + /turf/simulated/wall, + /obj/structure/falsewall, + /obj/structure/falserwall // WHY DO WE SMOOTH WITH FALSE R-WALLS WHEN WE DON'T SMOOTH WITH REAL R-WALLS. + ) + /obj/structure/falsewall/New() relativewall_neighbours() ..() @@ -102,22 +108,8 @@ icon_state = "[mineral]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(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) - for(var/obj/structure/falserwall/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/junction=findSmoothingNeighbors(check_minerals=1) icon_state = "[mineral][junction]" - return /obj/structure/falsewall/attack_hand(mob/user as mob) @@ -237,6 +229,11 @@ anchored = 1 var/mineral = "metal" var/opening = 0 + canSmoothWith = list( + /turf/simulated/wall, + /obj/structure/falsewall, + /obj/structure/falserwall // WHY DO WE SMOOTH WITH FALSE R-WALLS WHEN WE DON'T SMOOTH WITH REAL R-WALLS. + ) /obj/structure/falserwall/New() relativewall_neighbours() @@ -272,25 +269,8 @@ if(!density) icon_state = "frwall_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(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) - for(var/obj/structure/falserwall/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/junction=findSmoothingNeighbors() icon_state = "rwall[junction]" - return - - /obj/structure/falserwall/attackby(obj/item/weapon/W as obj, mob/user as mob) if(opening) diff --git a/code/game/smoothwall.dm b/code/game/smoothwall.dm index b06598a3ee8..c9078fa9192 100644 --- a/code/game/smoothwall.dm +++ b/code/game/smoothwall.dm @@ -1,117 +1,88 @@ -//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) - for(var/obj/structure/falserwall/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/falserwall)) - src.icon_state = "rwall[junction]" - else if (istype(src,/obj/structure/falsewall)) - 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) + 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. -/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/falserwall/W in range(src,1)) - W.relativewall() - return +/* + * 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(var/at=null) + if(!at) + at = get_turf(src) + // OPTIMIZE BY NOT CHECKING FOR NEIGHBORS IF WE DON'T FUCKING SMOOTH + if(canSmoothWith.len>0) + 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() ..() -/*/turf/simulated/shuttle/wall/New() - - 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() - - ..()*/ - /turf/simulated/wall/Destroy() -//This proc performs really badly with qdel relativewall gets called a over ten thousand times. Commenting it out until I get to figure out what exactly goes wrong here. uc -/* var/temploc = src.loc + var/temploc = src.loc - spawn(10) - for(var/turf/simulated/wall/W in range(temploc,1)) - W.relativewall() + if(!del_suppress_resmoothing) + spawn(10) + relativewall_neighbours(at=temploc) - for(var/obj/structure/falsewall/W in range(temploc,1)) - W.relativewall() -*/ + // 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 @@ -122,34 +93,6 @@ ..() -/*/turf/simulated/shuttle/wall/Destroy() - - var/temploc = src.loc - - spawn(10) - for(var/turf/simulated/shuttle/wall/W in range(temploc,1)) - W.relativewall() - - ..()*/ - -/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) - for(var/obj/structure/falserwall/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 \ No newline at end of file diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 31ed7271360..1eef5bce798 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -21,10 +21,17 @@ heat_capacity = 312500 //a little over 5 cm thick , 312500 for 1 m by 2.5 m by 0.25 m plasteel wall var/walltype = "metal" + var/hardness = 40 //lower numbers are harder. Used to determine the probability of a hulk smashing through. + var/engraving, engraving_quality //engraving on the wall + var/del_suppress_resmoothing = 0 // Do not resmooth neighbors on Destroy. (smoothwall.dm) + canSmoothWith = list( + /turf/simulated/wall, + /obj/structure/falsewall, + /obj/structure/falserwall // WHY DO WE SMOOTH WITH FALSE R-WALLS WHEN WE DON'T SMOOTH WITH REAL R-WALLS. + ) /turf/simulated/wall/Del() for(var/obj/effect/E in src) if(E.name == "Wallrot") del E - ..() /turf/simulated/wall/ChangeTurf(var/newtype) for(var/obj/effect/E in src) if(E.name == "Wallrot") del E diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 547cb02b8b2..c9726924f43 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -301,6 +301,9 @@ var/global/list/uneatable = list( gain = 2 else if(isturf(A)) var/turf/T = A + if(istype(T,/turf/simulated/wall)) + var/turf/simulated/wall/W = T + W.del_suppress_resmoothing=1 // Reduce lag from wallsmoothing. if(T.intact) for(var/obj/O in T.contents) if(O.level != 1) @@ -565,6 +568,9 @@ var/global/list/uneatable = list( O.loc = null else if(isturf(A)) var/turf/T = A + if(istype(T,/turf/simulated/wall)) + var/turf/simulated/wall/W = T + W.del_suppress_resmoothing=1 // Reduce lag from wallsmoothing. if(T.intact) for(var/obj/O in T.contents) if(O.level != 1)