From 9bac0da01afdf26e52d9f27d34bd13d9b62baffb Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 13:11:53 +0100 Subject: [PATCH] Fix registered_items oddity and add check for unknown nodes. * Mobs redo uses `registered_items[]` where clearly the proper table accessed should be `registered_nodes[]`. Perhaps this magically works, but it looks nonsensical. Switch to the use the more sensible `registered_nodes[]` table. * Check if node has a definition table before attempting to evaluate its attributes. * Define local variable to cache multiple accesses to `registered_nodes[]` and improve readability. --- mods/ENTITIES/mcl_mobs/api.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 14b58bc11..394003957 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -1329,7 +1329,8 @@ local do_jump = function(self) end if self.walk_chance == 0 - or minetest.registered_items[nod.name].walkable then + local ndef = minetest.registered_nodes[nod.name] + or ndef and ndef.walkable then if minetest.get_item_group(nod.name, "fence") == 0 and minetest.get_item_group(nod.name, "fence_gate") == 0