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)
|
||||
end
|
||||
end
|
||||
else return end
|
||||
end
|
||||
|
||||
-- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE.
|
||||
if self.state == "attack" then
|
||||
if self.attack then
|
||||
|
@ -358,11 +359,13 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
|
|||
end
|
||||
end
|
||||
else --if not attacking try to tp to the dark
|
||||
if dim == 'overworld' then
|
||||
local light = minetest.get_node_light(enderpos)
|
||||
if light and light > minetest.LIGHT_MAX then
|
||||
self:teleport(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE.
|
||||
-- Check for arrows and people nearby.
|
||||
|
||||
|
@ -387,6 +390,7 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- PROVOKED BEHAVIOUR HERE.
|
||||
local enderpos = self.object:get_pos()
|
||||
if self.provoked == "broke_contact" then
|
||||
|
@ -444,6 +448,22 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
|
|||
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.
|
||||
if not mobs_griefing then
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue