Fix two trackplacer issues

1. you can't place tracks on non-walkable nodes
2. in certain situations no rail was placed at all
This commit is contained in:
orwell96 2016-08-30 10:20:43 +02:00
parent 20b6e43501
commit d49c306431
1 changed files with 6 additions and 1 deletions

View File

@ -159,6 +159,9 @@ function tp.placetrack(pos, nnpref)
end
end
end
--not found
tp.bend_rail(pos, p_rails[1], nnpref)
minetest.set_node(pos, tr.single_conn[p_rails[1]])
end
end
@ -172,7 +175,9 @@ function tp.register_track_placer(nnprefix, imgprefix, dispname)
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type=="node" then
local pos=pointed_thing.above
if minetest.registered_nodes[minetest.get_node(pos).name] and minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
local upos=pointed_thing.under
if minetest.registered_nodes[minetest.get_node(pos).name] and minetest.registered_nodes[minetest.get_node(pos).name].buildable_to
and minetest.registered_nodes[minetest.get_node(upos).name] and minetest.registered_nodes[minetest.get_node(upos).name].walkable then
tp.placetrack(pos, nnprefix)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()