diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index 97b8e8ae283..09c6c4e1973 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -1,10 +1,26 @@ -/atom/var/smooth = 0 +//Redefinitions of the diagonal directions so they can be stored in one var without conflicts +#define NORTH_EAST 16 +#define NORTH_WEST 32 +#define SOUTH_EAST 64 +#define SOUTH_WEST 128 + +#define SMOOTH_FALSE 0 //not smooth +#define SMOOTH_TRUE 1 //smooths with exact specified types or just itself +#define SMOOTH_MORE 2 //smooths with all subtypes of specified types or just itself + +/atom/var/smooth = SMOOTH_FALSE /atom/var/top_left_corner /atom/var/top_right_corner /atom/var/bottom_left_corner /atom/var/bottom_right_corner /atom/var/can_be_unanchored = 0 -/atom/var/list/canSmoothWith=list() // TYPE PATHS I CAN SMOOTH WITH~~~~~ +/atom/var/list/canSmoothWith = null // TYPE PATHS I CAN SMOOTH WITH~~~~~ If this is null and atom is smooth, it smooths only with itself + +/atom/proc/clear_smooth_overlays() + overlays -= top_left_corner + overlays -= top_right_corner + overlays -= bottom_right_corner + overlays -= bottom_left_corner //generic (by snowflake) tile smoothing code; smooth your icons with this! /* @@ -16,12 +32,6 @@ Each atom has its own icon file with all the possible corner states. See 'smooth_wall.dmi' for a template. */ -//Redefinitions of the diagonal directions so they can be stored in one var without conflicts -#define NORTH_EAST 16 -#define NORTH_WEST 32 -#define SOUTH_EAST 64 -#define SOUTH_WEST 128 - /proc/calculate_adjacencies(atom/A) if(!A.loc) return 0 @@ -54,7 +64,7 @@ if(A && A.smooth) var/adjacencies = calculate_adjacencies(A) - clear_overlays(A) + A.clear_smooth_overlays() A.top_left_corner = make_nw_corner(adjacencies) A.top_right_corner = make_ne_corner(adjacencies) @@ -78,8 +88,6 @@ sdir = "n" else if(adjacencies & WEST) sdir = "w" - else - sdir = "i" return "1-[sdir]" /proc/make_ne_corner(adjacencies) @@ -94,8 +102,6 @@ sdir = "n" else if(adjacencies & EAST) sdir = "e" - else - sdir = "i" return "2-[sdir]" /proc/make_sw_corner(adjacencies) @@ -110,8 +116,6 @@ sdir = "s" else if(adjacencies & WEST) sdir = "w" - else - sdir = "i" return "3-[sdir]" /proc/make_se_corner(adjacencies) @@ -127,8 +131,6 @@ else if(adjacencies & EAST) sdir = "e" - else - sdir = "i" return "4-[sdir]" /proc/smooth_icon_neighbors(atom/A) @@ -153,14 +155,21 @@ var/turf/target_turf = locate(source.x + x_offset, source.y + y_offset, source.z) if(source.canSmoothWith) var/atom/A - for(var/a_type in source.canSmoothWith) - if(ispath(a_type, /turf)) - if(a_type == target_turf.type) + if(source.smooth == SMOOTH_MORE) + for(var/a_type in source.canSmoothWith) + if( istype(target_turf, a_type) ) return target_turf - else A = locate(a_type) in target_turf - if(A && A.type == a_type) + if(A) return A + return null + + for(var/a_type in source.canSmoothWith) + if(a_type == target_turf.type) + return target_turf + A = locate(a_type) in target_turf + if(A && A.type == a_type) + return A return null else if(isturf(source)) @@ -168,12 +177,6 @@ var/atom/A = locate(source.type) in target_turf return A && A.type == source.type ? A : null -/proc/clear_overlays(atom/A) - A.overlays -= A.top_left_corner - A.overlays -= A.top_right_corner - A.overlays -= A.bottom_right_corner - A.overlays -= A.bottom_left_corner - /proc/transform_dir(direction) switch(direction) if(NORTH,SOUTH,EAST,WEST) diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index bcc7684a474..bba12958987 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -29,7 +29,7 @@ canSmoothWith = list(/obj/structure/alien/resin) var/health = 200 var/resintype = null - smooth = 1 + smooth = SMOOTH_TRUE /obj/structure/alien/resin/New(location) diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index a18944a8a08..572e5b47c96 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -19,7 +19,7 @@ /obj/structure/falsewall/reinforced, // WHY DO WE SMOOTH WITH FALSE R-WALLS WHEN WE DON'T SMOOTH WITH REAL R-WALLS. /turf/simulated/wall/rust, /turf/simulated/wall/r_wall/rust) - smooth = 1 + smooth = SMOOTH_TRUE can_be_unanchored = 0 /obj/structure/falsewall/attack_hand(mob/user) @@ -49,15 +49,15 @@ /obj/structure/falsewall/proc/do_the_flick() if(density) - smooth = 0 - clear_overlays(src) + smooth = SMOOTH_FALSE + clear_smooth_overlays() icon_state = "fwall_opening" else icon_state = "fwall_closing" /obj/structure/falsewall/update_icon()//Calling icon_update will refresh the smoothwalls if it's closed, otherwise it will make sure the icon is correct if it's open if(density) - smooth = 1 + smooth = SMOOTH_TRUE smooth_icon(src) icon_state = "" else diff --git a/code/game/objects/structures/lattice.dm b/code/game/objects/structures/lattice.dm index e2bfe2bd922..88df0be7753 100644 --- a/code/game/objects/structures/lattice.dm +++ b/code/game/objects/structures/lattice.dm @@ -8,18 +8,10 @@ layer = 2.3 //under pipes var/obj/item/stack/rods/stored canSmoothWith = list(/obj/structure/lattice, - /obj/structure/lattice/catwalk, - /turf/simulated/floor/plating, - /turf/simulated/floor/plating/airless, + /turf/simulated/floor, /turf/simulated/wall, - /turf/simulated/wall/r_wall, - /turf/simulated/floor/plasteel, - /turf/simulated/floor/plasteel/airless, - /obj/structure/falsewall, - /obj/structure/falsewall/reinforced, - /turf/simulated/wall/rust, - /turf/simulated/wall/r_wall/rust) - smooth = 1 + /obj/structure/falsewall) + smooth = SMOOTH_MORE // flags = CONDUCT /obj/structure/lattice/New() @@ -75,6 +67,7 @@ desc = "A catwalk for easier EVA manuevering and cable placement." icon = 'icons/obj/smooth_structures/catwalk.dmi' icon_state = "catwalk" + smooth = SMOOTH_TRUE canSmoothWith = null /obj/structure/lattice/catwalk/Move() diff --git a/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm b/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm index 1f83bdc4ae5..6b162073478 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm @@ -6,7 +6,7 @@ icon = 'icons/obj/smooth_structures/alien/nest.dmi' icon_state = "nest" var/health = 100 - smooth = 1 + smooth = SMOOTH_TRUE can_be_unanchored = 0 canSmoothWith = null var/image/nest_overlay diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index db2b2cec8ea..0323a0af322 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -28,7 +28,7 @@ var/buildstackamount = 1 var/framestackamount = 2 var/mob/tableclimber - smooth = 1 + smooth = SMOOTH_TRUE canSmoothWith = list(/obj/structure/table, /obj/structure/table/reinforced) /obj/structure/table/New() diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 89f53865e2d..6fe9029ffe5 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -441,7 +441,7 @@ dir = 5 maxhealth = 50 fulltile = 1 - smooth = 1 + smooth = SMOOTH_TRUE canSmoothWith = list(/obj/structure/window/fulltile, /obj/structure/window/reinforced/fulltile, /obj/structure/window/reinforced/tinted/fulltile) /obj/structure/window/reinforced/fulltile @@ -450,7 +450,7 @@ dir = 5 maxhealth = 100 fulltile = 1 - smooth = 1 + smooth = SMOOTH_TRUE canSmoothWith = list(/obj/structure/window/fulltile, /obj/structure/window/reinforced/fulltile, /obj/structure/window/reinforced/tinted/fulltile) /obj/structure/window/reinforced/tinted/fulltile @@ -458,7 +458,7 @@ icon_state = "tinted_window" dir = 5 fulltile = 1 - smooth = 1 + smooth = SMOOTH_TRUE canSmoothWith = list(/obj/structure/window/fulltile, /obj/structure/window/reinforced/fulltile, /obj/structure/window/reinforced/tinted/fulltile) /obj/structure/window/shuttle @@ -471,6 +471,6 @@ wtype = "shuttle" fulltile = 1 reinf = 1 - smooth = 1 + smooth = SMOOTH_TRUE canSmoothWith = null explosion_block = 1 diff --git a/code/game/turfs/simulated/floor/fancy_floor.dm b/code/game/turfs/simulated/floor/fancy_floor.dm index 05a0c9d9c51..4957b569f29 100644 --- a/code/game/turfs/simulated/floor/fancy_floor.dm +++ b/code/game/turfs/simulated/floor/fancy_floor.dm @@ -47,7 +47,7 @@ icon_state = "carpet" floor_tile = /obj/item/stack/tile/carpet broken_states = list("damaged") - smooth = 1 + smooth = SMOOTH_TRUE canSmoothWith = null /turf/simulated/floor/carpet/New() diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index f781d4e3501..660affca6bf 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -25,7 +25,7 @@ /obj/structure/falsewall/reinforced, /turf/simulated/wall/rust, /turf/simulated/wall/r_wall/rust) - smooth = 1 + smooth = SMOOTH_TRUE /turf/simulated/wall/New() ..() diff --git a/code/game/turfs/simulated/walls_mineral.dm b/code/game/turfs/simulated/walls_mineral.dm index a63fc834bff..b072b44a757 100644 --- a/code/game/turfs/simulated/walls_mineral.dm +++ b/code/game/turfs/simulated/walls_mineral.dm @@ -4,8 +4,8 @@ icon_state = "" var/last_event = 0 var/active = null - smooth = 1 canSmoothWith = null + smooth = SMOOTH_TRUE /turf/simulated/wall/mineral/New() sheet_type = text2path("/obj/item/stack/sheet/mineral/[mineral]") diff --git a/code/game/turfs/simulated/walls_misc.dm b/code/game/turfs/simulated/walls_misc.dm index 0e87a2adf62..85e46a81449 100644 --- a/code/game/turfs/simulated/walls_misc.dm +++ b/code/game/turfs/simulated/walls_misc.dm @@ -45,7 +45,7 @@ icon = 'icons/turf/shuttle.dmi' icon_state = "wall1" walltype = "shuttle" - smooth = 0 + smooth = SMOOTH_FALSE //sub-type to be used for interior shuttle walls //won't get an underlay of the destination turf on shuttle move diff --git a/code/game/turfs/simulated/walls_reinforced.dm b/code/game/turfs/simulated/walls_reinforced.dm index 4f3cef263cb..0a38bd12535 100644 --- a/code/game/turfs/simulated/walls_reinforced.dm +++ b/code/game/turfs/simulated/walls_reinforced.dm @@ -215,10 +215,10 @@ /turf/simulated/wall/r_wall/proc/update_icon() if(d_state) icon_state = "r_wall-[d_state]" - smooth = 0 - clear_overlays(src) + smooth = SMOOTH_FALSE + clear_smooth_overlays() else - smooth = 1 + smooth = SMOOTH_TRUE icon_state = "" /turf/simulated/wall/r_wall/singularity_pull(S, current_size) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index f3d04c5626b..b12a917fb19 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -317,8 +317,7 @@ /turf/indestructible/riveted/uranium icon = 'icons/turf/walls/uranium_wall.dmi' icon_state = "uranium" - smooth = 1 - canSmoothWith = null + smooth = SMOOTH_TRUE /turf/indestructible/abductor icon_state = "alien1"