summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dat/clua/dungeon.lua
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-11-01 20:03:07 +1000
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2009-11-01 16:20:46 +0530
commit9f6de9fef21ca311f82a0aa5cc7f5067e4e62af9 (patch)
treed5cb8fb28f29b43665766e63d47109cab3f732ea /crawl-ref/source/dat/clua/dungeon.lua
parentcc61ee4e8a90f192732d03c58984bfccf7200e4b (diff)
downloadcrawl-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/dat/clua/dungeon.lua')
-rw-r--r--crawl-ref/source/dat/clua/dungeon.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/crawl-ref/source/dat/clua/dungeon.lua b/crawl-ref/source/dat/clua/dungeon.lua
index f6892870d1..477dd69d63 100644
--- a/crawl-ref/source/dat/clua/dungeon.lua
+++ b/crawl-ref/source/dat/clua/dungeon.lua
@@ -394,3 +394,9 @@ dgn.good_scrolls = [[
w:5 scroll of immolation /
w:5 scroll of vulnerability
]]
+
+-- Returns true if point1 is inside radius(X, point2).
+function dgn.point_in_radius(point1, point2, radius)
+ return dgn.distance(point1.x, point1.y, point2.x, point2.y) <=
+ (radius*radius)+1
+end