1 Commits

Author SHA1 Message Date
2454382e90 technic_cnc: use programs definition to generate formspec
This deprecates the variables onesize_products and twosize_products
by using a shared definition table.
2024-08-02 19:08:39 +02:00
2 changed files with 2 additions and 9 deletions

View File

@ -92,7 +92,7 @@ local dirtab = {
local tube = { local tube = {
insert_object = function(pos, node, stack, direction) insert_object = function(pos, node, stack, direction)
--print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2) print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2)
if direction.y == 1 if direction.y == 1
or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then
return stack return stack
@ -106,7 +106,7 @@ local tube = {
end end
end, end,
can_insert = function(pos, node, stack, direction) can_insert = function(pos, node, stack, direction)
--print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2) print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2)
if direction.y == 1 if direction.y == 1
or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then
return false return false

View File

@ -10,7 +10,6 @@ local function register_material(nodename, tiles_override, descr_override)
end end
local groups = { local groups = {
cracky = ndef.groups.cracky,
crumbly = ndef.groups.crumbly, crumbly = ndef.groups.crumbly,
choppy = ndef.groups.choppy, choppy = ndef.groups.choppy,
flammable = ndef.groups.flammable, flammable = ndef.groups.flammable,
@ -20,12 +19,6 @@ local function register_material(nodename, tiles_override, descr_override)
oddly_breakable_by_hand = ndef.groups.oddly_breakable_by_hand, oddly_breakable_by_hand = ndef.groups.oddly_breakable_by_hand,
not_in_creative_inventory = 1, not_in_creative_inventory = 1,
} }
local count = 0
for _ in pairs(groups) do
count = count + 1
end
assert(count >= 2, "Too few groups. node name=" .. nodename)
local tiles = tiles_override or { ndef.tiles[#ndef.tiles] } local tiles = tiles_override or { ndef.tiles[#ndef.tiles] }
assert(tiles and #tiles == 1, "Unknown tile format in node name=" .. nodename) assert(tiles and #tiles == 1, "Unknown tile format in node name=" .. nodename)