diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index 3b59bdbcec..770442f6c9 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -11,7 +11,7 @@ var/mineral_amount = 2 var/walltype = /turf/closed/wall var/girder_type = /obj/structure/girder/displaced - var/opening = 0 + var/opening = FALSE density = TRUE opacity = 1 max_integrity = 100 @@ -50,43 +50,38 @@ if(opening) return - opening = 1 - if(density) - do_the_flick() - sleep(5) - if(!QDELETED(src)) - density = FALSE - set_opacity(0) - update_icon() - else + opening = TRUE + update_icon() + if(!density) var/srcturf = get_turf(src) for(var/mob/living/obstacle in srcturf) //Stop people from using this as a shield - opening = 0 + opening = FALSE return - do_the_flick() - density = TRUE - sleep(5) - if(!QDELETED(src)) - set_opacity(1) - update_icon() + addtimer(CALLBACK(src, /obj/structure/falsewall/proc/toggle_open), 5) air_update_turf(1) - opening = 0 -/obj/structure/falsewall/proc/do_the_flick() - if(density) - smooth = SMOOTH_FALSE - clear_smooth_overlays() - icon_state = "fwall_opening" - else - icon_state = "fwall_closing" +/obj/structure/falsewall/proc/toggle_open() + if(!QDELETED(src)) + density = !density + set_opacity(density) + opening = FALSE + update_icon() /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 = SMOOTH_TRUE - queue_smooth(src) - icon_state = initial(icon_state) + if(opening) + if(density) + icon_state = "fwall_opening" + smooth = SMOOTH_FALSE + clear_smooth_overlays() + else + icon_state = "fwall_closing" else - icon_state = "fwall_open" + if(density) + icon_state = initial(icon_state) + smooth = SMOOTH_TRUE + queue_smooth(src) + else + icon_state = "fwall_open" /obj/structure/falsewall/proc/ChangeToWall(delete = 1) var/turf/T = get_turf(src)