summaryrefslogtreecommitdiff
path: root/node_builders.lua
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-07 10:53:25 -0700
committerFaceDeer <derksenmobile@gmail.com>2017-01-07 10:53:25 -0700
commitc6a63cb4d43ab2850a2e6430ec1780349b5374f0 (patch)
tree932e0a2edde96e34afcc22312e6018ff1ebee979 /node_builders.lua
parente43c5d3974e99b5d8d9a96f5d5461be35eeec65b (diff)
Builder wasn't saving manually-entered facing value. Also, make metadata movement more robust.
Diffstat (limited to 'node_builders.lua')
-rw-r--r--node_builders.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/node_builders.lua b/node_builders.lua
index ce2317a..94467a8 100644
--- a/node_builders.lua
+++ b/node_builders.lua
@@ -77,6 +77,7 @@ minetest.register_node("digtron:builder", {
local meta = minetest.get_meta(pos)
local period = tonumber(fields.period)
local offset = tonumber(fields.offset)
+ local build_facing = tonumber(fields.build_facing)
if period and period > 0 then
meta:set_int("period", math.floor(tonumber(fields.period)))
else
@@ -87,6 +88,9 @@ minetest.register_node("digtron:builder", {
else
offset = meta:get_int("offset")
end
+ if build_facing and build_facing >= 0 and build_facing < 24 then
+ meta:set_int("build_facing", math.floor(build_facing))
+ end
if fields.set then
local buildpos = digtron.find_new_pos(pos, minetest.get_node(pos).param2)
@@ -122,11 +126,6 @@ minetest.register_node("digtron:builder", {
local facing = minetest.get_node(pos).param2
local buildpos = digtron.find_new_pos(pos, facing)
meta:set_int("build_facing", minetest.get_node(buildpos).param2)
- else
- local build_facing = tonumber(fields.build_facing)
- if build_facing and build_facing >= 0 and build_facing < 24 then
- meta:set_int("build_facing", math.floor(build_facing))
- end
end
digtron.update_builder_item(pos)