mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-26 02:30:21 +01:00
if mob standing, 1 in 4 chance of looking at player nearby
This commit is contained in:
parent
093285bec9
commit
7490006117
16
api.lua
16
api.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
-- Mobs Api (5th January 2017)
|
-- Mobs Api (6th January 2017)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
@ -1272,17 +1272,13 @@ local do_states = function(self, dtime)
|
|||||||
|
|
||||||
local lp = nil
|
local lp = nil
|
||||||
local s = self.object:getpos()
|
local s = self.object:getpos()
|
||||||
|
local objs = minetest.get_objects_inside_radius(s, 3)
|
||||||
|
|
||||||
if self.type == "npc" then
|
for n = 1, #objs do
|
||||||
|
|
||||||
local objs = minetest.get_objects_inside_radius(s, 3)
|
if objs[n]:is_player() then
|
||||||
|
lp = objs[n]:getpos()
|
||||||
for n = 1, #objs do
|
break
|
||||||
|
|
||||||
if objs[n]:is_player() then
|
|
||||||
lp = objs[n]:getpos()
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user