forked from VoxeLibre/VoxeLibre
Merge pull request 'make endermen TP out of sunlight' (#2563) from endermen_suntp into master
Reviewed-on: MineClone2/MineClone2#2563 Reviewed-by: MysticTempest <mystictempest@noreply.git.minetest.land>
This commit is contained in:
commit
c0edc00789
|
@ -312,24 +312,24 @@ mcl_mobs:register_mob("mobs_mc:enderman", {
|
||||||
else return end
|
else return end
|
||||||
-- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE.
|
-- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE.
|
||||||
if self.state == "attack" then
|
if self.state == "attack" then
|
||||||
--if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
|
if self.attack then
|
||||||
--self:teleport(nil)
|
local target = self.attack
|
||||||
--self.state = ""
|
local pos = target:get_pos()
|
||||||
--else
|
if pos ~= nil then
|
||||||
if self.attack then
|
if vector.distance(self.object:get_pos(), target:get_pos()) > 10 then
|
||||||
local target = self.attack
|
self:teleport(target)
|
||||||
local pos = target:get_pos()
|
|
||||||
if pos ~= nil then
|
|
||||||
if vector.distance(self.object:get_pos(), target:get_pos()) > 10 then
|
|
||||||
self:teleport(target)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--end
|
end
|
||||||
|
else --if not attacking try to tp to the dark
|
||||||
|
if minetest.get_node_light(enderpos) > minetest.LIGHT_MAX then
|
||||||
|
self:teleport(nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE.
|
-- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE.
|
||||||
-- Check for arrows and people nearby.
|
-- Check for arrows and people nearby.
|
||||||
local enderpos = self.object:get_pos()
|
|
||||||
|
enderpos = self.object:get_pos()
|
||||||
enderpos.y = enderpos.y + 1.5
|
enderpos.y = enderpos.y + 1.5
|
||||||
local objs = minetest.get_objects_inside_radius(enderpos, 2)
|
local objs = minetest.get_objects_inside_radius(enderpos, 2)
|
||||||
for n = 1, #objs do
|
for n = 1, #objs do
|
||||||
|
|
Loading…
Reference in New Issue