From b4f2cb61d30169d88c76a2710aad4776d350f273 Mon Sep 17 00:00:00 2001 From: epCode <64379263+epCode@users.noreply.github.com> Date: Wed, 5 Oct 2022 19:07:51 -0700 Subject: [PATCH 1/3] Fix Spider Segmentation fault --- mods/ENTITIES/mobs_mc/spider.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 977915a59..dd328e6dc 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -20,10 +20,19 @@ minetest.register_entity("mobs_mc:spider_eyes", { }, on_activate = function(self) minetest.after(0.1, function() + if self and self.object then + if not self.object:get_attach() then + self.object:remove() + end + end + end) + end, + on_step = function(self) + if self and self.object then if not self.object:get_attach() then self.object:remove() end - end) + end end, glow = 50, }) @@ -55,6 +64,14 @@ local spider = { 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, + on_die = function(self) + 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 + obj:remove() + end + end + end, collisionbox = {-0.7, -0.01, -0.7, 0.7, 0.89, 0.7}, visual = "mesh", mesh = "mobs_mc_spider.b3d", From ba383091ad4c392e59cfae14e438588216d6ec8c Mon Sep 17 00:00:00 2001 From: epCode <64379263+epCode@users.noreply.github.com> Date: Thu, 6 Oct 2022 08:54:38 -0700 Subject: [PATCH 2/3] fix eyes staying when mob was killed --- mods/ENTITIES/mobs_mc/enderman.lua | 6 +++--- mods/ENTITIES/mobs_mc/spider.lua | 9 --------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 17938a784..c6dfece02 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -31,12 +31,12 @@ minetest.register_entity("mobs_mc:ender_eyes", { textures = { "mobs_mc_enderman_eyes.png", }, - on_activate = function(self) - minetest.after(0.1, function() + on_step = function(self) + if self and self.object then if not self.object:get_attach() then self.object:remove() end - end) + end end, glow = 50, }) diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index dd328e6dc..66b4e2853 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -18,15 +18,6 @@ minetest.register_entity("mobs_mc:spider_eyes", { textures = { "mobs_mc_spider_eyes.png", }, - on_activate = function(self) - minetest.after(0.1, function() - if self and self.object then - if not self.object:get_attach() then - self.object:remove() - end - end - end) - end, on_step = function(self) if self and self.object then if not self.object:get_attach() then From 99cc6cf307951d4a0ea65466e014ffcbaf37f13e Mon Sep 17 00:00:00 2001 From: epCode Date: Thu, 6 Oct 2022 16:47:10 +0000 Subject: [PATCH 3/3] Remove Unecessary code in spider for eye removal. --- mods/ENTITIES/mobs_mc/spider.lua | 8 -------- 1 file changed, 8 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 66b4e2853..751937f89 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -55,14 +55,6 @@ local spider = { 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, - on_die = function(self) - 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 - obj:remove() - end - end - end, collisionbox = {-0.7, -0.01, -0.7, 0.7, 0.89, 0.7}, visual = "mesh", mesh = "mobs_mc_spider.b3d",