From 2d49015d4f391c68f3efeb39b8003a828e3ed37a Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sun, 17 May 2015 06:40:42 -0700 Subject: [PATCH] Port -tg-'s port of /vg/'s smoothwall. This commit ports -tg-'s port of the /vg/ smoothwall system. An important thing to note is that we have extra code on top of the -tg- port to make it work at all, and therefore, it may not be as efficent. --- code/game/objects/effects/aliens.dm | 4 +- code/game/objects/structures/false_walls.dm | 55 +----- code/game/smoothwall.dm | 193 ++++++++------------ code/game/turfs/simulated/walls.dm | 11 ++ icons/turf/walls.dmi | Bin 272367 -> 272365 bytes 5 files changed, 94 insertions(+), 169 deletions(-) diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index 246ac489204..98c3fa337a5 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -21,8 +21,10 @@ 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() ..() @@ -46,8 +48,8 @@ resintype = "wall" /obj/structure/alien/resin/wall/New() - relativewall_neighbours() ..() + relativewall_neighbours() /obj/structure/alien/resin/wall/shadowling //For chrysalis name = "chrysalis wall" diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index d673ac3c1b9..196e5d29c3d 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -13,16 +13,19 @@ icon = 'icons/turf/walls.dmi' var/mineral = "metal" var/walltype = "metal" - var/walltype2 = "rwall" // So it also connects with rwalls, like regular walls do var/opening = 0 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() - if(!walltype2) - walltype2 = walltype - relativewall_neighbours() ..() + relativewall_neighbours() /obj/structure/falsewall/Destroy() @@ -42,16 +45,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(walltype == W.walltype || walltype2 == W.walltype)//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(walltype == W.walltype || walltype2 == W.walltype) - junction |= get_dir(src,W) + var/junction = findSmoothingNeighbors() icon_state = "[walltype][junction]" return @@ -155,7 +149,6 @@ desc = "A huge chunk of reinforced metal used to seperate rooms." icon_state = "r_wall" walltype = "rwall" - walltype2 = "metal" /obj/structure/falsewall/reinforced/ChangeToWall(delete = 1) var/turf/T = get_turf(src) @@ -164,38 +157,6 @@ qdel(src) return T -/obj/structure/falsewall/reinforced/do_the_flick() - if(density) - flick("frwall_opening", src) - else - flick("frwall_closing", src) - -/obj/structure/falsewall/reinforced/update_icon(relativewall = 1) - if(density) - icon_state = "rwall0" - src.relativewall() - else - icon_state = "frwall_open" - -/obj/structure/falsewall/reinforced/relativewall() - - 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.walltype == W.walltype || walltype2 == W.walltype)//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.walltype == W.walltype || src.walltype2 == W.walltype) - junction |= get_dir(src,W) - icon_state = "rwall[junction]" - return - /* * Uranium Falsewalls */ diff --git a/code/game/smoothwall.dm b/code/game/smoothwall.dm index 65ada91e40d..bfe03987e33 100644 --- a/code/game/smoothwall.dm +++ b/code/game/smoothwall.dm @@ -1,112 +1,84 @@ -//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. -/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 +/* + * 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 + +/atom/proc/relativewall_neighbours(var/sko=0) //SKO: Skip Optimizations + // OPTIMIZE BY NOT CHECKING FOR NEIGHBORS IF WE DON'T FUCKING SMOOTH + if(canSmoothWith.len>0 || sko) + relativewall() + for(var/cdir in cardinal) + var/turf/T = get_step(src,cdir) + if(isSmoothableNeighbor(T) || sko) + T.relativewall() + for(var/atom/A in T) + if(isSmoothableNeighbor(A) || sko) + 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() - - ..()*/ - -/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(sko=1) + // 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,33 +94,12 @@ crystal.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]" - + var/junction = findSmoothingNeighbors() + icon_state = "[resintype][junction]" return \ No newline at end of file diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index e4c61e1c754..275a247d945 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -24,14 +24,25 @@ 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/falsewall/reinforced // 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 + var/dsr=0 + if(del_suppress_resmoothing) dsr=1 ..(newtype) + if(!dsr) + relativewall_neighbours(sko=1) //Appearance diff --git a/icons/turf/walls.dmi b/icons/turf/walls.dmi index 756cc6bc68f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