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] 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",