aboutsummaryrefslogtreecommitdiff
path: root/trackplacer.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-08-30 10:20:43 +0200
committerorwell96 <mono96.mml@gmail.com>2016-08-30 10:20:43 +0200
commitd49c30643110a0384d8a506ef21dd39c007cd18b (patch)
tree9c7d81ebeaad1214dc3da6f2d3e54a4aa564ac97 /trackplacer.lua
parent20b6e43501c418c1051bd837aa64ae5f153b43a3 (diff)
downloadadvtrains-d49c30643110a0384d8a506ef21dd39c007cd18b.tar.gz
advtrains-d49c30643110a0384d8a506ef21dd39c007cd18b.tar.bz2
advtrains-d49c30643110a0384d8a506ef21dd39c007cd18b.zip
Fix two trackplacer issues
1. you can't place tracks on non-walkable nodes 2. in certain situations no rail was placed at all
Diffstat (limited to 'trackplacer.lua')
-rw-r--r--trackplacer.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/trackplacer.lua b/trackplacer.lua
index 9ab9a4a..21d40f0 100644
--- a/trackplacer.lua
+++ b/trackplacer.lua
@@ -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()