Turning notes drawn in the game into a crawl-space rule
Three notes about crawl spaces became one importer rule, and two more fixed a lift car with no ceiling and a vat standing in a doorway.
I played the starting dungeon and drew six notes on the screen with the game’s note key. Three said a crawl space needed a grate or a cover, so I made that a rule in the dungeon importer. The car of a lift now has a ceiling at the same height as the door, and a vat that stood in a doorway is in a corner. The rule added eight grates in all.
Why did one note turn into a rule?
The first note said “this crawlspace needs a grate”. The second, drawn in a bathroom on the first floor, asked for a rule to always put covers on both ends of crawl spaces, and the third asked for a cover on another crawl on the third floor. Fixing three crawls by hand would have been easy, but the next crawl I draw would have the same problem. So the importer now knows what the mouth of a crawl is and covers every one that nothing else shuts.
How does the importer find a mouth?
A crawl is a tunnel of squares marked with a colon on the dungeon’s sheet. For each crawl square, DungeonFixtures.cover_mouths() looks at the four sides. A side is a mouth if the square beyond it is open and isn’t crawl, which means floor, water or a narrow passage. It runs once, after everything else on the sheet is planned.
The harder part is leaving alone a mouth that is already shut, because a sheet can shut one in several ways. mouth_shut_by() counts a window, a grate, the choke, a laser wall, a broken door or a door, as long as it stands across the way and sits on the crawl’s square or the one outside it. It also counts a lift’s stop on the outside, because the lift has walls. A cover on the crawl’s square only shuts the side its face is on, unless the sheet gave it a second face.
That last rule is why the bathroom crawl got a grate. Its cover had one face, so the far end was open, and the rule covers it.
Every other mouth gets a vent grate. It’s a thing of the plan like any cover a sheet lists, so it’s built by the same code, seen through and shot through, and pulled off by hand for good. I gave it an id made from the dungeon, the crawl’s square and the side, like <dungeon>_cover_9_12_east. It isn’t a counter, because a save remembers which covers were pulled off by id, and a counter would shift if a mouth were ever added or removed.
The rule added five grates on the first floor of the Breakout Site, one on the third and two in the Marrow Galleries. A sheet can’t leave a mouth open. It shuts it some other way, or the rule does it.
Several tests had to change, because they counted covers or walked a crawl that now has a grate on it. The first floor’s covers went from 4 to 9 and the third floor’s from 0 to 1. The new test holds every dungeon on file to the rule in 99 checks.
Why was the lift car lower than the door?
My two notes on the lift were that its ceiling was missing and that the car was lower than the door, which would make a weird edge where the two meet. The car came from the kit’s lift frame, with its top rails 2.52 meters up and nothing over them. The doorway is 2.9 meters high.
I didn’t change a model. The code draws the kit’s frame 2.9 / 2.52 taller and lays the kit’s ceiling piece inside it, with its beams level with the rails. The plain car used where there is no kit is built to the same height, and the car has a solid ceiling now. The car moved up and the door stayed where it was. The test measured all four lifts on the Breakout Site at both stops, and the car’s top meets the door’s head at each.
Which vat did the note mean?
The note said a vat was in front of the doorway and should go in the corner under the pipe. I assumed it was the juice vat the party climbs out of, but it wasn’t. I took a still from the spot and angle where I drew the note, and it showed a small vat from the surgery’s dressing, standing beside the east doorway. The juice vat, the start square and the wipe are all as they were.
I moved the small vat from 23.0 meters east and 7.5 south of the room’s corner to 22.9 and 13.8, and turned it from -90 to -135 degrees. It stands in the south-east corner under the yellow feed pipe and faces the room.
What’s left
A switch that works a cover on one end of a crawl doesn’t take the rule’s grate on the other end. No dungeon has a switch like that yet, so I filed it and left it. The whole test suite wasn’t clean before this landed. The 22 tests whose names match this work passed on the merged result, and a few other tests that count doors and covers needed the same fix as the ones above.