diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-01 20:03:07 +1000 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2009-11-01 16:20:46 +0530 |
commit | 9f6de9fef21ca311f82a0aa5cc7f5067e4e62af9 (patch) | |
tree | d5cb8fb28f29b43665766e63d47109cab3f732ea /crawl-ref/source/l_dgngrd.cc | |
parent | cc61ee4e8a90f192732d03c58984bfccf7200e4b (diff) | |
download | crawl-ref-9f6de9fef21ca311f82a0aa5cc7f5067e4e62af9.tar.gz crawl-ref-9f6de9fef21ca311f82a0aa5cc7f5067e4e62af9.zip |
Lua distance bindings, Volcano tweaks, FogMachine message tweaks.
New binding for coord.cc's distance functions (dgn.distance(x1, y1, x2, y2)), lua function "point_in_radius", accepts two dgn.point functions and a radius and returns true if point1 is in radius around point2.
Extensive tweaks to FogMachine warning messages: most now accept a "see function" as the final parameter, which should take two parameters: an x and a y. The function should return true if the player can "see" this point.
Finally, tweaks to Volcanoes: utilise see_function and dgn.point_in_radius to provide better warning for lake. Utilise greensnark's new slave/master system for chaining FogMachines together in Bunker and Village.
Signed-off-by: Darshan Shaligram <dshaligram@users.sourceforge.net>
Diffstat (limited to 'crawl-ref/source/l_dgngrd.cc')
-rw-r--r-- | crawl-ref/source/l_dgngrd.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crawl-ref/source/l_dgngrd.cc b/crawl-ref/source/l_dgngrd.cc index b8f1181fa0..7bb9a42e09 100644 --- a/crawl-ref/source/l_dgngrd.cc +++ b/crawl-ref/source/l_dgngrd.cc @@ -223,6 +223,14 @@ static int dgn_grid(lua_State *ls) LUARET1(_dgn_is_wall, boolean, feat_is_wall(static_cast<dungeon_feature_type>(luaL_checkint(ls, 1)))) +LUAFN(dgn_distance) +{ + COORDS(p1, 1, 2); + COORDS(p2, 3, 4); + lua_pushnumber(ls, distance(p1, p2)); + return (1); +} + LUAFN(_dgn_is_opaque) { COORDS(c, 1, 2); @@ -243,6 +251,7 @@ const struct luaL_reg dgn_grid_dlib[] = { "is_opaque", _dgn_is_opaque }, { "is_wall", _dgn_is_wall }, { "max_bounds", dgn_max_bounds }, +{ "distance", dgn_distance }, { NULL, NULL } }; |