[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 <silent_insomnia_pp@hotmail.co.uk>
This commit is contained in:
SkyratBot
2020-09-29 12:37:35 +02:00
committed by GitHub
co-authored by Timberpoes
parent ced0a88007
commit 0ad256859f
+11 -14
View File
@@ -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, "<span class='warning'>This paint job can only be applied to non-glass airlocks.</span>")
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