1
0
Fork 0

TP to dark spots only on the overworld

This commit is contained in:
anarquimico 2023-03-03 21:55:56 -03:00
parent a3ab67cb55
commit 8c4f2fdd7b
1 changed files with 7 additions and 4 deletions

View File

@ -346,6 +346,7 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
end end
end end
end end
-- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE. -- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE.
if self.state == "attack" then if self.state == "attack" then
if self.attack then if self.attack then
@ -358,11 +359,13 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
end end
end end
else --if not attacking try to tp to the dark else --if not attacking try to tp to the dark
if dim == 'overworld' then
local light = minetest.get_node_light(enderpos) local light = minetest.get_node_light(enderpos)
if light and light > minetest.LIGHT_MAX then if light and light > minetest.LIGHT_MAX then
self:teleport(nil) self:teleport(nil)
end end
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.
@ -454,8 +457,8 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
if mob then if mob then
local entity = mob:get_luaentity() local entity = mob:get_luaentity()
if entity and entity.name == "mobs_mc:endermite" then if entity and entity.name == "mobs_mc:endermite" then
self.state = 'attack'
self.attack = mob self.attack = mob
self.state = 'attack'
end end
end end
end end