Work Table : simpler node registrations
This commit is contained in:
parent
f06d14882b
commit
968aede3fd
@ -104,8 +104,7 @@ function worktable.put(_, listname, _, stack, _)
|
|||||||
|
|
||||||
if listname == "forms" then return 0 end
|
if listname == "forms" then return 0 end
|
||||||
if listname == "input" then
|
if listname == "input" then
|
||||||
if mat:match(stn) then return count end
|
if not mat:match(stn) then return 0 end
|
||||||
return 0
|
|
||||||
end
|
end
|
||||||
if listname == "hammer" then
|
if listname == "hammer" then
|
||||||
if stn ~= "xdecor:hammer" then return 0 end
|
if stn ~= "xdecor:hammer" then return 0 end
|
||||||
@ -180,18 +179,6 @@ xdecor.register("worktable", {
|
|||||||
allow_metadata_inventory_move = worktable.move
|
allow_metadata_inventory_move = worktable.move
|
||||||
})
|
})
|
||||||
|
|
||||||
local function description(node, shape)
|
|
||||||
local desc = node:gsub("%w+:", " "):gsub("_", " "):gsub(" %l", string.upper):sub(2)..
|
|
||||||
" "..shape:gsub("^%l", string.upper)
|
|
||||||
return desc
|
|
||||||
end
|
|
||||||
|
|
||||||
local function shady(shape)
|
|
||||||
if shape == "stair" or shape == "slab" or shape == "innerstair" or
|
|
||||||
shape == "outerstair" then return false end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
local function tiles(node, ndef)
|
local function tiles(node, ndef)
|
||||||
if node:find("glass") then return {node:gsub(":", "_")..".png"} end
|
if node:find("glass") then return {node:gsub(":", "_")..".png"} end
|
||||||
return ndef.tiles
|
return ndef.tiles
|
||||||
@ -204,14 +191,12 @@ for _, n in pairs(nodes) do
|
|||||||
local groups = {}
|
local groups = {}
|
||||||
groups.not_in_creative_inventory=1
|
groups.not_in_creative_inventory=1
|
||||||
|
|
||||||
for k, v in pairs(ndef.groups)
|
for k, v in pairs(ndef.groups) do
|
||||||
do if k ~= "wood" and k ~= "stone" then
|
if k ~= "wood" and k ~= "stone" then groups[k] = v end
|
||||||
groups[k] = v
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(":"..n.."_"..d[1], {
|
minetest.register_node(":"..n.."_"..d[1], {
|
||||||
description = description(n, d[1]),
|
description = ndef.description.." "..d[1]:gsub("^%l", string.upper),
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
@ -220,7 +205,7 @@ for _, n in pairs(nodes) do
|
|||||||
tiles = tiles(n, ndef),
|
tiles = tiles(n, ndef),
|
||||||
groups = groups,
|
groups = groups,
|
||||||
node_box = {type = "fixed", fixed = d[3]},
|
node_box = {type = "fixed", fixed = d[3]},
|
||||||
sunlight_propagates = shady(d[1]),
|
sunlight_propagates = true,
|
||||||
on_place = minetest.rotate_node
|
on_place = minetest.rotate_node
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user