Lua: ice theme room and melting ice
Allow the ice theme room to occasionally have melting ice. Add nh.abscoord() to convert room-relative to map-absolute coords.
This commit is contained in:
@@ -1152,6 +1152,8 @@ static const struct luaL_Reg nhl_functions[] = {
|
||||
{"stop_timer_at", nhl_timer_stop_at},
|
||||
{"start_timer_at", nhl_timer_start_at},
|
||||
|
||||
{"abscoord", nhl_abs_coord},
|
||||
|
||||
{"pline", nhl_pline},
|
||||
{"verbalize", nhl_verbalize},
|
||||
{"menu", nhl_menu},
|
||||
|
||||
18
src/sp_lev.c
18
src/sp_lev.c
@@ -4922,6 +4922,24 @@ l_table_getset_feature_flag(
|
||||
}
|
||||
}
|
||||
|
||||
/* convert relative coordinate to absolute */
|
||||
int
|
||||
nhl_abs_coord(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
xchar x = -1, y = -1;
|
||||
|
||||
if (argc == 2) {
|
||||
x = (xchar) lua_tointeger(L, 1);
|
||||
y = (xchar) lua_tointeger(L, 2);
|
||||
get_location_coord(&x, &y, ANY_LOC, NULL, SP_COORD_PACK(x,y));
|
||||
} else
|
||||
nhl_error(L, "nhl_abs_coord: Wrong args");
|
||||
lua_pushinteger(L, x);
|
||||
lua_pushinteger(L, y);
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* feature("fountain", x, y); */
|
||||
/* feature("fountain", {x,y}); */
|
||||
/* feature({ type="fountain", x=NN, y=NN }); */
|
||||
|
||||
Reference in New Issue
Block a user