forked from VoxeLibre/VoxeLibre
Merge pull request 'Make enderman hostile towards endermites and fix it's behavior on other dimensions' (#3501) from anarquimico/MineClone2:enderman_hostile_endermite into master
Reviewed-on: MineClone2/MineClone2#3501 Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
commit
e15d0cd5a0
|
@ -345,7 +345,8 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
|
||||||
self:teleport(nil)
|
self:teleport(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else return 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,9 +359,11 @@ 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
|
||||||
local light = minetest.get_node_light(enderpos)
|
if dim == 'overworld' then
|
||||||
if light and light > minetest.LIGHT_MAX then
|
local light = minetest.get_node_light(enderpos)
|
||||||
self:teleport(nil)
|
if light and light > minetest.LIGHT_MAX then
|
||||||
|
self:teleport(nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE.
|
-- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE.
|
||||||
|
@ -387,6 +390,7 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- PROVOKED BEHAVIOUR HERE.
|
-- PROVOKED BEHAVIOUR HERE.
|
||||||
local enderpos = self.object:get_pos()
|
local enderpos = self.object:get_pos()
|
||||||
if self.provoked == "broke_contact" then
|
if self.provoked == "broke_contact" then
|
||||||
|
@ -444,6 +448,22 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- ATTACK ENDERMITE
|
||||||
|
local enderpos = self.object:get_pos()
|
||||||
|
if math.random(1,140) == 1 then
|
||||||
|
local mobsnear = minetest.get_objects_inside_radius(enderpos, 64)
|
||||||
|
for n=1, #mobsnear do
|
||||||
|
local mob = mobsnear[n]
|
||||||
|
if mob then
|
||||||
|
local entity = mob:get_luaentity()
|
||||||
|
if entity and entity.name == "mobs_mc:endermite" then
|
||||||
|
self.attack = mob
|
||||||
|
self.state = 'attack'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- TAKE AND PLACE STUFF BEHAVIOUR BELOW.
|
-- TAKE AND PLACE STUFF BEHAVIOUR BELOW.
|
||||||
if not mobs_griefing then
|
if not mobs_griefing then
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue