contents = function(rm)
des.room({ type = "themed",
x = (rm.width - 1) / 2, y = (rm.height - 1) / 2,
- w = 1, h = 1, joined = 0,
+ w = 1, h = 1, joined = false,
contents = function()
if (percent(50)) then
local mons = { "M", "V", "L", "Z" };
end
end
p = placements[d(#placements)]
- des.room({ type=ltype, x=p["lx"], y=p["ly"], w=3, h=3, filled=1, joined=0,
+ des.room({ type=ltype, x=p["lx"], y=p["ly"], w=3, h=3, filled=1, joined=false,
contents = function()
des.door({ state=shopdoorstate(), wall=p["lwall"] })
end
});
- des.room({ type=rtype, x=p["rx"], y=p["ry"], w=3, h=3, filled=1, joined=0,
+ des.room({ type=rtype, x=p["rx"], y=p["ry"], w=3, h=3, filled=1, joined=false,
contents = function()
des.door({ state=shopdoorstate(), wall=p["rwall"] })
end
Example:
des.level_init({ style = "solidfill", fg = " " });
- des.level_init({ style = "mines", fg = ".", bg = "}", smoothed=1, joined=1, lit=0 })
+ des.level_init({ style = "mines", fg = ".", bg = "}", smoothed=true, joined=true, lit=0 })
des.level_init({ style = "maze", corrwid = 3, wallthick = 1, deadends = false });
=== levregion
| yalign | Vertical alignment on a rough 3x3 grid. Default is "random".
| lit | Is the room lit or unlit? Defaults to -1 (random).
| filled | Is the room filled as per the room type. Defaults to 1 (filled).
-| joined | Is the room joined to the rest of the level with corridors? Default is 1 (joined).
+| joined | Is the room joined to the rest of the level with corridors? Default is true.
| contents | A function called with one parameter, a table with "width" and "height", the room width and height, excluding the walls. All coordinates in the function will be relative to the room.
|===
schar orig_rtype; /* same as rtype, but not zeroed later */
schar rlit; /* is the room lit ? */
schar needfill; /* sp_lev: does the room need filling? */
- schar needjoining; /* sp_lev */
+ boolean needjoining; /* sp_lev: should the room connect to others? */
schar doorct; /* door count */
schar fdoor; /* index for the first door of the room */
schar nsubrooms; /* number of subrooms */
Str_or_Len parent;
xchar x, y, w, h;
xchar xalign, yalign;
- xchar rtype, chance, rlit, needfill, joined;
+ xchar rtype, chance, rlit, needfill;
+ boolean joined;
} room;
struct mapfragment {
}
/* Return TRUE if a door placed at (x, y) which otherwise passes okdoor()
- * checks would be connecting into an area that was declared as joined = 0.
+ * checks would be connecting into an area that was declared as joined = false.
* Checking for this in finddpos() enables us to have rooms with sub-areas
* (such as shops) that will never randomly generate unwanted doors in order
* to connect them up to other areas.
}
/* level_init({ style = "solidfill", fg = " " }); */
-/* level_init({ style = "mines", fg = ".", bg = "}", smoothed=1, joined=1, lit=0 }) */
+/* level_init({ style = "mines", fg = ".", bg = "}", smoothed=true, joined=true, lit=0 }) */
int
lspo_level_init(lua_State* L)
{
tmproom.rlit = get_table_int_opt(L, "lit", -1);
/* theme rooms default to unfilled */
tmproom.needfill = get_table_int_opt(L, "filled", g.in_mk_themerooms ? 0 : 1);
- tmproom.joined = get_table_int_opt(L, "joined", 1);
+ tmproom.joined = get_table_boolean_opt(L, "joined", TRUE);
if (!g.coder->failed_room[g.coder->n_subroom - 1]) {
tmpcr = build_room(&tmproom, g.coder->croom);
* "lvflags_only" ==> filled=2, probably in a get_table_needfill_opt */
needfill = get_table_int_opt(L, "filled", 0);
irregular = get_table_boolean_opt(L, "irregular", 0);
- joined = get_table_boolean_opt(L, "joined", 1);
+ joined = get_table_boolean_opt(L, "joined", TRUE);
do_arrival_room = get_table_boolean_opt(L, "arrival_room", 0);
rtype = get_table_roomtype_opt(L, "type", OROOM);
rlit = get_table_int_opt(L, "lit", -1);