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.
This commit is contained in:
kabou 2022-03-09 13:11:53 +01:00
parent 818cbb2f48
commit 9bac0da01a

View File

@ -1329,7 +1329,8 @@ local do_jump = function(self)
end end
if self.walk_chance == 0 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 if minetest.get_item_group(nod.name, "fence") == 0
and minetest.get_item_group(nod.name, "fence_gate") == 0 and minetest.get_item_group(nod.name, "fence_gate") == 0