From d0022db2a5633333ab2aa7ae6b5647d286415e88 Mon Sep 17 00:00:00 2001 From: anarquimico Date: Thu, 2 Mar 2023 08:28:06 -0300 Subject: [PATCH 1/7] Make enderman hostile towards endermites --- mods/ENTITIES/mobs_mc/enderman.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 873255862..36876f420 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -297,6 +297,7 @@ mcl_mobs.register_mob("mobs_mc:enderman", { run_velocity = 3.4, damage = 7, reach = 2, + -- specific_attack = "mobs_mc:endermite", particlespawners = psdefs, drops = { {name = "mcl_throwing:ender_pearl", @@ -387,6 +388,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 +446,20 @@ mcl_mobs.register_mob("mobs_mc:enderman", { end end + -- ATTACK ENDERMITE + local enderpos = self.object:get_pos() + 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.state = 'attack' + self.attack = mob + end + end + end + -- TAKE AND PLACE STUFF BEHAVIOUR BELOW. if not mobs_griefing then return From 8825fb98603f76c809e57f881d98abe7251bb608 Mon Sep 17 00:00:00 2001 From: anarquimico Date: Thu, 2 Mar 2023 08:32:52 -0300 Subject: [PATCH 2/7] Removes unnecessary commentary --- mods/ENTITIES/mobs_mc/enderman.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 36876f420..8ddcabd9c 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -297,7 +297,6 @@ mcl_mobs.register_mob("mobs_mc:enderman", { run_velocity = 3.4, damage = 7, reach = 2, - -- specific_attack = "mobs_mc:endermite", particlespawners = psdefs, drops = { {name = "mcl_throwing:ender_pearl", From 5093f31f28a248150ac4fa7a45647f4af6bf97b0 Mon Sep 17 00:00:00 2001 From: anarquimico Date: Thu, 2 Mar 2023 09:20:00 -0300 Subject: [PATCH 3/7] Performance improvement --- mods/ENTITIES/mobs_mc/enderman.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 8ddcabd9c..f5aacd667 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -447,14 +447,16 @@ mcl_mobs.register_mob("mobs_mc:enderman", { -- ATTACK ENDERMITE local enderpos = self.object:get_pos() - 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.state = 'attack' - self.attack = mob + if math.random(1,20) == 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.state = 'attack' + self.attack = mob + end end end end From 16a4448c5fe92568edb8c484986396e248449838 Mon Sep 17 00:00:00 2001 From: anarquimico Date: Thu, 2 Mar 2023 09:57:33 -0300 Subject: [PATCH 4/7] Performance improvement 2 --- mods/ENTITIES/mobs_mc/enderman.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index f5aacd667..6f78ef038 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -447,7 +447,7 @@ mcl_mobs.register_mob("mobs_mc:enderman", { -- ATTACK ENDERMITE local enderpos = self.object:get_pos() - if math.random(1,20) == 1 then + 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] From 7cbeae00cc93726ba11668babcd87e83e81a9bf6 Mon Sep 17 00:00:00 2001 From: anarquimico Date: Thu, 2 Mar 2023 10:22:08 -0300 Subject: [PATCH 5/7] Fix enderman behaviour for other dimesions --- mods/ENTITIES/mobs_mc/enderman.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 6f78ef038..3adbc1e00 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -314,7 +314,7 @@ mcl_mobs.register_mob("mobs_mc:enderman", { -- RAIN DAMAGE / EVASIVE WARP BEHAVIOUR HERE. local enderpos = self.object:get_pos() local dim = mcl_worlds.pos_to_dimension(enderpos) - if dim == "overworld" then + if dim then if mcl_weather.state == "rain" or mcl_weather.state == "lightning" then local damage = true local enderpos = self.object:get_pos() From a3ab67cb558c4a60ecbbb70027d1566beaaa6fb4 Mon Sep 17 00:00:00 2001 From: anarquimico Date: Fri, 3 Mar 2023 10:03:26 -0300 Subject: [PATCH 6/7] Better fix for enderman behavior --- mods/ENTITIES/mobs_mc/enderman.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 3adbc1e00..d70bf77e9 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -314,7 +314,7 @@ mcl_mobs.register_mob("mobs_mc:enderman", { -- RAIN DAMAGE / EVASIVE WARP BEHAVIOUR HERE. local enderpos = self.object:get_pos() local dim = mcl_worlds.pos_to_dimension(enderpos) - if dim then + if dim == "overworld" then if mcl_weather.state == "rain" or mcl_weather.state == "lightning" then local damage = true local enderpos = self.object:get_pos() @@ -345,7 +345,7 @@ 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 From 8c4f2fdd7b0920d9482e75eda6246369d45c11f6 Mon Sep 17 00:00:00 2001 From: anarquimico Date: Fri, 3 Mar 2023 21:55:56 -0300 Subject: [PATCH 7/7] TP to dark spots only on the overworld --- mods/ENTITIES/mobs_mc/enderman.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index d70bf77e9..8415084e1 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -346,6 +346,7 @@ mcl_mobs.register_mob("mobs_mc:enderman", { end end end + -- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE. if self.state == "attack" then if self.attack then @@ -358,9 +359,11 @@ mcl_mobs.register_mob("mobs_mc:enderman", { end end else --if not attacking try to tp to the dark - local light = minetest.get_node_light(enderpos) - if light and light > minetest.LIGHT_MAX then - self:teleport(nil) + 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. @@ -454,8 +457,8 @@ mcl_mobs.register_mob("mobs_mc:enderman", { if mob then local entity = mob:get_luaentity() if entity and entity.name == "mobs_mc:endermite" then - self.state = 'attack' self.attack = mob + self.state = 'attack' end end end