Fix medusa levels
My recent commit broke medusa-3 and medusa-4, so fix those.
Make des.stair and des.ladder also accept hash-coordinate:
des.stair("up", {8, 10});
This commit is contained in:
@@ -36,6 +36,8 @@ place:set(08,06);
|
|||||||
place:set(66,05);
|
place:set(66,05);
|
||||||
place:set(46,15);
|
place:set(46,15);
|
||||||
|
|
||||||
|
local medloc = place:rndcoord(1);
|
||||||
|
|
||||||
des.region(selection.area(00,00,74,19),"lit")
|
des.region(selection.area(00,00,74,19),"lit")
|
||||||
-- fixup_special hack: the first room defined on a Medusa level gets some
|
-- fixup_special hack: the first room defined on a Medusa level gets some
|
||||||
-- leaderboard statues, use arrival_room to force it to be a room even though
|
-- leaderboard statues, use arrival_room to force it to be a room even though
|
||||||
@@ -54,7 +56,7 @@ des.non_diggable(selection.area(44,13,48,17))
|
|||||||
des.teleport_region({ region = {33,02,38,07}, dir="down" })
|
des.teleport_region({ region = {33,02,38,07}, dir="down" })
|
||||||
des.levregion({ region = {32,01,39,07}, type="stair-up" });
|
des.levregion({ region = {32,01,39,07}, type="stair-up" });
|
||||||
|
|
||||||
des.stair("down", place:rndcoord(1))
|
des.stair("down", medloc);
|
||||||
des.door("locked",08,08)
|
des.door("locked",08,08)
|
||||||
des.door("locked",64,05)
|
des.door("locked",64,05)
|
||||||
des.door("random",50,13)
|
des.door("random",50,13)
|
||||||
@@ -100,7 +102,7 @@ des.trap("board")
|
|||||||
des.trap("board")
|
des.trap("board")
|
||||||
des.trap()
|
des.trap()
|
||||||
--
|
--
|
||||||
des.monster({ id = "Medusa", x=mx, y=my, asleep=1 })
|
des.monster({ id = "Medusa", coord=medloc, asleep=1 })
|
||||||
des.monster("giant eel")
|
des.monster("giant eel")
|
||||||
des.monster("giant eel")
|
des.monster("giant eel")
|
||||||
des.monster("jellyfish")
|
des.monster("jellyfish")
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ for i=1,7 do
|
|||||||
des.trap()
|
des.trap()
|
||||||
end
|
end
|
||||||
--
|
--
|
||||||
des.monster("Medusa", mx, my)
|
des.monster("Medusa", place:rndcoord(1))
|
||||||
des.monster("kraken", 07,07)
|
des.monster("kraken", 07,07)
|
||||||
--
|
--
|
||||||
-- the nesting dragon
|
-- the nesting dragon
|
||||||
|
|||||||
@@ -488,6 +488,7 @@ Example:
|
|||||||
|
|
||||||
des.ladder("down");
|
des.ladder("down");
|
||||||
des.ladder("up", 6,10);
|
des.ladder("up", 6,10);
|
||||||
|
des.ladder("up", {6,10});
|
||||||
des.ladder({ x=11, y=05, dir="down" });
|
des.ladder({ x=11, y=05, dir="down" });
|
||||||
des.ladder({ coord={11, 05}, dir="down" });
|
des.ladder({ coord={11, 05}, dir="down" });
|
||||||
|
|
||||||
@@ -785,6 +786,7 @@ Example:
|
|||||||
des.stair({ dir = "down", x = 4, y = 7 });
|
des.stair({ dir = "down", x = 4, y = 7 });
|
||||||
des.stair({ dir = "down", coord = {5,12} });
|
des.stair({ dir = "down", coord = {5,12} });
|
||||||
des.stair("down", 4, 7);
|
des.stair("down", 4, 7);
|
||||||
|
des.stair("down", {4, 7});
|
||||||
|
|
||||||
=== teleport_region
|
=== teleport_region
|
||||||
|
|
||||||
|
|||||||
26
src/sp_lev.c
26
src/sp_lev.c
@@ -3833,27 +3833,29 @@ l_create_stairway(lua_State *L, boolean using_ladder)
|
|||||||
struct trap *badtrap;
|
struct trap *badtrap;
|
||||||
|
|
||||||
long scoord;
|
long scoord;
|
||||||
lua_Integer ax = -1, ay = -1;
|
int up = 0; /* default is down */
|
||||||
int up;
|
|
||||||
int ltype = lua_type(L, 1);
|
int ltype = lua_type(L, 1);
|
||||||
|
|
||||||
create_des_coder();
|
create_des_coder();
|
||||||
|
|
||||||
if (argc == 1 && ltype == LUA_TSTRING) {
|
if (argc == 1 && ltype == LUA_TTABLE) {
|
||||||
up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)];
|
lua_Integer ax = -1, ay = -1;
|
||||||
} else if (argc == 3 && ltype == LUA_TSTRING) {
|
|
||||||
up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)];
|
|
||||||
ax = luaL_checkinteger(L, 2);
|
|
||||||
ay = luaL_checkinteger(L, 3);
|
|
||||||
} else {
|
|
||||||
lcheck_param_table(L);
|
lcheck_param_table(L);
|
||||||
get_table_xy_or_coord(L, &ax, &ay);
|
get_table_xy_or_coord(L, &ax, &ay);
|
||||||
up = stairdirs2i[get_table_option(L, "dir", "down", stairdirs)];
|
up = stairdirs2i[get_table_option(L, "dir", "down", stairdirs)];
|
||||||
|
x = ax;
|
||||||
|
y = ay;
|
||||||
|
} else {
|
||||||
|
int ix = -1, iy = -1;
|
||||||
|
if (argc > 0 && ltype == LUA_TSTRING) {
|
||||||
|
up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)];
|
||||||
|
lua_remove(L, 1);
|
||||||
|
}
|
||||||
|
nhl_get_xy_params(L, &ix, &iy);
|
||||||
|
x = ix;
|
||||||
|
y = iy;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = ax;
|
|
||||||
y = ay;
|
|
||||||
|
|
||||||
if (x == -1 && y == -1) {
|
if (x == -1 && y == -1) {
|
||||||
set_ok_location_func(good_stair_loc);
|
set_ok_location_func(good_stair_loc);
|
||||||
scoord = SP_COORD_PACK_RANDOM(0);
|
scoord = SP_COORD_PACK_RANDOM(0);
|
||||||
|
|||||||
@@ -400,8 +400,10 @@ function test_stair()
|
|||||||
des.reset_level();
|
des.reset_level();
|
||||||
des.level_init();
|
des.level_init();
|
||||||
|
|
||||||
|
des.stair();
|
||||||
des.stair("up");
|
des.stair("up");
|
||||||
des.stair("down", 4, 7);
|
des.stair("down", 4, 7);
|
||||||
|
des.stair("down", {7, 7});
|
||||||
des.stair({ dir = "down", x = 5, y = 7 });
|
des.stair({ dir = "down", x = 5, y = 7 });
|
||||||
des.stair({ dir = "down", coord = {6, 7} });
|
des.stair({ dir = "down", coord = {6, 7} });
|
||||||
end
|
end
|
||||||
@@ -410,8 +412,10 @@ function test_ladder()
|
|||||||
des.reset_level();
|
des.reset_level();
|
||||||
des.level_init();
|
des.level_init();
|
||||||
|
|
||||||
|
des.ladder();
|
||||||
des.ladder("up");
|
des.ladder("up");
|
||||||
des.ladder("down", 4, 7);
|
des.ladder("down", 4, 7);
|
||||||
|
des.ladder("down", {7, 7});
|
||||||
des.ladder({ dir = "down", x = 5, y = 7 });
|
des.ladder({ dir = "down", x = 5, y = 7 });
|
||||||
des.ladder({ dir = "down", coord = {6, 7} });
|
des.ladder({ dir = "down", coord = {6, 7} });
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user