Fix subroom doors
Doors weren't getting added to the correct subrooms in certain cases.
Also fix one of the themerooms, because doors have to be added
after subrooms; there was a possibility of no door to the subroom(s)
in that themeroom, because the subrooms overwrote the doors in
the parent room.
Test case for the subroom doors:
Large room, with a medium subroom, with a tiny subroom inside that.
The doors go from outermost room <-> tiny innermost room <-> middle room.
des.room({ type = "ordinary", x = 1, y = 1, w = 10, h = 10,
contents = function()
des.room({ type = "ordinary", w = 6, h = 6, x = 2, y = 2,
contents = function()
des.room({ type = "ordinary", w = 2, h = 2, x = 0, y = 0,
contents = function()
des.door({ state="random", wall="south", pos = 1 });
end
});
des.door({ state="random", wall="north", pos = 1 });
end
});
end
});
Before this fix:
ROOM: ndoors:1, subrooms:1
SUBROOM: ndoors:1, subrooms:1
SUBROOM: ndoors:1, subrooms:0
after this fix:
ROOM: ndoors:1, subrooms:1
SUBROOM: ndoors:1, subrooms:1
SUBROOM: ndoors:2, subrooms:0
This commit is contained in:
@@ -235,10 +235,6 @@ themerooms = {
|
||||
local hei = math.random(math.floor(rm.height / 2), rm.height - 2);
|
||||
des.room({ type = "ordinary", w = wid,h = hei, filled = 1,
|
||||
contents = function()
|
||||
des.door({ state="random", wall="all" });
|
||||
if (percent(15)) then
|
||||
des.door({ state="random", wall="all" });
|
||||
end
|
||||
if (percent(90)) then
|
||||
des.room({ type = "ordinary", filled = 1,
|
||||
contents = function()
|
||||
@@ -249,6 +245,10 @@ themerooms = {
|
||||
end
|
||||
});
|
||||
end
|
||||
des.door({ state="random", wall="all" });
|
||||
if (percent(15)) then
|
||||
des.door({ state="random", wall="all" });
|
||||
end
|
||||
end
|
||||
});
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user