summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2015-01-15 22:39:19 -0800
committerAuke Kok <auke-jan.h.kok@intel.com>2015-01-15 22:39:19 -0800
commit53cfc8f32747f985a59ac640f4d30f7ed109728b (patch)
tree743d24d21e820f87b7c362991b4a8d57c5bae56b
parent0ab05bc3355d8540388ff684a977225b9bf6582c (diff)
Discard attempts outside circle radius, instead of square
-rw-r--r--init.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index c29d931..a930679 100644
--- a/init.lua
+++ b/init.lua
@@ -222,6 +222,11 @@ local function sed()
z = math.random(playerpos.z - radius, playerpos.z + radius)
}
+ -- keep it in a real circle
+ if (pos.x - playerpos.x) * (pos.x - playerpos.x) + (pos.z - playerpos.z) * (pos.z - playerpos.z) > radius * radius then
+ return
+ end
+
stat_considered = stat_considered + 1
-- force load map