diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index c27c2fabf3a..e1c04a98bc3 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -38,9 +38,12 @@ var/autoset_access = TRUE // Determines whether the door will automatically set its access from the areas surrounding it. Can be used for mapping. - //Multi-tile doors + // Multi-tile doors dir = SOUTH + /// Width of the door in tiles. var/width = 1 + /// layer view blocking fillers for multi-tile doors. + var/list/fillers //Used for intercepting clicks on our turf. Set 0 to disable click interception var/turf_hand_priority = 3 @@ -73,13 +76,7 @@ layer = open_layer - if(width > 1) - if(dir in list(EAST, WEST)) - bound_width = width * world.icon_size - bound_height = world.icon_size - else - bound_width = world.icon_size - bound_height = width * world.icon_size + update_bounds() if (turf_hand_priority) set_extension(src, /datum/extension/turf_hand, turf_hand_priority) @@ -430,13 +427,19 @@ do_animate("opening") icon_state = "door0" set_opacity(0) + if(width > 1) + set_fillers_opacity(0) sleep(animation_time*0.3) src.set_density(0) + if(width > 1) + set_fillers_density(0) update_nearby_tiles() sleep(animation_time*0.7) src.layer = open_layer update_icon() set_opacity(0) + if(width > 1) + set_fillers_opacity(0) operating = 0 if(autoclose) @@ -457,12 +460,16 @@ do_animate("closing") sleep(animation_time*0.3) src.set_density(1) + if(width > 1) + set_fillers_density(1) src.layer = closed_layer update_nearby_tiles() sleep(animation_time*0.7) update_icon() if(visible && !glass) set_opacity(1) //caaaaarn! + if(width > 1) + set_fillers_opacity(1) operating = 0 //I shall not add a check every x ticks if a door has closed over some fire. @@ -501,15 +508,9 @@ /obj/machinery/door/Move(new_loc, new_dir) update_nearby_tiles() + update_bounds() . = ..() - if(width > 1) - if(dir in list(EAST, WEST)) - bound_width = width * world.icon_size - bound_height = world.icon_size - else - bound_width = world.icon_size - bound_height = width * world.icon_size if(.) deconstruct(null, TRUE) @@ -592,6 +593,67 @@ toggle() return TRUE +/** + * Checks which way the airlock is facing and adjusts the direction accordingly. + * For use with multi-tile airlocks. + */ +/obj/machinery/door/proc/get_adjusted_dir(dir) + if(dir in list(NORTH, SOUTH)) + return EAST + else + return NORTH + +/** + * Sets the bounds of the airlock. For use with multi-tile airlocks. + * If the airlock is multi-tile, it will set the bounds to be the size of the airlock. + * If the airlock doesn't already have fillers, it will create them. + * If the airlock already has fillers, it will move them to the correct location. + */ +/obj/machinery/door/proc/update_bounds() + if(width <= 1) + return + + if(dir in list(NORTH, SOUTH)) + bound_width = width * world.icon_size + bound_height = world.icon_size + else + bound_width = world.icon_size + bound_height = width * world.icon_size + + LAZYINITLIST(fillers) + + var/adjusted_dir = get_adjusted_dir(dir) + var/obj/last_filler = src + for(var/i = 1, i < width, i++) + var/obj/airlock_filler_object/filler + + if(length(fillers) < i) + filler = new + filler.pair_airlock(src) + fillers.Add(filler) + else + filler = fillers[i] + + filler.loc = get_step(last_filler, adjusted_dir) + filler.density = density + filler.set_opacity(opacity) + + last_filler = filler + +/obj/machinery/door/proc/set_fillers_density(density) + if(!length(fillers)) + return + + for(var/obj/airlock_filler_object/filler as anything in fillers) + filler.density = density + +/obj/machinery/door/proc/set_fillers_opacity(opacity) + if(!length(fillers)) + return + + for(var/obj/airlock_filler_object/filler as anything in fillers) + filler.set_opacity(opacity) + // Public access /decl/public_access/public_method/open_door diff --git a/code/game/machinery/doors/multi_tile.dm b/code/game/machinery/doors/multi_tile.dm index ef05b92d28b..3eae3938832 100644 --- a/code/game/machinery/doors/multi_tile.dm +++ b/code/game/machinery/doors/multi_tile.dm @@ -20,23 +20,6 @@ opacity = 1 assembly_type = /obj/structure/door_assembly/multi_tile -/obj/machinery/door/airlock/multi_tile/New() - ..() - SetBounds() - -/obj/machinery/door/airlock/multi_tile/Move() - . = ..() - SetBounds() - -/obj/machinery/door/airlock/multi_tile/proc/SetBounds() - if(dir in list(NORTH, SOUTH)) - bound_width = width * world.icon_size - bound_height = world.icon_size - else - bound_width = world.icon_size - bound_height = width * world.icon_size - - /obj/machinery/door/airlock/multi_tile/on_update_icon(state=0, override=0) ..() if(connections in list(NORTH, SOUTH, NORTH|SOUTH)) @@ -81,6 +64,55 @@ dirs |= direction connections = dirs +/obj/airlock_filler_object + name = "airlock fluff" + desc = "You shouldn't be able to see this fluff!" + icon = null + icon_state = null + density = TRUE + opacity = TRUE + anchored = TRUE + invisibility = INVISIBILITY_MAXIMUM + atmos_canpass = CANPASS_DENSITY + /// The door/airlock this fluff panel is attached to + var/obj/machinery/door/filled_airlock + +/obj/airlock_filler_object/Bumped(atom/A) + if(isnull(filled_airlock)) + crash_with("Someone bumped into an airlock filler with no parent airlock specified!") + return filled_airlock.Bumped(A) + +/obj/airlock_filler_object/Destroy() + filled_airlock = null + return ..() + +/// Multi-tile airlocks pair with a filler panel, if one goes so does the other. +/obj/airlock_filler_object/proc/pair_airlock(obj/machinery/door/parent_airlock) + if(isnull(parent_airlock)) + crash_with("Attempted to pair an airlock filler with no parent airlock specified!") + + filled_airlock = parent_airlock + GLOB.destroyed_event.register(filled_airlock, src, .proc/no_airlock) + +/obj/airlock_filler_object/proc/no_airlock() + GLOB.destroyed_event.unregister(filled_airlock, src) + qdel_self() + +/// Multi-tile airlocks (using a filler panel) have special handling for movables with PASS_FLAG_GLASS +/obj/airlock_filler_object/CanPass(atom/movable/mover, turf/target) + . = ..() + if(.) + return + + if(istype(mover) && mover.checkpass(PASS_FLAG_GLASS)) + return !opacity + +/obj/airlock_filler_object/singularity_act() + return + +/obj/airlock_filler_object/singularity_pull(S, current_size) + return + /obj/machinery/door/airlock/multi_tile/command door_color = COLOR_COMMAND_BLUE @@ -133,7 +165,8 @@ /obj/machinery/door/airlock/multi_tile/glass name = "Glass Airlock" hitsound = 'sound/effects/Glasshit.ogg' - glass = 1 + glass = TRUE + opacity = 0 /obj/machinery/door/airlock/multi_tile/glass/command door_color = COLOR_COMMAND_BLUE