From 0ad256859ff2f631c018d334cef5fa719da99092 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 29 Sep 2020 12:37:35 +0200 Subject: [PATCH] [MIRROR] Airlock painter runtime fix (#1048) * Airlock painter runtime fix (#53742) Painting airlocks creates a new airlock in nullspace or something. Somewhere that doesn't have an area. Doors get their wire layout from the area they're built in. Do the math. The answer is null. There's no getting around this as a concept. At some point a door is going to built where there's no area. Wire assignment logic made more robust. If there's no area or wire assignments available, it just returns a generic door wire assignment. * Airlock painter runtime fix Co-authored-by: Timberpoes --- code/game/machinery/doors/airlock.dm | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 23d6dfe9bb8..bb0517353b4 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1210,22 +1210,19 @@ return var/airlock_type = painter.available_paint_jobs["[current_paintjob]"] // get the airlock type path associated with the airlock name the user just chose - var/obj/machinery/door/airlock/airlock = new airlock_type // we need to create a new instance of the airlock and assembly to read vars from them - var/obj/structure/door_assembly/assembly = new airlock.assemblytype + var/obj/machinery/door/airlock/airlock = airlock_type // we need to create a new instance of the airlock and assembly to read vars from them + var/obj/structure/door_assembly/assembly = initial(airlock.assemblytype) - if(airlock_material == "glass" && assembly.noglass) // prevents painting glass airlocks with a paint job that doesn't have a glass version, such as the freezer + if(airlock_material == "glass" && initial(assembly.noglass)) // prevents painting glass airlocks with a paint job that doesn't have a glass version, such as the freezer to_chat(user, "This paint job can only be applied to non-glass airlocks.") - else - // applies the user-chosen airlock's icon, overlays and assemblytype to the src airlock - painter.use_paint(user) - icon = airlock.icon - overlays_file = airlock.overlays_file - assemblytype = airlock.assemblytype - update_icon() + return - // these are just hanging around but are never placed, we need to delete them - qdel(airlock) - qdel(assembly) + // applies the user-chosen airlock's icon, overlays and assemblytype to the src airlock + painter.use_paint(user) + icon = initial(airlock.icon) + overlays_file = initial(airlock.overlays_file) + assemblytype = initial(airlock.assemblytype) + update_icon() /obj/machinery/door/airlock/CanAStarPass(obj/item/card/id/ID) //Airlock is passable if it is open (!density), bot has access, and is not bolted shut or powered off) @@ -1565,7 +1562,7 @@ */ /obj/machinery/door/airlock/proc/set_wires() var/area/source_area = get_area(src) - return new source_area.airlock_wires(src) + return source_area?.airlock_wires ? new source_area.airlock_wires(src) : new /datum/wires/airlock(src) #undef AIRLOCK_CLOSED #undef AIRLOCK_CLOSING