Split themeroom shape from themeroom contents
Previously, the tetris-shaped rooms were always either normal rooms, or turned into shops or other special rooms in NetHack core. Now, the themed room lua code first picks the themed room (which can be a themed or shaped), and some of those will then pick a random filling (eg. ice floor, traps, corpses, 3 altars). Adds a new lua binding to create a selection picking locations in current room. The content-function in special level regions now get passed the room data as a parameter.
This commit is contained in:
22
src/sp_lev.c
22
src/sp_lev.c
@@ -6056,7 +6056,8 @@ lspo_region(lua_State *L)
|
||||
lua_getfield(L, 1, "contents");
|
||||
if (lua_type(L, -1) == LUA_TFUNCTION) {
|
||||
lua_remove(L, -2);
|
||||
if (nhl_pcall(L, 0, 0)){
|
||||
l_push_mkroom_table(L, troom);
|
||||
if (nhl_pcall(L, 1, 0)){
|
||||
impossible("Lua error: %s", lua_tostring(L, -1));
|
||||
}
|
||||
} else
|
||||
@@ -6664,6 +6665,25 @@ TODO: g.coder->croom needs to be updated
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct selectionvar *
|
||||
selection_from_mkroom(struct mkroom *croom)
|
||||
{
|
||||
struct selectionvar *sel = selection_new();
|
||||
coordxy x, y;
|
||||
|
||||
if (!croom && g.coder && g.coder->croom)
|
||||
croom = g.coder->croom;
|
||||
if (!croom)
|
||||
return sel;
|
||||
|
||||
for (y = croom->ly; y <= croom->hy; y++)
|
||||
for (x = croom->lx; x <= croom->hx; x++)
|
||||
if (isok(x, y) && !levl[x][y].edge
|
||||
&& levl[x][y].roomno == (croom - g.rooms) + ROOMOFFSET)
|
||||
selection_setpoint(x, y, sel, 1);
|
||||
return sel;
|
||||
}
|
||||
|
||||
void
|
||||
update_croom(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user