From e3f8960df6134385badf3ff0b6069749efb2c729 Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Wed, 29 Nov 2017 10:17:49 +0400 Subject: [PATCH] small icon smoothing optimization icon states for false walls --- code/__HELPERS/icon_smoothing.dm | 43 +++++++++++++-------- code/game/objects/structures/false_walls.dm | 21 +++++----- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index d9b7091247f..40b521f051f 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -17,8 +17,8 @@ /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 = null // TYPE PATHS I CAN SMOOTH WITH~~~~~ If this is null and atom is smooth, it smooths only with itself +/atom/movable/var/can_be_unanchored = 0 //generic (by snowflake) tile smoothing code; smooth your icons with this! /* @@ -36,25 +36,36 @@ var/adjacencies = 0 - if(A.can_be_unanchored) - var/atom/movable/AM = A - if(!AM.anchored) + var/atom/movable/AM + if(ismovableatom(A)) + AM = A + if(AM.can_be_unanchored && !AM.anchored) return 0 - for(var/direction in alldirs) - AM = find_type_in_direction(A, direction) - if(istype(AM)) - if(AM.anchored) - adjacencies |= 1 << direction + for(var/direction in cardinal) + AM = find_type_in_direction(A, direction) + if( (AM && !istype(AM)) || (istype(AM) && AM.anchored) ) + adjacencies |= 1 << direction - else - if(AM) - adjacencies |= 1 << direction + if(adjacencies & N_NORTH) + if(adjacencies & N_WEST) + AM = find_type_in_direction(A, NORTHWEST) + if( (AM && !istype(AM)) || (istype(AM) && AM.anchored) ) + adjacencies |= N_NORTHWEST + if(adjacencies & N_EAST) + AM = find_type_in_direction(A, NORTHEAST) + if( (AM && !istype(AM)) || (istype(AM) && AM.anchored) ) + adjacencies |= N_NORTHEAST - else - for(var/direction in alldirs) - if(find_type_in_direction(A, direction)) - adjacencies |= 1 << direction + if(adjacencies & N_SOUTH) + if(adjacencies & N_WEST) + AM = find_type_in_direction(A, SOUTHWEST) + if( (AM && !istype(AM)) || (istype(AM) && AM.anchored) ) + adjacencies |= N_SOUTHWEST + if(adjacencies & N_EAST) + AM = find_type_in_direction(A, SOUTHEAST) + if( (AM && !istype(AM)) || (istype(AM) && AM.anchored) ) + adjacencies |= N_SOUTHEAST return adjacencies diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index 399b23d85d4..aa661e57aa8 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -11,6 +11,7 @@ desc = "A huge chunk of metal used to seperate rooms." anchored = 1 icon = 'icons/turf/walls/wall.dmi' + icon_state = "wall" var/mineral = "metal" var/walltype = "metal" var/opening = 0 @@ -164,7 +165,7 @@ name = "uranium wall" desc = "A wall with uranium plating. This is probably a bad idea." icon = 'icons/turf/walls/uranium_wall.dmi' - icon_state = "" + icon_state = "uranium" mineral = "uranium" walltype = "uranium" var/active = null @@ -199,7 +200,7 @@ name = "gold wall" desc = "A wall with gold plating. Swag!" icon = 'icons/turf/walls/gold_wall.dmi' - icon_state = "" + icon_state = "gold" mineral = "gold" walltype = "gold" canSmoothWith = list(/obj/structure/falsewall/gold, /turf/simulated/wall/mineral/gold) @@ -208,7 +209,7 @@ name = "silver wall" desc = "A wall with silver plating. Shiny." icon = 'icons/turf/walls/silver_wall.dmi' - icon_state = "" + icon_state = "silver" mineral = "silver" walltype = "silver" canSmoothWith = list(/obj/structure/falsewall/silver, /turf/simulated/wall/mineral/silver) @@ -217,7 +218,7 @@ name = "diamond wall" desc = "A wall with diamond plating. You monster." icon = 'icons/turf/walls/diamond_wall.dmi' - icon_state = "" + icon_state = "diamond" mineral = "diamond" walltype = "diamond" canSmoothWith = list(/obj/structure/falsewall/diamond, /turf/simulated/wall/mineral/diamond) @@ -227,7 +228,7 @@ name = "plasma wall" desc = "A wall with plasma plating. This is definately a bad idea." icon = 'icons/turf/walls/plasma_wall.dmi' - icon_state = "" + icon_state = "plasma" mineral = "plasma" walltype = "plasma" canSmoothWith = list(/obj/structure/falsewall/plasma, /turf/simulated/wall/mineral/plasma, /turf/simulated/wall/mineral/alien) @@ -255,7 +256,7 @@ name = "alien wall" desc = "A strange-looking alien wall." icon = 'icons/turf/walls/plasma_wall.dmi' - icon_state = "" + icon_state = "plasma" mineral = "alien" walltype = "alien" canSmoothWith = list(/obj/structure/falsewall/alien, /turf/simulated/wall/mineral/alien) @@ -265,7 +266,7 @@ name = "bananium wall" desc = "A wall with bananium plating. Honk!" icon = 'icons/turf/walls/bananium_wall.dmi' - icon_state = "" + icon_state = "bananium" mineral = "clown" walltype = "clown" canSmoothWith = list(/obj/structure/falsewall/bananium, /turf/simulated/wall/mineral/bananium) @@ -273,7 +274,7 @@ /obj/structure/falsewall/sandstone name = "sandstone wall" desc = "A wall with sandstone plating." - icon_state = "" + icon_state = "sandstone" mineral = "sandstone" walltype = "sandstone" canSmoothWith = list(/obj/structure/falsewall/sandstone, /turf/simulated/wall/mineral/sandstone) @@ -282,7 +283,7 @@ name = "wooden wall" desc = "A wall with wooden plating. Stiff." icon = 'icons/turf/walls/wood_wall.dmi' - icon_state = "" + icon_state = "wood" mineral = "wood" walltype = "wood" canSmoothWith = list(/obj/structure/falsewall/wood, /turf/simulated/wall/mineral/wood) @@ -291,7 +292,7 @@ name = "rough metal wall" desc = "A wall with rough metal plating." icon = 'icons/turf/walls/iron_wall.dmi' - icon_state = "" + icon_state = "iron" mineral = "metal" walltype = "iron" canSmoothWith = list(/obj/structure/falsewall/iron, /turf/simulated/wall/mineral/iron)