From fcd9854e7c1a185dc05fc38fca0c03b1283304d7 Mon Sep 17 00:00:00 2001 From: epCode <64379263+epCode@users.noreply.github.com> Date: Wed, 5 Oct 2022 11:02:48 -0700 Subject: [PATCH 1/2] make spider eyes Glow --- mods/ENTITIES/mobs_mc/spider.lua | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index dc9d47235..977915a59 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -11,6 +11,22 @@ local S = minetest.get_translator("mobs_mc") -- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture) +minetest.register_entity("mobs_mc:spider_eyes", { + visual = "mesh", + mesh = "mobs_mc_spider.b3d", + visual_size = {x=1.01, y=1.01}, + textures = { + "mobs_mc_spider_eyes.png", + }, + on_activate = function(self) + minetest.after(0.1, function() + if not self.object:get_attach() then + self.object:remove() + end + end) + end, + glow = 50, +}) local spider = { description = S("Spider"), @@ -27,11 +43,23 @@ local spider = { xp_min = 5, xp_max = 5, armor = {fleshy = 100, arthropod = 100}, + on_spawn = function(self) + local spider_eyes=false + for n = 1, #self.object:get_children() do + local obj = self.object:get_children()[n] + if obj:get_luaentity() and self.object:get_luaentity().name == "mobs_mc:spider_eyes" then + spider_eyes = true + end + end + if not spider_eyes then + minetest.add_entity(self.object:get_pos(), "mobs_mc:spider_eyes"):set_attach(self.object, "body.head", vector.new(0,-0.98,2), vector.new(90,180,180)) + end + end, collisionbox = {-0.7, -0.01, -0.7, 0.7, 0.89, 0.7}, visual = "mesh", mesh = "mobs_mc_spider.b3d", textures = { - {"mobs_mc_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"}, + {"mobs_mc_spider.png"}, }, visual_size = {x=3, y=3}, makes_footstep_sound = false, From fb878f681430c033cf2b80035c9b6e3e155fc86b Mon Sep 17 00:00:00 2001 From: epCode <64379263+epCode@users.noreply.github.com> Date: Wed, 5 Oct 2022 11:14:01 -0700 Subject: [PATCH 2/2] make enderman's eyes Glow --- mods/ENTITIES/mobs_mc/enderman.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 86dbd833e..17938a784 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -24,6 +24,23 @@ -- added rain damage. -- fixed the grass_with_dirt issue. +minetest.register_entity("mobs_mc:ender_eyes", { + visual = "mesh", + mesh = "mobs_mc_spider.b3d", + visual_size = {x=1.01, y=1.01}, + textures = { + "mobs_mc_enderman_eyes.png", + }, + on_activate = function(self) + minetest.after(0.1, function() + if not self.object:get_attach() then + self.object:remove() + end + end) + end, + glow = 50, +}) + local S = minetest.get_translator("mobs_mc") local telesound = function(pos, is_source) @@ -237,6 +254,19 @@ mcl_mobs:register_mob("mobs_mc:enderman", { textures = create_enderman_textures(), visual_size = {x=3, y=3}, makes_footstep_sound = true, + on_spawn = function(self) + local spider_eyes=false + for n = 1, #self.object:get_children() do + local obj = self.object:get_children()[n] + if obj:get_luaentity() and self.object:get_luaentity().name == "mobs_mc:ender_eyes" then + spider_eyes = true + end + end + if not spider_eyes then + minetest.add_entity(self.object:get_pos(), "mobs_mc:ender_eyes"):set_attach(self.object, "head.low", vector.new(0,3.25,-1.98), vector.new(90,0,180)) + minetest.add_entity(self.object:get_pos(), "mobs_mc:ender_eyes"):set_attach(self.object, "head.low", vector.new(1,3.25,-1.98), vector.new(90,0,180)) + end + end, sounds = { -- TODO: Custom war cry sound war_cry = "mobs_sandmonster",