Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crash caused by unknown nodes #27

Merged
merged 2 commits into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions gate_functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ local rotate_pos_displaced = function(pos, origin, axis, direction)
end

local get_buildable_to = function(pos)
return minetest.registered_nodes[minetest.get_node(pos).name].buildable_to
local def = minetest.registered_nodes[minetest.get_node(pos).name]
return def and def.buildable_to
end


Expand Down Expand Up @@ -290,9 +291,7 @@ local get_door_layout = function(pos, facedir, player)
if not vector.equals(door_node.pos, origin) then
-- There's no obstruction if the node is literally located along the rotation axis
local newpos = rotate_pos_displaced(door_node.pos, origin, axis, direction)
local newnode = minetest.get_node(newpos)
local newdef = minetest.registered_nodes[newnode.name]
if not newdef.buildable_to then
if get_buildable_to(newpos) then
-- check if the destination node is free.
door.swings[direction] = false
break
Expand Down