From 3091a1fdcbb9cab05c393269904a96fa0a9e90a4 Mon Sep 17 00:00:00 2001 From: Michieal Date: Thu, 15 Dec 2022 03:31:35 -0500 Subject: [PATCH] Debugging the cat issue. ERROR[Server]: Ocelot::Did not remove old entity on tame. ^ that should not happen. --- mods/ENTITIES/mcl_mobs/breeding.lua | 2 ++ mods/ENTITIES/mobs_mc/ocelot.lua | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/breeding.lua b/mods/ENTITIES/mcl_mobs/breeding.lua index 9284163cd..c74f8c9fa 100644 --- a/mods/ENTITIES/mcl_mobs/breeding.lua +++ b/mods/ENTITIES/mcl_mobs/breeding.lua @@ -312,6 +312,8 @@ function mob_class:check_breeding() end function mob_class:toggle_sit(clicker,p) + local default_walk_chance = 50 -- was previously undefined. + if not self.tamed or self.child or self.owner ~= clicker:get_player_name() then return end diff --git a/mods/ENTITIES/mobs_mc/ocelot.lua b/mods/ENTITIES/mobs_mc/ocelot.lua index 9b1ed511e..c554a01bb 100644 --- a/mods/ENTITIES/mobs_mc/ocelot.lua +++ b/mods/ENTITIES/mobs_mc/ocelot.lua @@ -9,6 +9,8 @@ local S = minetest.get_translator("mobs_mc") --################### OCELOT AND CAT --################### +local OCELOT_DEBUG = true + local pr = PseudoRandom(os.time()*12) local default_walk_chance = 70 @@ -100,6 +102,11 @@ local ocelot = { ent.owner = clicker:get_player_name() ent.tamed = true self.object:remove() + + if self.object ~= nil then + minetest.log("error", "Ocelot::Did not remove old entity on tame.") + end + return end end @@ -162,8 +169,14 @@ cat.on_spawn = function(self) self._texture = {"mobs_mc_cat_black.png"} end if not self._texture then - local max_tex = 3 + local max_tex = #cat.textures + if OCELOT_DEBUG then + minetest.log (dump(cat.textures)) + end self._texture = cat.textures[pr:next(1,max_tex)] -- pick a random texture. + if OCELOT_DEBUG then + minetest.log (dump(self._texture)) + end end self.object:set_properties({textures = {self._texture}}) end