Added another mode for smoothing (smooth with all subtypes).

This commit is contained in:
xxalpha
2015-09-23 00:55:10 +01:00
parent fc073def62
commit 36ae116a48
13 changed files with 54 additions and 59 deletions
+31 -28
View File
@@ -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)
+1 -1
View File
@@ -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)
+4 -4
View File
@@ -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
+4 -11
View File
@@ -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()
@@ -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
+1 -1
View File
@@ -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()
+4 -4
View File
@@ -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
@@ -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()
+1 -1
View File
@@ -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()
..()
+1 -1
View File
@@ -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]")
+1 -1
View File
@@ -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
@@ -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)
+1 -2
View File
@@ -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"