summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2017-01-06 11:58:56 +0000
committerTenPlus1 <kinsellaja@yahoo.com>2017-01-06 11:58:56 +0000
commit7490006117e5b5c8c3079f378f8fb562248a7fa7 (patch)
tree1a8c6b0342345de8149dbcaf84118e979a141ac0
parent093285bec9994015ce493a30c56da46d094e55b7 (diff)
if mob standing, 1 in 4 chance of looking at player nearby
-rw-r--r--api.lua16
1 files changed, 6 insertions, 10 deletions
diff --git a/api.lua b/api.lua
index ba44b82..c9a7bec 100644
--- a/api.lua
+++ b/api.lua
@@ -1,5 +1,5 @@
--- Mobs Api (5th January 2017)
+-- Mobs Api (6th January 2017)
mobs = {}
mobs.mod = "redo"
@@ -1272,17 +1272,13 @@ local do_states = function(self, dtime)
local lp = nil
local s = self.object:getpos()
+ local objs = minetest.get_objects_inside_radius(s, 3)
- if self.type == "npc" then
-
- local objs = minetest.get_objects_inside_radius(s, 3)
-
- for n = 1, #objs do
+ for n = 1, #objs do
- if objs[n]:is_player() then
- lp = objs[n]:getpos()
- break
- end
+ if objs[n]:is_player() then
+ lp = objs[n]:getpos()
+ break
end
end