From b9c2c3bd0afbd673870dd0c92ea85869330bf896 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 00:01:23 +0100 Subject: [PATCH 01/13] Add check for unknown nodes. * Check if node has a definition table before attempting to evaluate attributes. * Define local variable to cache multiple accesses to `registered_nodes[]` and improve readability. * Reduce redundant `== false` condition check. --- mods/ENTITIES/mobs_mc/3_shared.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/3_shared.lua b/mods/ENTITIES/mobs_mc/3_shared.lua index fce0850b4..e30e41cf3 100644 --- a/mods/ENTITIES/mobs_mc/3_shared.lua +++ b/mods/ENTITIES/mobs_mc/3_shared.lua @@ -50,8 +50,10 @@ mobs_mc.make_owner_teleport_function = function(dist, teleport_check_interval) local telepos_below = {x=telepos.x, y=telepos.y-1, z=telepos.z} table.remove(check_offsets, r) -- Long story short, spawn on a platform - if minetest.registered_nodes[minetest.get_node(telepos).name].walkable == false and - minetest.registered_nodes[minetest.get_node(telepos_below).name].walkable == true then + local trynode = minetest.registered_nodes[minetest.get_node(telepos).name] + local trybelownode = minetest.registered_nodes[minetest.get_node(telepos_below).name] + if trynode and not trynode.walkable and + trybelownode and trybelownode.walkable then -- Correct position found! Let's teleport. self.object:set_pos(telepos) return From 4a1b93bbfadb5b2b701d8510b2acd6840cffd352 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 02:05:38 +0100 Subject: [PATCH 02/13] Add check for unknown nodes. * 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/mobs_mc/enderman.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 7c55b34d6..6ab376366 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -478,7 +478,8 @@ mobs:register_mob("mobs_mc:enderman", { -- Selected node needs to have 3 nodes of free space above for u=1, 3 do local node = minetest.get_node({x=nodepos.x, y=nodepos.y+u, z=nodepos.z}) - if minetest.registered_nodes[node.name].walkable then + local ndef = minetest.registered_nodes[node.name] + if ndef and ndef.walkable then node_ok = false break end @@ -512,7 +513,8 @@ mobs:register_mob("mobs_mc:enderman", { node_ok = true for u=1, 3 do local node = minetest.get_node({x=nodepos.x, y=nodepos.y+u, z=nodepos.z}) - if minetest.registered_nodes[node.name].walkable then + local ndef = minetest.registered_nodes[node.name] + if ndef and ndef.walkable then node_ok = false break end From 95cfa43483021f480378abc19aeb9dc0dc903a08 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 02:15:33 +0100 Subject: [PATCH 03/13] Add check for unknown nodes. * 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/mobs_mc/blaze.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index 79f0887cb..577ed7107 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -189,9 +189,10 @@ mobs:register_arrow("mobs_mc:blaze_fireball", { local v = vector.normalize(self.object:get_velocity()) local crashpos = vector.subtract(pos, v) local crashnode = minetest.get_node(crashpos) + local cndef = minetest.registered_nodes[crashnode.name] -- Set fire if node is air, or a replacable flammable node (e.g. a plant) if crashnode.name == "air" or - (minetest.registered_nodes[crashnode.name].buildable_to and minetest.get_item_group(crashnode.name, "flammable") >= 1) then + (cndef and cndef.buildable_to and minetest.get_item_group(crashnode.name, "flammable") >= 1) then minetest.set_node(crashpos, {name = mobs_mc.items.fire}) end end From 962500b1894606c3654a044d6d648997bfc0877c Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 02:23:18 +0100 Subject: [PATCH 04/13] Add check for unknown nodes. * 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/mobs_mc/slime+magma_cube.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index 0c5fe24ac..8d855e761 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -16,7 +16,8 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance if not eject_speed then eject_speed = 1 end - local mother_stuck = minetest.registered_nodes[minetest.get_node(pos).name].walkable + local mndef = minetest.registered_nodes[minetest.get_node(pos).name] + local mother_stuck = mndef and mndef.walkable angle = math.random(0, math.pi*2) local children = {} for i=1,children_count do @@ -26,7 +27,8 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance -- If child would end up in a wall, use position of the "mother", unless -- the "mother" was stuck as well local speed_penalty = 1 - if (not mother_stuck) and minetest.registered_nodes[minetest.get_node(newpos).name].walkable then + local cndef = minetest.registered_nodes[minetest.get_node(newpos).name] + if (not mother_stuck) and cndef and cndef.walkable then newpos = pos speed_penalty = 0.5 end From 88f7a150c76a93a403570f9660bba5b98cab9950 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 04:00:48 +0100 Subject: [PATCH 05/13] Add check for unknown nodes. * Add check for unknown node in `handle_node_drops()` and return immediately if the dug node has no definition table. --- mods/ENTITIES/mcl_item_entity/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 678f8e2b7..2c5acdc92 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -256,6 +256,8 @@ function minetest.handle_node_drops(pos, drops, digger) local silk_touch_drop = false local nodedef = minetest.registered_nodes[dug_node.name] + if not nodedef then return end + if shearsy_level and shearsy_level > 0 and nodedef._mcl_shears_drop then if nodedef._mcl_shears_drop == true then drops = { dug_node.name } From 818cbb2f485573d7345d497adfea68dc7e790c86 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 12:11:59 +0100 Subject: [PATCH 06/13] Add check for unknown nodes. * 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_minecarts/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 119a13523..d894f9722 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -432,7 +432,8 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o -- Slow down or speed up local acc = dir.y * -1.8 local friction = 0.4 - local speed_mod = minetest.registered_nodes[minetest.get_node(pos).name]._rail_acceleration + local ndef = minetest.registered_nodes[minetest.get_node(pos).name] + local speed_mod = ndef and ndef._rail_acceleration acc = acc - friction @@ -860,4 +861,4 @@ if has_mcl_wip then mcl_wip.register_wip_item("mcl_minecarts:furnace_minecart") mcl_wip.register_wip_item("mcl_minecarts:command_block_minecart") mcl_wip.register_wip_item("mcl_minecarts:hopper_minecart") -end \ No newline at end of file +end From 9bac0da01afdf26e52d9f27d34bd13d9b62baffb Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 13:11:53 +0100 Subject: [PATCH 07/13] 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 From 3f4dafc68fd3c4a79863c42c7eeb5a7226150401 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 14:14:45 +0100 Subject: [PATCH 08/13] Add check for unknown nodes. * 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/ITEMS/mcl_core/functions.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index d2ff3690a..6cb727d51 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -210,7 +210,8 @@ minetest.register_abm({ end local posses = { { 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 } } for _, p in pairs(posses) do - if minetest.registered_nodes[minetest.get_node(vector.new(pos.x + p[1], pos.y, pos.z + p[2])).name].walkable then + local ndef = minetest.registered_nodes[minetest.get_node(vector.new(pos.x + p[1], pos.y, pos.z + p[2])).name] + if ndef and ndef.walkable then local posy = pos.y while minetest.get_node(vector.new(pos.x, posy, pos.z)).name == "mcl_core:cactus" do local pos = vector.new(pos.x, posy, pos.z) @@ -841,7 +842,7 @@ minetest.register_abm({ -- If this was mycelium, uproot plant above if n2.name == "mcl_core:mycelium" then local tad = minetest.registered_nodes[minetest.get_node(above).name] - if tad.groups and tad.groups.non_mycelium_plant then + if tad and tad.groups and tad.groups.non_mycelium_plant then minetest.dig_node(above) end end @@ -1333,7 +1334,7 @@ minetest.register_abm({ function mcl_core.supports_vines(nodename) local def = minetest.registered_nodes[nodename] -- Rules: 1) walkable 2) full cube - return def.walkable and + return def and def.walkable and (def.node_box == nil or def.node_box.type == "regular") and (def.collision_box == nil or def.collision_box.type == "regular") end From f5a8d6d17a5c4c47152c1592d8e044761a290885 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 14:40:37 +0100 Subject: [PATCH 09/13] Add check for unknown nodes. * 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. * Clarify code flow. --- mods/MAPGEN/mcl_dungeons/init.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mods/MAPGEN/mcl_dungeons/init.lua b/mods/MAPGEN/mcl_dungeons/init.lua index 905e26396..82e73eeb5 100644 --- a/mods/MAPGEN/mcl_dungeons/init.lua +++ b/mods/MAPGEN/mcl_dungeons/init.lua @@ -134,10 +134,15 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) -- Check floor and ceiling: Must be *completely* solid local y_floor = y local y_ceiling = y + dim.y + 1 - if check then for tx = x+1, x+dim.x do for tz = z+1, z+dim.z do - if not registered_nodes[get_node({x = tx, y = y_floor , z = tz}).name].walkable - or not registered_nodes[get_node({x = tx, y = y_ceiling, z = tz}).name].walkable then return false end - end end end + if check then + for tx = x+1, x+dim.x do + for tz = z+1, z+dim.z do + local fdef = registered_nodes[get_node({x = tx, y = y_floor , z = tz}).name] + local cdef = registered_nodes[get_node({x = tx, y = y_ceiling, z = tz}).name] + if not fdev or not fdev.walkable or not cdev or not cdev.walkable then return false end + end + end + end -- Check for air openings (2 stacked air at ground level) in wall positions local openings_counter = 0 @@ -287,7 +292,8 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) -- Do not overwrite nodes with is_ground_content == false (e.g. bedrock) -- Exceptions: cobblestone and mossy cobblestone so neighborings dungeons nicely connect to each other local name = get_node(p).name - if registered_nodes[name].is_ground_content or name == "mcl_core:cobble" or name == "mcl_core:mossycobble" then + local rn = registered_nodes[name] + if rn and rn.is_ground_content or name == "mcl_core:cobble" or name == "mcl_core:mossycobble" then -- Floor if ty == y then if pr:next(1,4) == 1 then From 6a69f49fa051e7950fcc05f8664e19b1f24d7227 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 14:59:49 +0100 Subject: [PATCH 10/13] Add check for unknown nodes. * Check if node has a definition table before attempting to evaluate its attributes. --- mods/MAPGEN/tsm_railcorridors/init.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mods/MAPGEN/tsm_railcorridors/init.lua b/mods/MAPGEN/tsm_railcorridors/init.lua index 65a7d6a69..451406167 100644 --- a/mods/MAPGEN/tsm_railcorridors/init.lua +++ b/mods/MAPGEN/tsm_railcorridors/init.lua @@ -154,16 +154,16 @@ local function SetNodeIfCanBuild(pos, node, check_above, can_replace_rail) local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name local abovedef = minetest.registered_nodes[abovename] if abovename == "unknown" or abovename == "ignore" or - (abovedef.groups and abovedef.groups.attached_node) or + (abovedef and abovedef.groups and abovedef.groups.attached_node) or -- This is done because cobwebs are often fake liquids - (abovedef.liquidtype ~= "none" and abovename ~= tsm_railcorridors.nodes.cobweb) then + (abovedef and abovedef.liquidtype ~= "none" and abovename ~= tsm_railcorridors.nodes.cobweb) then return false end end local name = minetest.get_node(pos).name local def = minetest.registered_nodes[name] if name ~= "unknown" and name ~= "ignore" and - ((def.is_ground_content and def.liquidtype == "none") or + ((def and def.is_ground_content and def.liquidtype == "none") or name == tsm_railcorridors.nodes.cobweb or name == tsm_railcorridors.nodes.torch_wall or name == tsm_railcorridors.nodes.torch_floor or @@ -192,7 +192,7 @@ end local function IsGround(pos) local nodename = minetest.get_node(pos).name local nodedef = minetest.registered_nodes[nodename] - return nodename ~= "unknown" and nodename ~= "ignore" and nodedef.is_ground_content and nodedef.walkable and nodedef.liquidtype == "none" + return nodename ~= "unknown" and nodename ~= "ignore" and nodedef and nodedef.is_ground_content and nodedef.walkable and nodedef.liquidtype == "none" end -- Returns true if rails are allowed to be placed on top of this node @@ -200,7 +200,7 @@ local function IsRailSurface(pos) local nodename = minetest.get_node(pos).name local nodename_above = minetest.get_node({x=pos.x,y=pos.y+2,z=pos.z}).name local nodedef = minetest.registered_nodes[nodename] - return nodename ~= "unknown" and nodename ~= "ignore" and nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodename_above ~= tsm_railcorridors.nodes.rail + return nodename ~= "unknown" and nodename ~= "ignore" and nodedef and nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodename_above ~= tsm_railcorridors.nodes.rail end -- Checks if the node is empty space which requires to be filled by a platform @@ -211,7 +211,7 @@ local function NeedsPlatform(pos) local falling = minetest.get_item_group(node.name, "falling_node") == 1 return -- Node can be replaced if ground content or rail - (node.name ~= "ignore" and node.name ~= "unknown" and nodedef.is_ground_content) and + (node.name ~= "ignore" and node.name ~= "unknown" and nodedef and nodedef.is_ground_content) and -- Node needs platform if node below is not walkable. -- Unless 2 nodes below there is dirt: This is a special case for the starter cube. ((nodedef.walkable == false and node2.name ~= tsm_railcorridors.nodes.dirt) or @@ -253,7 +253,7 @@ local function Cube(p, radius, node, replace_air_only, wood, post) if yi == y_top then local topnode = minetest.get_node({x=xi,y=yi+1,z=zi}) local topdef = minetest.registered_nodes[topnode.name] - if minetest.get_item_group(topnode.name, "attached_node") ~= 1 and topdef.liquidtype == "none" then + if minetest.get_item_group(topnode.name, "attached_node") ~= 1 and topdef and topdef.liquidtype == "none" then ok = true end elseif column_last_attached and yi == column_last_attached - 1 then @@ -277,7 +277,7 @@ local function Cube(p, radius, node, replace_air_only, wood, post) elseif wood and (xi == p.x or zi == p.z) and thisnode.name == wood then local topnode = minetest.get_node({x=xi,y=yi+1,z=zi}) local topdef = minetest.registered_nodes[topnode.name] - if topdef.walkable and topnode.name ~= wood then + if topdef and topdef.walkable and topnode.name ~= wood then minetest.set_node({x=xi,y=yi,z=zi}, node) -- Check for torches around the wood and schedule them -- for removal @@ -429,7 +429,7 @@ local function TryPlaceCobweb(pos, needs_check, side_vector) local cpos = vector.add(pos, check_vectors[c]) local cname = minetest.get_node(cpos).name local cdef = minetest.registered_nodes[cname] - if cname ~= "ignore" and cdef.walkable then + if cname ~= "ignore" and cdef and cdef.walkable then check_passed = true break end @@ -523,12 +523,12 @@ local function WoodSupport(p, wood, post, torches, dir, torchdir) local nodedef1 = minetest.registered_nodes[minetest.get_node(pos1).name] local nodedef2 = minetest.registered_nodes[minetest.get_node(pos2).name] - if nodedef1.walkable then + if nodedef1 and nodedef1.walkable then pos1.y = pos1.y + 1 end SetNodeIfCanBuild(pos1, node, true) - if nodedef2.walkable then + if nodedef2 and nodedef2.walkable then pos2.y = pos2.y + 1 end SetNodeIfCanBuild(pos2, node, true) From 1326b9e7e7b6952b3aeabf27068ea1e491556465 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 15:14:22 +0100 Subject: [PATCH 11/13] Add check for unknown nodes. * Check if node has a definition table before attempting to evaluate its attributes. By application of De Morgan's law, the compound logic expression can be rewritten so that the existence of the table is checked before all following attribute references. --- mods/MAPGEN/mcl_structures/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index be1be0f67..f596147f0 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -179,7 +179,7 @@ function mcl_structures.generate_igloo(pos, rotation, pr) real_depth = real_depth + 1 local node = minetest.get_node({x=tpos.x,y=tpos.y-y,z=tpos.z}) local def = minetest.registered_nodes[node.name] - if (not def) or (not def.walkable) or (def.liquidtype ~= "none") or (not def.is_ground_content) then + if not (def and def.walkable and def.liquidtype == "none" and def.is_ground_content) then bpos.y = tpos.y-y+1 break end From 11ee1d133f72e58cb13f4f15229fcb9d55510545 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 18:26:51 +0100 Subject: [PATCH 12/13] Fix cut-n-paste error. * Swap misplaced lines. * Concatenate conditional expression. --- mods/ENTITIES/mcl_mobs/api.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 394003957..c38c8eafa 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -1328,9 +1328,8 @@ local do_jump = function(self) return false end - if self.walk_chance == 0 local ndef = minetest.registered_nodes[nod.name] - or ndef and ndef.walkable then + if self.walk_chance == 0 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 From deed231f28a36e2fb93cf295e162b87ea7490674 Mon Sep 17 00:00:00 2001 From: kabou Date: Wed, 9 Mar 2022 18:50:41 +0100 Subject: [PATCH 13/13] Fix typos. --- mods/MAPGEN/mcl_dungeons/init.lua | 2 +- mods/TODO.CORE | 16 +++ mods/TODO.ENTITIES | 61 ++++++++++++ mods/TODO.ITEMS | 156 ++++++++++++++++++++++++++++++ mods/TODO.MAPGEN | 17 ++++ 5 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 mods/TODO.CORE create mode 100644 mods/TODO.ENTITIES create mode 100644 mods/TODO.ITEMS create mode 100644 mods/TODO.MAPGEN diff --git a/mods/MAPGEN/mcl_dungeons/init.lua b/mods/MAPGEN/mcl_dungeons/init.lua index 82e73eeb5..f809b18e4 100644 --- a/mods/MAPGEN/mcl_dungeons/init.lua +++ b/mods/MAPGEN/mcl_dungeons/init.lua @@ -139,7 +139,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) for tz = z+1, z+dim.z do local fdef = registered_nodes[get_node({x = tx, y = y_floor , z = tz}).name] local cdef = registered_nodes[get_node({x = tx, y = y_ceiling, z = tz}).name] - if not fdev or not fdev.walkable or not cdev or not cdev.walkable then return false end + if not fdef or not fdef.walkable or not cdef or not cdef.walkable then return false end end end end diff --git a/mods/TODO.CORE b/mods/TODO.CORE new file mode 100644 index 000000000..62d5ed1a4 --- /dev/null +++ b/mods/TODO.CORE @@ -0,0 +1,16 @@ +CORE/_mcl_autogroup/init.lua: +-> Enumerates entries of the registered_nodes table. Safe. + +CORE/flowlib/init.lua: +-> All instances are checked before use. + +CORE/mcl_explosions/init.lua: +-> Enumerates entries of the registered_nodes table. Safe. + +CORE/walkover/init.lua: +-> Enumerates entries of the registered_nodes table. Safe. + +CORE/mcl_util/init.lua: +-> All instances are checked before use. +- should use local. +- defines mcl_util.call_on_rightclick, but does not use it. diff --git a/mods/TODO.ENTITIES b/mods/TODO.ENTITIES new file mode 100644 index 000000000..9d1cdaf99 --- /dev/null +++ b/mods/TODO.ENTITIES @@ -0,0 +1,61 @@ +ENTITIES/mcl_boats/init.lua: +-> All instances are checked before use. +- one use in stray comment. +- should use local or should use mcl_util.call_on_rightclick. + +ENTITIES/mcl_dripping/init.lua: +-> Only references one directly indexed entry. Safe. + +ENTITIES/mcl_mobs/api.lua: +-> Uses node_ok() that checks and always returns valid nodes. Safe. +- line 1331 minetest.registered_items? Fixed +- should use locals. + +ENTITIES/mcl_mobs/spawning.lua: +-> Only instances in commented out spawning code. Safe. + +ENTITIES/mcl_mobs/mount.lua: +-> All instances shielded by node_ok(). Safe. + +ENTITIES/mobs_mc/snowman.lua: +-> All instances checked. Safe. +- line 107 belowdef.nod_box == nil ? + +ENTITIES/mobs_mc/2_throwing.lua: +-> All instances checked. Safe. + +ENTITIES/mobs_mc/3_shared.lua: +-> Unchecked accesses. Fixed. + +ENTITIES/mobs_mc/enderman.lua: +-> Unchecked accesses. Fixed. +- line 69: use indexed registered_nodes. +- line 259: weird but works. +- line 409 and onwards: restricted to takable_nodes. + +ENTITIES/mobs_mc/blaze.lua: +-> Unchecked access. Fixed. + +ENTITIES/mobs_mc/slime+magma_cube.lua: +-> Unchecked accesses. Fixed. + +ENTITIES/mobs_mc/5_spawn_abm_check.lua: +-> Does not appear to be used at all. +- unchecked access. Unfixed. + +ENTITIES/mcl_paintings/init.lua: +-> All instances checked. Safe. + +ENTITIES/mcl_item_entity/init.lua: +-> Unchecked access. Fixed. + +ENTITIES/mcl_falling_nodes/init.lua: +-> All instances checked. Safe. +- line 170: minetest.registered_nodes[self.node.name] is the same as bcd set on line 155 + because of condition on line 164, therefore this access is safe. Sloppy code though. + +ENTITIES/mcl_minecarts/init.lua: +-> Unchecked access. Fixed. + +ENTITIES/mobs_mc_gameconfig/init.lua: +-> Only explicit indexing of registered_nodes. Safe diff --git a/mods/TODO.ITEMS b/mods/TODO.ITEMS new file mode 100644 index 000000000..4ebc07f84 --- /dev/null +++ b/mods/TODO.ITEMS @@ -0,0 +1,156 @@ +ITEMS/mcl_portals/portal_nether.lua +-> not checked. +ITEMS/mcl_portals/portal_gateway.lua +-> not checked. +ITEMS/mcl_portals/portal_end.lua +-> not checked. +ITEMS/mcl_sponges/init.lua +-> not checked. +ITEMS/mcl_beds/api.lua +-> not checked. +ITEMS/mcl_beds/functions.lua +-> not checked. +ITEMS/mcl_torches/api.lua +-> not checked. +ITEMS/mcl_tools/init.lua +-> not checked. +ITEMS/mcl_ocean/seagrass.lua +-> not checked. +ITEMS/mcl_ocean/kelp.lua +-> not checked. +ITEMS/mcl_ocean/corals.lua +-> not checked. +ITEMS/mcl_ocean/sea_pickle.lua +-> not checked. +ITEMS/mcl_lanterns/init.lua +-> not checked. +ITEMS/mcl_stairs/api.lua +-> not checked. +ITEMS/mcl_stairs/cornerstair.lua +-> not checked. +ITEMS/mcl_dye/init.lua +-> not checked. +ITEMS/mcl_bows/crossbow.lua +-> not checked. +ITEMS/mcl_bows/bow.lua +-> not checked. +ITEMS/mcl_bows/rocket.lua +-> not checked. +ITEMS/mcl_bows/arrow.lua +-> not checked. +ITEMS/mcl_buckets/init.lua +-> not checked. +ITEMS/mcl_buckets/register.lua +-> not checked. +ITEMS/mcl_throwing/register.lua +-> not checked. +ITEMS/mcl_flowers/init.lua +-> not checked. +ITEMS/mcl_tnt/init.lua +-> not checked. +ITEMS/mcl_cocoas/init.lua +-> not checked. +ITEMS/xpanes/init.lua +-> not checked. +ITEMS/mcl_potions/tipped_arrow.lua +-> not checked. +ITEMS/mcl_potions/potions.lua +-> not checked. +ITEMS/mcl_potions/init.lua +-> not checked. +ITEMS/mcl_end/end_crystal.lua +-> not checked. +ITEMS/mcl_end/chorus_plant.lua +-> not checked. +ITEMS/mcl_walls/init.lua +-> not checked. +ITEMS/mcl_fishing/init.lua +-> not checked. +ITEMS/mcl_composters/init.lua +-> not checked. +ITEMS/mcl_heads/init.lua +-> not checked. +ITEMS/mclx_fences/init.lua +-> not checked. +ITEMS/mcl_mobspawners/init.lua +-> not checked. +ITEMS/mclx_stairs/init.lua +-> not checked. +ITEMS/mclx_core/init.lua +-> not checked. +ITEMS/mcl_core/nodes_base.lua +-> not checked. +ITEMS/mcl_core/nodes_misc.lua +-> not checked. +ITEMS/mcl_core/nodes_cactuscane.lua +-> not checked. +ITEMS/mcl_core/nodes_climb.lua +-> not checked. +ITEMS/mcl_core/craftitems.lua +-> not checked. + +ITEMS/mcl_core/functions.lua +-> Unchecked accesses. Fixed. + +ITEMS/mcl_fire/init.lua +-> not checked. +ITEMS/mcl_fire/fire_charge.lua +-> not checked. +ITEMS/mcl_fire/flint_and_steel.lua +-> not checked. +ITEMS/mcl_banners/init.lua +-> not checked. +ITEMS/mcl_farming/shared_functions.lua +-> not checked. +ITEMS/mcl_farming/hoes.lua +-> not checked. +ITEMS/mcl_farming/soil.lua +-> not checked. +ITEMS/mcl_signs/init.lua +-> not checked. +ITEMS/mcl_maps/init.lua +-> not checked. +ITEMS/screwdriver/init.lua +-> not checked. +ITEMS/mcl_nether/lava.lua +-> not checked. +ITEMS/mcl_nether/nether_wart.lua +-> not checked. +ITEMS/mcl_books/init.lua +-> not checked. +ITEMS/mcl_chests/init.lua +-> not checked. +ITEMS/mcl_hoppers/init.lua +-> not checked. +ITEMS/mcl_colorblocks/init.lua +-> not checked. +ITEMS/REDSTONE/mcl_dispensers/init.lua +-> not checked. +ITEMS/REDSTONE/mcl_droppers/init_new.lua +-> not checked. +ITEMS/REDSTONE/mcl_droppers/init.lua +-> not checked. +ITEMS/REDSTONE/mcl_comparators/init.lua +-> not checked. +ITEMS/REDSTONE/mesecons_pressureplates/init.lua +-> not checked. +ITEMS/REDSTONE/mesecons_walllever/init.lua +-> not checked. +ITEMS/REDSTONE/mesecons_button/init.lua +-> not checked. +ITEMS/REDSTONE/mesecons/internal.lua +-> not checked. +ITEMS/REDSTONE/mesecons/util.lua +-> not checked. +ITEMS/REDSTONE/mesecons_mvps/init.lua +-> not checked. +ITEMS/REDSTONE/mesecons_wires/init.lua +-> not checked. +ITEMS/REDSTONE/mesecons_delayer/init.lua +-> not checked. +ITEMS/REDSTONE/mesecons_pistons/init.lua +-> not checked. +ITEMS/mcl_itemframes/init.lua +-> not checked. +ITEMS/mcl_doors/api_doors.lua +-> not checked. diff --git a/mods/TODO.MAPGEN b/mods/TODO.MAPGEN new file mode 100644 index 000000000..0cba3f346 --- /dev/null +++ b/mods/TODO.MAPGEN @@ -0,0 +1,17 @@ +MAPGEN/mcl_villages/buildings.lua +-> Only use is checked. Safe. + +MAPGEN/mcl_villages/utils.lua +-> Only indexed uses. Safe. + +MAPGEN/tsm_railcorridors/init.lua +-> Unchecked accesses. Fixed. + +MAPGEN/mcl_structures/init.lua +-> Unchecked access. Fixed. + +MAPGEN/mcl_dungeons/init.lua +-> Unchecked accesses. Fixed. + +MAPGEN/mcl_mapgen_core/init.lua +-> All uses are checked. Safe.