Allow webs to be placed without a giant spider on them

Allow creating webs without spiders in the lua level scripts:

des.trap({ type = "web", spider_on_web = 0 });

Based on xNetHack commit by copperwater <aosdict@gmail.com>.

Also changes the Spider nest themed room to generate without
spiders when the level difficulty is 8 or less.
This commit is contained in:
Pasi Kallinen
2021-05-10 17:48:47 +03:00
parent 09b71fcc95
commit 1e1d580336
6 changed files with 29 additions and 15 deletions

View File

@@ -1686,6 +1686,7 @@ create_trap(spltrap* t, struct mkroom* croom)
{
xchar x = -1, y = -1;
coord tm;
int mktrap_flags = MKTRAP_MAZEFLAG;
if (croom) {
get_free_room_loc(&x, &y, croom, t->coord);
@@ -1700,10 +1701,13 @@ create_trap(spltrap* t, struct mkroom* croom)
return;
}
if (!t->spider_on_web)
mktrap_flags |= MKTRAP_NOSPIDERONWEB;
tm.x = x;
tm.y = y;
mktrap(t->type, 1, (struct mkroom *) 0, &tm);
mktrap(t->type, mktrap_flags, (struct mkroom *) 0, &tm);
}
/*
@@ -3995,6 +3999,7 @@ get_traptype_byname(const char *trapname)
}
/* trap({ type = "hole", x = 1, y = 1 }); */
/* trap({ type = "web", spider_on_web = 0 }); */
/* trap("hole", 3, 4); */
/* trap("level teleport", {5, 8}); */
/* trap("rust") */
@@ -4008,6 +4013,8 @@ lspo_trap(lua_State* L)
create_des_coder();
tmptrap.spider_on_web = TRUE;
if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) {
const char *trapstr = luaL_checkstring(L, 1);
@@ -4030,6 +4037,8 @@ lspo_trap(lua_State* L)
get_table_xy_or_coord(L, &x, &y);
tmptrap.type = get_table_traptype_opt(L, "type", -1);
tmptrap.spider_on_web
= get_table_boolean_opt(L, "spider_on_web", 1);
}
if (tmptrap.type == NO_TRAP)