new mod 'techpack_warehouse' added

tubelib_stairway renamed to techpack_stairway
code maintenance
This commit is contained in:
Joachim Stolberg 2019-01-05 18:04:56 +01:00
parent bc468f77f5
commit 6b57cf07a6
37 changed files with 1104 additions and 272 deletions

@ -12,6 +12,7 @@
- The Quarry now uses LVM techniques to go down up to 100 meter - The Quarry now uses LVM techniques to go down up to 100 meter
- Ladders, stairways, and bridges added (tubelib_stairway) for the machines - Ladders, stairways, and bridges added (tubelib_stairway) for the machines
- Industrial lamps - Industrial lamps
- TechPack Warehouse Boxes in steel, copper, and gold for your warehouse/stock
## New in v2 (from admins point of view) ## New in v2 (from admins point of view)
@ -34,7 +35,8 @@ TechPack is a collection of following Mods:
* tubelib_addons1, a Tubelib extension with mining, farming, and crafting nodes * tubelib_addons1, a Tubelib extension with mining, farming, and crafting nodes
* tubelib_addons2, a Tubelib extension with control nodes * tubelib_addons2, a Tubelib extension with control nodes
* tubelib_addons3, a Tubelib extension with high performance nodes * tubelib_addons3, a Tubelib extension with high performance nodes
* tubelib_stairway, Ladders, stairways, and bridges for your machines * techpack_stairway, Ladders, stairways, and bridges for your machines
* techpack_warehouse, Warehouse Boxes in steel, copper, and gold
* gravelsieve, a Mod to sieve ores from gravel. * gravelsieve, a Mod to sieve ores from gravel.
* smartline, a Mod with small and smart sensors, actors and controllers. * smartline, a Mod with small and smart sensors, actors and controllers.
* safer_lua, a subset of the language Lua for safe and secure Lua sandboxes * safer_lua, a subset of the language Lua for safe and secure Lua sandboxes
@ -83,6 +85,7 @@ TechPack provides:
- a Signal Tower node showing machine states - a Signal Tower node showing machine states
- a Display node for text outputs of the Controller - a Display node for text outputs of the Controller
- Metal ladders, stairways, and bridges - Metal ladders, stairways, and bridges
- Warehouse Boxes in steel, copper, and gold
TechPack supports the following mods: TechPack supports the following mods:

@ -1,9 +1,22 @@
minetest.register_node("tubelib_stairway:grating", { --[[
description = "Tubelib Grating",
TechPack Stairway
=================
Copyright (C) 2019 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
init.lua
]]--
minetest.register_node("techpack_stairway:grating", {
description = "TechPack Grating",
tiles = { tiles = {
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -29,12 +42,12 @@ minetest.register_node("tubelib_stairway:grating", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:handrail1", { minetest.register_node("techpack_stairway:handrail1", {
description = "Tubelib Handrail 1", description = "TechPack Handrail 1",
tiles = { tiles = {
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -60,12 +73,12 @@ minetest.register_node("tubelib_stairway:handrail1", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:handrail2", { minetest.register_node("techpack_stairway:handrail2", {
description = "Tubelib Handrail 2", description = "TechPack Handrail 2",
tiles = { tiles = {
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -93,12 +106,12 @@ minetest.register_node("tubelib_stairway:handrail2", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:handrail3", { minetest.register_node("techpack_stairway:handrail3", {
description = "Tubelib Handrail 3", description = "TechPack Handrail 3",
tiles = { tiles = {
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -126,12 +139,12 @@ minetest.register_node("tubelib_stairway:handrail3", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:handrail4", { minetest.register_node("techpack_stairway:handrail4", {
description = "Tubelib Handrail 4", description = "TechPack Handrail 4",
tiles = { tiles = {
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -161,12 +174,12 @@ minetest.register_node("tubelib_stairway:handrail4", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:bridge1", { minetest.register_node("techpack_stairway:bridge1", {
description = "Tubelib Bridge 1", description = "TechPack Bridge 1",
tiles = { tiles = {
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -193,12 +206,12 @@ minetest.register_node("tubelib_stairway:bridge1", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:bridge2", { minetest.register_node("techpack_stairway:bridge2", {
description = "Tubelib Bridge 2", description = "TechPack Bridge 2",
tiles = { tiles = {
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -226,12 +239,12 @@ minetest.register_node("tubelib_stairway:bridge2", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:bridge3", { minetest.register_node("techpack_stairway:bridge3", {
description = "Tubelib Bridge 3", description = "TechPack Bridge 3",
tiles = { tiles = {
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -259,12 +272,12 @@ minetest.register_node("tubelib_stairway:bridge3", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:bridge4", { minetest.register_node("techpack_stairway:bridge4", {
description = "Tubelib Bridge 4", description = "TechPack Bridge 4",
tiles = { tiles = {
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_bottom.png', 'techpack_stairway_bottom.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -293,12 +306,12 @@ minetest.register_node("tubelib_stairway:bridge4", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:stairway", { minetest.register_node("techpack_stairway:stairway", {
description = "Tubelib Stairway", description = "TechPack Stairway",
tiles = { tiles = {
'tubelib_stairway_steps.png', 'techpack_stairway_steps.png',
'tubelib_stairway_steps.png', 'techpack_stairway_steps.png',
'tubelib_stairway_side.png', 'techpack_stairway_side.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -331,12 +344,12 @@ minetest.register_node("tubelib_stairway:stairway", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:ladder1", { minetest.register_node("techpack_stairway:ladder1", {
description = "Tubelib Ladder 1", description = "TechPack Ladder 1",
tiles = { tiles = {
'tubelib_stairway_steps.png', 'techpack_stairway_steps.png',
'tubelib_stairway_steps.png', 'techpack_stairway_steps.png',
'tubelib_stairway_ladder.png', 'techpack_stairway_ladder.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -362,12 +375,12 @@ minetest.register_node("tubelib_stairway:ladder1", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:ladder2", { minetest.register_node("techpack_stairway:ladder2", {
description = "Tubelib Ladder 2", description = "TechPack Ladder 2",
tiles = { tiles = {
'tubelib_stairway_steps.png', 'techpack_stairway_steps.png',
'tubelib_stairway_steps.png', 'techpack_stairway_steps.png',
'tubelib_stairway_ladder.png', 'techpack_stairway_ladder.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -394,10 +407,10 @@ minetest.register_node("tubelib_stairway:ladder2", {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
}) })
minetest.register_node("tubelib_stairway:lattice", { minetest.register_node("techpack_stairway:lattice", {
description = "Tubelib Lattice", description = "TechPack Lattice",
tiles = { tiles = {
'tubelib_stairway_lattice.png', 'techpack_stairway_lattice.png',
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -427,7 +440,7 @@ minetest.register_node("tubelib_stairway:lattice", {
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:grating 4", output = "techpack_stairway:grating 4",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"dye:dark_grey", "", "default:coal_lump"}, {"dye:dark_grey", "", "default:coal_lump"},
@ -436,7 +449,7 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:handrail1 4", output = "techpack_stairway:handrail1 4",
recipe = { recipe = {
{"default:steel_ingot", "default:coal_lump", ""}, {"default:steel_ingot", "default:coal_lump", ""},
{"default:tin_ingot", "", ""}, {"default:tin_ingot", "", ""},
@ -445,7 +458,7 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:stairway 2", output = "techpack_stairway:stairway 2",
recipe = { recipe = {
{"", "", "default:steel_ingot"}, {"", "", "default:steel_ingot"},
{"dye:dark_grey", "default:tin_ingot", "default:coal_lump"}, {"dye:dark_grey", "default:tin_ingot", "default:coal_lump"},
@ -454,7 +467,7 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:ladder1 2", output = "techpack_stairway:ladder1 2",
recipe = { recipe = {
{"", "default:steel_ingot", ""}, {"", "default:steel_ingot", ""},
{"dye:dark_grey", "default:tin_ingot", "default:coal_lump"}, {"dye:dark_grey", "default:tin_ingot", "default:coal_lump"},
@ -463,7 +476,7 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:lattice 2", output = "techpack_stairway:lattice 2",
recipe = { recipe = {
{"default:steel_ingot", "", "default:steel_ingot"}, {"default:steel_ingot", "", "default:steel_ingot"},
{"dye:dark_grey", "default:tin_ingot", "default:coal_lump"}, {"dye:dark_grey", "default:tin_ingot", "default:coal_lump"},
@ -472,69 +485,84 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:handrail2", output = "techpack_stairway:handrail2",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"tubelib_stairway:handrail1", "", "tubelib_stairway:handrail1"}, {"techpack_stairway:handrail1", "", "techpack_stairway:handrail1"},
{"", "", ""}, {"", "", ""},
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:handrail3", output = "techpack_stairway:handrail3",
recipe = { recipe = {
{"", "tubelib_stairway:handrail1", ""}, {"", "techpack_stairway:handrail1", ""},
{"tubelib_stairway:handrail1", "", ""}, {"techpack_stairway:handrail1", "", ""},
{"", "", ""}, {"", "", ""},
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:handrail4", output = "techpack_stairway:handrail4",
recipe = { recipe = {
{"", "tubelib_stairway:handrail1", ""}, {"", "techpack_stairway:handrail1", ""},
{"tubelib_stairway:handrail1", "", "tubelib_stairway:handrail1"}, {"techpack_stairway:handrail1", "", "techpack_stairway:handrail1"},
{"", "", ""}, {"", "", ""},
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:bridge1", output = "techpack_stairway:bridge1",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"tubelib_stairway:handrail1", "tubelib_stairway:grating", ""}, {"techpack_stairway:handrail1", "techpack_stairway:grating", ""},
{"", "", ""}, {"", "", ""},
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:bridge2", output = "techpack_stairway:bridge2",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"tubelib_stairway:handrail1", "tubelib_stairway:grating", "tubelib_stairway:handrail1"}, {"techpack_stairway:handrail1", "techpack_stairway:grating", "techpack_stairway:handrail1"},
{"", "", ""},
},
})
minetest.register_craft({
output = "tubelib_stairway:bridge3",
recipe = {
{"", "tubelib_stairway:handrail1", ""},
{"tubelib_stairway:handrail1", "tubelib_stairway:grating", ""},
{"", "", ""},
},
})
minetest.register_craft({
output = "tubelib_stairway:bridge4",
recipe = {
{"", "tubelib_stairway:handrail1", ""},
{"tubelib_stairway:handrail1", "tubelib_stairway:grating", "tubelib_stairway:handrail1"},
{"", "", ""}, {"", "", ""},
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "tubelib_stairway:ladder2", output = "techpack_stairway:bridge3",
recipe = {{"tubelib_stairway:ladder1"}}, recipe = {
{"", "techpack_stairway:handrail1", ""},
{"techpack_stairway:handrail1", "techpack_stairway:grating", ""},
{"", "", ""},
},
}) })
minetest.register_craft({
output = "techpack_stairway:bridge4",
recipe = {
{"", "techpack_stairway:handrail1", ""},
{"techpack_stairway:handrail1", "techpack_stairway:grating", "techpack_stairway:handrail1"},
{"", "", ""},
},
})
minetest.register_craft({
output = "techpack_stairway:ladder2",
recipe = {{"techpack_stairway:ladder1"}},
})
minetest.register_alias("tubelib_stairway:grating", "techpack_stairway:grating")
minetest.register_alias("tubelib_stairway:lattice", "techpack_stairway:lattice")
minetest.register_alias("tubelib_stairway:handrail1", "techpack_stairway:handrail1")
minetest.register_alias("tubelib_stairway:handrail2", "techpack_stairway:handrail3")
minetest.register_alias("tubelib_stairway:handrail3", "techpack_stairway:handrail4")
minetest.register_alias("tubelib_stairway:handrail4", "techpack_stairway:handrail5")
minetest.register_alias("tubelib_stairway:stairway", "techpack_stairway:stairway")
minetest.register_alias("tubelib_stairway:ladder1", "techpack_stairway:ladder1")
minetest.register_alias("tubelib_stairway:ladder2", "techpack_stairway:ladder2")
minetest.register_alias("tubelib_stairway:bridge1", "techpack_stairway:bridge1")
minetest.register_alias("tubelib_stairway:bridge2", "techpack_stairway:bridge2")
minetest.register_alias("tubelib_stairway:bridge3", "techpack_stairway:bridge3")
minetest.register_alias("tubelib_stairway:bridge4", "techpack_stairway:bridge4")

@ -0,0 +1,2 @@
name=techpack_stairway

Before

Width:  |  Height:  |  Size: 311 B

After

Width:  |  Height:  |  Size: 311 B

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 334 B

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 439 B

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 319 B

@ -0,0 +1,163 @@
--[[
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
box_copper.lua
]]--
--- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
local wh = techpack_warehouse
local NODE_NAME = "techpack_warehouse:box_copper"
local DESCRIPTION = "Warehouse Box Copper"
local INV_SIZE = 1200
local BACKGROUND_IMG = "default_copper_block.png"
local Box = wh.Box:new({
node_name = NODE_NAME,
description = DESCRIPTION,
inv_size = INV_SIZE,
background_img = BACKGROUND_IMG,
})
minetest.register_node(NODE_NAME, {
description = DESCRIPTION.." (8 x "..INV_SIZE.." items)",
tiles = wh.tiles(BACKGROUND_IMG),
after_place_node = function(pos, placer, itemstack)
return wh.after_place_node(Box, pos, placer, itemstack)
end,
on_receive_fields = function(pos, formname, fields, player)
wh.on_receive_fields(Box, pos, formname, fields, player)
end,
on_timer = function(pos,elapsed)
return wh.on_timer(Box, pos,elapsed)
end,
on_dig = function(pos, node, puncher, pointed_thing)
wh.on_dig(Box, pos, node, puncher, pointed_thing)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
end,
on_metadata_inventory_put = wh.on_metadata_inventory_put,
allow_metadata_inventory_take = wh.allow_metadata_inventory_take,
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node(NODE_NAME.."_active", {
description = DESCRIPTION.." (8 x "..INV_SIZE.." items)",
tiles = wh.tiles_active(BACKGROUND_IMG),
after_place_node = function(pos, placer, itemstack)
return wh.after_place_node(Box, pos, placer, itemstack)
end,
on_receive_fields = function(pos, formname, fields, player)
wh.on_receive_fields(Box, pos, formname, fields, player)
end,
on_timer = function(pos,elapsed)
return wh.on_timer(Box, pos,elapsed)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
end,
on_metadata_inventory_put = wh.on_metadata_inventory_put,
allow_metadata_inventory_take = wh.allow_metadata_inventory_take,
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {crumbly=0, not_in_creative_inventory=1},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node(NODE_NAME.."_defect", {
description = DESCRIPTION.." (8 x "..INV_SIZE.." items)",
tiles = wh.tiles_defect(BACKGROUND_IMG),
after_place_node = function(pos, placer, itemstack)
wh.after_place_node(Box, pos, placer, itemstack)
Box.State:defect(pos, M(pos))
end,
on_dig = function(pos, node, puncher, pointed_thing)
wh.on_dig(Box, pos, node, puncher, pointed_thing)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
end,
on_metadata_inventory_put = wh.on_metadata_inventory_put,
allow_metadata_inventory_take = wh.allow_metadata_inventory_take,
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
tubelib.register_node(NODE_NAME,
{NODE_NAME.."_active", NODE_NAME.."_defect"}, {
on_push_item = function(pos, side, item)
local meta = M(pos)
meta:set_string("push_dir", side)
local num = wh.numbers_to_shift(Box, meta, item)
if num then
item:set_count(num)
return tubelib.put_item(meta, "shift", item)
end
end,
on_pull_stack = function(pos, side)
return tubelib.get_stack(M(pos), "main")
end,
on_unpull_item = function(pos, side, item)
return tubelib.put_item(M(pos), "main", item)
end,
on_recv_message = function(pos, topic, payload)
local resp = Box.State:on_receive_message(pos, topic, payload)
if resp then
return resp
else
return "unsupported"
end
end,
on_node_load = function(pos)
Box.State:on_node_load(pos)
end,
on_node_repair = function(pos)
return Box.State:on_node_repair(pos)
end,
})
minetest.register_craft({
output = NODE_NAME,
recipe = {
{"default:copper_ingot", "tubelib:pusher", "default:copper_ingot"},
{"default:copper_ingot", "tubelib_addons1:chest", "default:copper_ingot"},
{"", "", ""},
}
})

@ -0,0 +1,163 @@
--[[
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
box_gold.lua
]]--
--- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
local wh = techpack_warehouse
local NODE_NAME = "techpack_warehouse:box_gold"
local DESCRIPTION = "Warehouse Box Gold"
local INV_SIZE = 3600
local BACKGROUND_IMG = "default_gold_block.png"
local Box = wh.Box:new({
node_name = NODE_NAME,
description = DESCRIPTION,
inv_size = INV_SIZE,
background_img = BACKGROUND_IMG,
})
minetest.register_node(NODE_NAME, {
description = DESCRIPTION.." (8 x "..INV_SIZE.." items)",
tiles = wh.tiles(BACKGROUND_IMG),
after_place_node = function(pos, placer, itemstack)
return wh.after_place_node(Box, pos, placer, itemstack)
end,
on_receive_fields = function(pos, formname, fields, player)
wh.on_receive_fields(Box, pos, formname, fields, player)
end,
on_timer = function(pos,elapsed)
return wh.on_timer(Box, pos,elapsed)
end,
on_dig = function(pos, node, puncher, pointed_thing)
wh.on_dig(Box, pos, node, puncher, pointed_thing)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
end,
on_metadata_inventory_put = wh.on_metadata_inventory_put,
allow_metadata_inventory_take = wh.allow_metadata_inventory_take,
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node(NODE_NAME.."_active", {
description = DESCRIPTION.." (8 x "..INV_SIZE.." items)",
tiles = wh.tiles_active(BACKGROUND_IMG),
after_place_node = function(pos, placer, itemstack)
return wh.after_place_node(Box, pos, placer, itemstack)
end,
on_receive_fields = function(pos, formname, fields, player)
wh.on_receive_fields(Box, pos, formname, fields, player)
end,
on_timer = function(pos,elapsed)
return wh.on_timer(Box, pos,elapsed)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
end,
on_metadata_inventory_put = wh.on_metadata_inventory_put,
allow_metadata_inventory_take = wh.allow_metadata_inventory_take,
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {crumbly=0, not_in_creative_inventory=1},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node(NODE_NAME.."_defect", {
description = DESCRIPTION.." (8 x "..INV_SIZE.." items)",
tiles = wh.tiles_defect(BACKGROUND_IMG),
after_place_node = function(pos, placer, itemstack)
wh.after_place_node(Box, pos, placer, itemstack)
Box.State:defect(pos, M(pos))
end,
on_dig = function(pos, node, puncher, pointed_thing)
wh.on_dig(Box, pos, node, puncher, pointed_thing)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
end,
on_metadata_inventory_put = wh.on_metadata_inventory_put,
allow_metadata_inventory_take = wh.allow_metadata_inventory_take,
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
tubelib.register_node(NODE_NAME,
{NODE_NAME.."_active", NODE_NAME.."_defect"}, {
on_push_item = function(pos, side, item)
local meta = M(pos)
meta:set_string("push_dir", side)
local num = wh.numbers_to_shift(Box, meta, item)
if num then
item:set_count(num)
return tubelib.put_item(meta, "shift", item)
end
end,
on_pull_stack = function(pos, side)
return tubelib.get_stack(M(pos), "main")
end,
on_unpull_item = function(pos, side, item)
return tubelib.put_item(M(pos), "main", item)
end,
on_recv_message = function(pos, topic, payload)
local resp = Box.State:on_receive_message(pos, topic, payload)
if resp then
return resp
else
return "unsupported"
end
end,
on_node_load = function(pos)
Box.State:on_node_load(pos)
end,
on_node_repair = function(pos)
return Box.State:on_node_repair(pos)
end,
})
minetest.register_craft({
output = NODE_NAME,
recipe = {
{"default:gold_ingot", "tubelib:pusher", "default:gold_ingot"},
{"default:gold_ingot", "tubelib_addons1:chest", "default:gold_ingot"},
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
}
})

@ -0,0 +1,163 @@
--[[
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
box_steel.lua
]]--
--- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
local wh = techpack_warehouse
local NODE_NAME = "techpack_warehouse:box_steel"
local DESCRIPTION = "Warehouse Box Steel"
local INV_SIZE = 400
local BACKGROUND_IMG = "default_steel_block.png"
local Box = wh.Box:new({
node_name = NODE_NAME,
description = DESCRIPTION,
inv_size = INV_SIZE,
background_img = BACKGROUND_IMG,
})
minetest.register_node(NODE_NAME, {
description = DESCRIPTION.." (8 x "..INV_SIZE.." items)",
tiles = wh.tiles(BACKGROUND_IMG),
after_place_node = function(pos, placer, itemstack)
return wh.after_place_node(Box, pos, placer, itemstack)
end,
on_receive_fields = function(pos, formname, fields, player)
wh.on_receive_fields(Box, pos, formname, fields, player)
end,
on_timer = function(pos,elapsed)
return wh.on_timer(Box, pos,elapsed)
end,
on_dig = function(pos, node, puncher, pointed_thing)
wh.on_dig(Box, pos, node, puncher, pointed_thing)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
end,
on_metadata_inventory_put = wh.on_metadata_inventory_put,
allow_metadata_inventory_take = wh.allow_metadata_inventory_take,
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node(NODE_NAME.."_active", {
description = DESCRIPTION.." (8 x "..INV_SIZE.." items)",
tiles = wh.tiles_active(BACKGROUND_IMG),
after_place_node = function(pos, placer, itemstack)
return wh.after_place_node(Box, pos, placer, itemstack)
end,
on_receive_fields = function(pos, formname, fields, player)
wh.on_receive_fields(Box, pos, formname, fields, player)
end,
on_timer = function(pos,elapsed)
return wh.on_timer(Box, pos,elapsed)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
end,
on_metadata_inventory_put = wh.on_metadata_inventory_put,
allow_metadata_inventory_take = wh.allow_metadata_inventory_take,
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {crumbly=0, not_in_creative_inventory=1},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node(NODE_NAME.."_defect", {
description = DESCRIPTION.." (8 x "..INV_SIZE.." items)",
tiles = wh.tiles_defect(BACKGROUND_IMG),
after_place_node = function(pos, placer, itemstack)
wh.after_place_node(Box, pos, placer, itemstack)
Box.State:defect(pos, M(pos))
end,
on_dig = function(pos, node, puncher, pointed_thing)
wh.on_dig(Box, pos, node, puncher, pointed_thing)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
end,
on_metadata_inventory_put = wh.on_metadata_inventory_put,
allow_metadata_inventory_take = wh.allow_metadata_inventory_take,
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
tubelib.register_node(NODE_NAME,
{NODE_NAME.."_active", NODE_NAME.."_defect"}, {
on_push_item = function(pos, side, item)
local meta = M(pos)
meta:set_string("push_dir", side)
local num = wh.numbers_to_shift(Box, meta, item)
if num then
item:set_count(num)
return tubelib.put_item(meta, "shift", item)
end
end,
on_pull_stack = function(pos, side)
return tubelib.get_stack(M(pos), "main")
end,
on_unpull_item = function(pos, side, item)
return tubelib.put_item(M(pos), "main", item)
end,
on_recv_message = function(pos, topic, payload)
local resp = Box.State:on_receive_message(pos, topic, payload)
if resp then
return resp
else
return "unsupported"
end
end,
on_node_load = function(pos)
Box.State:on_node_load(pos)
end,
on_node_repair = function(pos)
return Box.State:on_node_repair(pos)
end,
})
minetest.register_craft({
output = NODE_NAME,
recipe = {
{"default:steel_ingot", "tubelib:pusher", "default:steel_ingot"},
{"", "tubelib_addons1:chest", ""},
{"", "", ""},
}
})

@ -0,0 +1,297 @@
--[[
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
common.lua
]]--
--- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
local STANDBY_TICKS = 4
local COUNTDOWN_TICKS = 2
local CYCLE_TIME = 2
local Cache = {}
techpack_warehouse.Box = {}
local function formspec(self, pos, meta)
return "size[10,9]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"image[0,0;1,1;techpack_warehouse_arrow_inv.png]"..
"list[context;shift;1,0;8,1;]"..
"image[9,0;1,1;techpack_warehouse_arrow_inv.png]"..
"image[0,1.2;1,1;techpack_warehouse_filter_inv.png]"..
"list[context;filter;1,1.2;8,1;]"..
"image[9,1.2;1,1;techpack_warehouse_filter_inv.png]"..
"image[0,2.4;1,1;techpack_warehouse_inventory_inv.png]"..
"list[context;main;1,2.4;8,1;]"..
"image[9,2.4;1,1;techpack_warehouse_inventory_inv.png]"..
"image[0,3.6;1,1;techpack_warehouse_input_inv.png]"..
"list[context;input;1,3.6;8,1;]"..
"image[9,3.6;1,1;techpack_warehouse_input_inv.png]"..
"image_button[9,5.3;1,1;".. self:get_state_button_image(meta) ..";state_button;]"..
"list[current_player;main;0.5,5.3;8,4;]"..
"listring[context;shift]"..
"listring[current_player;main]"..
"listring[context;input]"
end
local function move_to_main(pos, index)
local inv = M(pos):get_inventory()
local main_stack = inv:get_stack("main", index)
local inp_stack = inv:get_stack("input", index)
local stack = ItemStack(inp_stack:get_name())
stack:set_count(inp_stack:get_count() + main_stack:get_count())
inp_stack:clear()
inv:set_stack("main", index, stack)
inv:set_stack("input", index, inp_stack)
end
function techpack_warehouse.tiles(background_img)
return {
-- up, down, right, left, back, front
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
background_img..'^techpack_warehouse_box_side.png',
background_img..'^techpack_warehouse_box_side.png',
background_img..'^techpack_warehouse_box_back.png',
background_img..'^techpack_warehouse_box_front.png',
}
end
function techpack_warehouse.tiles_active(background_img)
return {
-- up, down, right, left, back, front
{
image = "tubelib_addons3_pusher_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 32,
aspect_h = 32,
length = 2.0,
},
},
{
image = "tubelib_addons3_pusher_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 32,
aspect_h = 32,
length = 2.0,
},
},
background_img..'^techpack_warehouse_box_side.png',
background_img..'^techpack_warehouse_box_side.png',
background_img..'^techpack_warehouse_box_back.png',
background_img..'^techpack_warehouse_box_front.png',
}
end
function techpack_warehouse.tiles_defect(background_img)
return {
-- up, down, right, left, back, front
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
background_img..'^techpack_warehouse_box_side.png^tubelib_defect.png',
background_img..'^techpack_warehouse_box_side.png^tubelib_defect.png',
background_img..'^techpack_warehouse_box_back.png^tubelib_defect.png',
background_img..'^techpack_warehouse_box_front.png^tubelib_defect.png',
}
end
function techpack_warehouse.Box:new(attr)
local o = {
node_name = attr.node_name,
description = attr.description,
inv_size = attr.inv_size,
background_img = attr.background_img,
}
o.State = tubelib.NodeStates:new({
node_name_passive = attr.node_name,
node_name_active = attr.node_name.."_active",
node_name_defect = attr.node_name.."_defect",
infotext_name = attr.description,
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 50,
formspec_func = formspec,
})
setmetatable(o, self)
self.__index = self
return o
end
function techpack_warehouse.numbers_to_shift(self, meta, item)
-- check cache
local number = meta:get_string("number")
local item_name = item:get_name()
if not Cache[number] then
local inv = meta:get_inventory()
Cache[number] = {}
for idx,items in ipairs(inv:get_list("filter")) do
Cache[number][idx] = items:get_name()
end
end
-- determine number to shift
local num_items = item:get_count()
local inv_size = meta:get_int("inv_size")
local inv = meta:get_inventory()
for idx, name in ipairs(Cache[number]) do
if item_name == name then
local stack_size = inv:get_stack("main", idx):get_count()
if stack_size == self.inv_size then -- full?
Cache[number][idx] = "" -- delete for searching
elseif (stack_size + num_items) > self.inv_size then -- limit will be reached?
inv:set_stack("main", idx, ItemStack({name = item_name, count = self.inv_size}))
Cache[number][idx] = "" -- delete for searching
-- search with the rest for further slots
num_items = num_items - (self.inv_size - stack_size)
else
inv:set_stack("main", idx, ItemStack({name = item_name, count = stack_size + num_items}))
return 0
end
end
end
return num_items
end
function techpack_warehouse.allow_metadata_inventory_put(self, pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local inv = M(pos):get_inventory()
local main_stack = inv:get_stack("main", index)
local item_name = inv:get_stack("filter", index):get_name()
if listname == "input" and item_name == stack:get_name() then
return math.min(stack:get_count(), self.inv_size - main_stack:get_count())
elseif listname == "filter" then
local number = M(pos):get_string("number")
Cache[number] = nil
return 1
elseif listname == "shift" and item_name == main_stack:get_name() then
return stack:get_count()
end
return 0
end
function techpack_warehouse.on_metadata_inventory_put(pos, listname, index, stack, player)
if listname == "input" then
minetest.after(0.5, move_to_main, pos, index)
end
end
function techpack_warehouse.allow_metadata_inventory_take(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
if listname == "main" then
local number = M(pos):get_string("number")
Cache[number] = nil
local inv = M(pos):get_inventory()
local list = inv:get_list("main")
local num = list[index]:get_count()
if num > 99 then
return 99
else
return num
end
elseif listname == "filter" then
local number = M(pos):get_string("number")
Cache[number] = nil
return 1
elseif listname == "shift" then
return stack:get_count()
end
return 0
end
function techpack_warehouse.allow_metadata_inventory_move(pos, listname, index, stack, player)
return 0
end
function techpack_warehouse.on_receive_fields(self, pos, formname, fields, player)
if minetest.is_protected(pos, player:get_player_name()) then
return
end
self.State:state_button_event(pos, fields)
end
function techpack_warehouse.after_place_node(self, pos, placer, itemstack)
local meta = M(pos)
local number = tubelib.add_node(pos, self.node_name)
self.State:node_init(pos, number)
meta:set_string("player_name", placer:get_player_name())
local inv = meta:get_inventory()
inv:set_size('shift', 8)
inv:set_size('filter', 8)
inv:set_size('main', 8)
inv:set_size('input', 8)
end
function techpack_warehouse.on_timer(self, pos, elapsed)
local meta = M(pos)
local inv = meta:get_inventory()
if not inv:is_empty("shift") then
local number = meta:get_string("number")
local player_name = meta:get_string("player_name")
local offs = meta:get_int("offs")
local push_dir = meta:get_string("push_dir") or "R"
meta:set_int("offs", offs + 1)
for i = 0,7 do
local idx = ((i + offs) % 8) + 1
local stack = inv:get_stack("shift", idx)
if stack:get_count() > 0 then
if tubelib.push_items(pos, push_dir, stack, player_name) then
-- The effort is needed here for the case the
-- pusher pushes into its own chest.
local num = stack:get_count()
stack = inv:get_stack("shift", idx)
stack:take_item(num)
inv:set_stack("shift", idx, stack)
self.State:keep_running(pos, meta, COUNTDOWN_TICKS)
break
else
self.State:blocked(pos, meta)
end
end
end
else
self.State:idle(pos, meta)
end
return self.State:is_active(meta)
end
function techpack_warehouse.on_dig(self, pos, node, puncher, pointed_thing)
local inv = M(pos):get_inventory()
if inv:is_empty("main") and inv:is_empty("shift") then
minetest.node_dig(pos, node, puncher, pointed_thing)
tubelib.remove_node(pos)
end
end

@ -0,0 +1,3 @@
tubelib
tubelib_addons3

@ -0,0 +1,2 @@
Warehouse boxes

@ -0,0 +1,20 @@
--[[
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
init.lua
]]--
techpack_warehouse = {}
dofile(minetest.get_modpath("techpack_warehouse") .. "/common.lua")
dofile(minetest.get_modpath("techpack_warehouse") .. "/box_steel.lua")
dofile(minetest.get_modpath("techpack_warehouse") .. "/box_copper.lua")
dofile(minetest.get_modpath("techpack_warehouse") .. "/box_gold.lua")

@ -0,0 +1,2 @@
name=techpack_warehouse

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

@ -32,17 +32,7 @@ local COUNTDOWN_TICKS = 6
local STANDBY_TICKS = 4 local STANDBY_TICKS = 4
local CYCLE_TIME = 2 local CYCLE_TIME = 2
local State = tubelib.NodeStates:new({ local function formspec(self, pos, meta)
node_name_passive = "tubelib:distributor",
node_name_active = "tubelib:distributor_active",
node_name_defect = "tubelib:distributor_defect",
infotext_name = "Tubelib Distributor",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
aging_factor = 10,
})
local function formspec(pos, meta)
local filter = minetest.deserialize(meta:get_string("filter")) or {false,false,false,false} local filter = minetest.deserialize(meta:get_string("filter")) or {false,false,false,false}
return "size[10.5,8.5]".. return "size[10.5,8.5]"..
default.gui_bg.. default.gui_bg..
@ -50,7 +40,7 @@ local function formspec(pos, meta)
default.gui_slots.. default.gui_slots..
"list[context;src;0,0;2,4;]".. "list[context;src;0,0;2,4;]"..
"image[2,1.5;1,1;tubelib_gui_arrow.png]".. "image[2,1.5;1,1;tubelib_gui_arrow.png]"..
"image_button[2,3;1,1;"..State:get_state_button_image(meta)..";state_button;]".. "image_button[2,3;1,1;"..self:get_state_button_image(meta)..";state_button;]"..
"checkbox[3,0;filter1;On;"..dump(filter[1]).."]".. "checkbox[3,0;filter1;On;"..dump(filter[1]).."]"..
"checkbox[3,1;filter2;On;"..dump(filter[2]).."]".. "checkbox[3,1;filter2;On;"..dump(filter[2]).."]"..
"checkbox[3,2;filter3;On;"..dump(filter[3]).."]".. "checkbox[3,2;filter3;On;"..dump(filter[3]).."]"..
@ -68,7 +58,16 @@ local function formspec(pos, meta)
"listring[current_player;main]" "listring[current_player;main]"
end end
State:register_formspec_func(formspec) local State = tubelib.NodeStates:new({
node_name_passive = "tubelib:distributor",
node_name_active = "tubelib:distributor_active",
node_name_defect = "tubelib:distributor_defect",
infotext_name = "Tubelib Distributor",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
aging_factor = 10,
formspec_func = formspec,
})
-- Return a key/value table with all items and the corresponding stack numbers -- Return a key/value table with all items and the corresponding stack numbers
local function invlist_content_as_kvlist(list) local function invlist_content_as_kvlist(list)

@ -94,6 +94,7 @@ function NodeStates:new(attr)
start_condition_fullfilled = attr.start_condition_fullfilled or start_condition_fullfilled, start_condition_fullfilled = attr.start_condition_fullfilled or start_condition_fullfilled,
on_start = attr.on_start, on_start = attr.on_start,
on_stop = attr.on_stop, on_stop = attr.on_stop,
formspec_func = attr.formspec_func,
} }
if attr.aging_factor then if attr.aging_factor then
o.aging_level1 = attr.aging_factor * tubelib.machine_aging_value o.aging_level1 = attr.aging_factor * tubelib.machine_aging_value
@ -104,10 +105,6 @@ function NodeStates:new(attr)
return o return o
end end
function NodeStates:register_formspec_func(func)
self.formspec_func = func
end
function NodeStates:node_init(pos, number) function NodeStates:node_init(pos, number)
local meta = M(pos) local meta = M(pos)
meta:set_int("tubelib_state", STOPPED) meta:set_int("tubelib_state", STOPPED)
@ -122,7 +119,7 @@ function NodeStates:node_init(pos, number)
meta:set_int("tubelib_aging", 0) meta:set_int("tubelib_aging", 0)
end end
if self.formspec_func then if self.formspec_func then
meta:set_string("formspec", self.formspec_func(pos, meta)) meta:set_string("formspec", self.formspec_func(self, pos, meta))
end end
end end
@ -143,7 +140,7 @@ function NodeStates:stop(pos, meta)
meta:set_string("infotext", self.infotext_name.." "..number..": stopped") meta:set_string("infotext", self.infotext_name.." "..number..": stopped")
end end
if self.formspec_func then if self.formspec_func then
meta:set_string("formspec", self.formspec_func(pos, meta)) meta:set_string("formspec", self.formspec_func(self, pos, meta))
end end
minetest.get_node_timer(pos):stop() minetest.get_node_timer(pos):stop()
return true return true
@ -161,6 +158,7 @@ function NodeStates:start(pos, meta, called_from_on_timer)
self.on_start(pos, meta, state) self.on_start(pos, meta, state)
end end
meta:set_int("tubelib_state", RUNNING) meta:set_int("tubelib_state", RUNNING)
meta:set_int("tubelib_countdown", 4)
if called_from_on_timer then if called_from_on_timer then
-- timer has to be stopped once to be able to be restarted -- timer has to be stopped once to be able to be restarted
self.stop_timer = true self.stop_timer = true
@ -175,7 +173,7 @@ function NodeStates:start(pos, meta, called_from_on_timer)
meta:set_string("infotext", self.infotext_name.." "..number..": running") meta:set_string("infotext", self.infotext_name.." "..number..": running")
end end
if self.formspec_func then if self.formspec_func then
meta:set_string("formspec", self.formspec_func(pos, meta)) meta:set_string("formspec", self.formspec_func(self, pos, meta))
end end
minetest.get_node_timer(pos):start(self.cycle_time) minetest.get_node_timer(pos):start(self.cycle_time)
return true return true
@ -198,7 +196,7 @@ function NodeStates:standby(pos, meta)
meta:set_string("infotext", self.infotext_name.." "..number..": standby") meta:set_string("infotext", self.infotext_name.." "..number..": standby")
end end
if self.formspec_func then if self.formspec_func then
meta:set_string("formspec", self.formspec_func(pos, meta)) meta:set_string("formspec", self.formspec_func(self, pos, meta))
end end
minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks) minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks)
return true return true
@ -222,7 +220,7 @@ function NodeStates:blocked(pos, meta)
meta:set_string("infotext", self.infotext_name.." "..number..": blocked") meta:set_string("infotext", self.infotext_name.." "..number..": blocked")
end end
if self.formspec_func then if self.formspec_func then
meta:set_string("formspec", self.formspec_func(pos, meta)) meta:set_string("formspec", self.formspec_func(self, pos, meta))
end end
minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks) minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks)
return true return true
@ -243,7 +241,7 @@ function NodeStates:fault(pos, meta)
meta:set_string("infotext", self.infotext_name.." "..number..": fault") meta:set_string("infotext", self.infotext_name.." "..number..": fault")
end end
if self.formspec_func then if self.formspec_func then
meta:set_string("formspec", self.formspec_func(pos, meta)) meta:set_string("formspec", self.formspec_func(self, pos, meta))
end end
minetest.get_node_timer(pos):stop() minetest.get_node_timer(pos):stop()
return true return true
@ -263,7 +261,7 @@ function NodeStates:defect(pos, meta)
meta:set_string("infotext", self.infotext_name.." "..number..": defect") meta:set_string("infotext", self.infotext_name.." "..number..": defect")
end end
if self.formspec_func then if self.formspec_func then
meta:set_string("formspec", self.formspec_func(pos, meta)) meta:set_string("formspec", self.formspec_func(self, pos, meta))
end end
minetest.get_node_timer(pos):stop() minetest.get_node_timer(pos):stop()
return true return true
@ -408,7 +406,7 @@ function NodeStates:on_node_load(pos, not_start_timer)
end end
if self.formspec_func then if self.formspec_func then
meta:set_string("formspec", self.formspec_func(pos, meta)) meta:set_string("formspec", self.formspec_func(self, pos, meta))
end end
end end
@ -430,7 +428,7 @@ function NodeStates:on_node_repair(pos)
meta:set_string("infotext", self.infotext_name.." "..number..": stopped") meta:set_string("infotext", self.infotext_name.." "..number..": stopped")
end end
if self.formspec_func then if self.formspec_func then
meta:set_string("formspec", self.formspec_func(pos, meta)) meta:set_string("formspec", self.formspec_func(self, pos, meta))
end end
return true return true
end end

@ -24,6 +24,25 @@ local STANDBY_TICKS = 6
local COUNTDOWN_TICKS = 6 local COUNTDOWN_TICKS = 6
local CYCLE_TIME = 2 local CYCLE_TIME = 2
local function formspec(self, pos, meta)
return "size[8,9.2]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[context;recipe;0,0;3,3;]"..
"image[2.8,1;1,1;tubelib_gui_arrow.png]"..
"list[context;output;3.5,1;1,1;]"..
"image_button[3.5,2;1,1;".. self:get_state_button_image(meta) ..";state_button;]"..
"list[context;src;0,3.2;8,2;]"..
"list[context;dst;5,0;3,3;]"..
"list[current_player;main;0,5.4;8,4;]" ..
"listring[current_player;main]"..
"listring[context;src]" ..
"listring[current_player;main]"..
"listring[context;dst]" ..
"listring[current_player;main]"
end
local State = tubelib.NodeStates:new({ local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:autocrafter", node_name_passive = "tubelib_addons1:autocrafter",
node_name_active = "tubelib_addons1:autocrafter_active", node_name_active = "tubelib_addons1:autocrafter_active",
@ -40,29 +59,9 @@ local State = tubelib.NodeStates:new({
end end
return true return true
end, end,
formspec_func = formspec,
}) })
local function formspec(pos, meta)
return "size[8,9.2]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[context;recipe;0,0;3,3;]"..
"image[2.8,1;1,1;tubelib_gui_arrow.png]"..
"list[context;output;3.5,1;1,1;]"..
"image_button[3.5,2;1,1;".. State:get_state_button_image(meta) ..";state_button;]"..
"list[context;src;0,3.2;8,2;]"..
"list[context;dst;5,0;3,3;]"..
"list[current_player;main;0,5.4;8,4;]" ..
"listring[current_player;main]"..
"listring[context;src]" ..
"listring[current_player;main]"..
"listring[context;dst]" ..
"listring[current_player;main]"
end
State:register_formspec_func(formspec)
local function count_index(invlist) local function count_index(invlist)
local index = {} local index = {}

@ -24,17 +24,7 @@ local STANDBY_TICKS = 4
local COUNTDOWN_TICKS = 4 local COUNTDOWN_TICKS = 4
local CYCLE_TIME = 2 local CYCLE_TIME = 2
local State = tubelib.NodeStates:new({ local function formspec(self, pos, meta)
node_name_passive = "tubelib_addons1:fermenter",
node_name_defect = "tubelib_addons1:fermenter_defect",
infotext_name = "Tubelib Fermenter",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 10,
})
local function formspec(pos, meta)
return "size[8,8]".. return "size[8,8]"..
default.gui_bg.. default.gui_bg..
default.gui_bg_img.. default.gui_bg_img..
@ -42,7 +32,7 @@ local function formspec(pos, meta)
"list[context;src;0,0;3,3;]".. "list[context;src;0,0;3,3;]"..
"item_image[0,0;1,1;default:leaves]".. "item_image[0,0;1,1;default:leaves]"..
"image[3.5,1;1,1;tubelib_gui_arrow.png]".. "image[3.5,1;1,1;tubelib_gui_arrow.png]"..
"image_button[3.5,3;1,1;".. State:get_state_button_image(meta) ..";state_button;]".. "image_button[3.5,3;1,1;".. self:get_state_button_image(meta) ..";state_button;]"..
"list[context;dst;5,0;3,3;]".. "list[context;dst;5,0;3,3;]"..
"item_image[5,0;1,1;tubelib_addons1:biogas]".. "item_image[5,0;1,1;tubelib_addons1:biogas]"..
"list[current_player;main;0,4.3;8,4;]".. "list[current_player;main;0,4.3;8,4;]"..
@ -52,7 +42,16 @@ local function formspec(pos, meta)
"listring[current_player;main]" "listring[current_player;main]"
end end
State:register_formspec_func(formspec) local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:fermenter",
node_name_defect = "tubelib_addons1:fermenter_defect",
infotext_name = "Tubelib Fermenter",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 10,
formspec_func = formspec,
})
local function is_leaves(name) local function is_leaves(name)
return tubelib_addons1.FarmingNodes[name] ~= nil and return tubelib_addons1.FarmingNodes[name] ~= nil and

@ -27,18 +27,7 @@ local CYCLE_TIME = 2
-- Grinder recipes -- Grinder recipes
local Recipes = {} local Recipes = {}
local State = tubelib.NodeStates:new({ local function formspec(self, pos, meta)
node_name_passive = "tubelib_addons1:grinder",
node_name_active = "tubelib_addons1:grinder_active",
node_name_defect = "tubelib_addons1:grinder_defect",
infotext_name = "Tubelib Grinder",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 10,
})
local function formspec(pos, meta)
return "size[8,8]".. return "size[8,8]"..
default.gui_bg.. default.gui_bg..
default.gui_bg_img.. default.gui_bg_img..
@ -46,7 +35,7 @@ local function formspec(pos, meta)
"list[context;src;0,0;3,3;]".. "list[context;src;0,0;3,3;]"..
"item_image[0,0;1,1;default:cobble]".. "item_image[0,0;1,1;default:cobble]"..
"image[3.5,1;1,1;tubelib_gui_arrow.png]".. "image[3.5,1;1,1;tubelib_gui_arrow.png]"..
"image_button[3.5,2;1,1;".. State:get_state_button_image(meta) ..";state_button;]".. "image_button[3.5,2;1,1;".. self:get_state_button_image(meta) ..";state_button;]"..
"list[context;dst;5,0;3,3;]".. "list[context;dst;5,0;3,3;]"..
"item_image[5,0;1,1;default:gravel]".. "item_image[5,0;1,1;default:gravel]"..
"list[current_player;main;0,4;8,4;]".. "list[current_player;main;0,4;8,4;]"..
@ -56,7 +45,17 @@ local function formspec(pos, meta)
"listring[current_player;main]" "listring[current_player;main]"
end end
State:register_formspec_func(formspec) local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:grinder",
node_name_active = "tubelib_addons1:grinder_active",
node_name_defect = "tubelib_addons1:grinder_defect",
infotext_name = "Tubelib Grinder",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 10,
formspec_func = formspec,
})
local function allow_metadata_inventory_put(pos, listname, index, stack, player) local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
@ -132,8 +131,7 @@ minetest.register_node("tubelib_addons1:grinder", {
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "tubelib_addons1:grinder") local number = tubelib.add_node(pos, "tubelib_addons1:grinder")
State:node_init(pos, number) State:node_init(pos, number)
local meta = M(pos) local inv = M(pos):get_inventory()
local inv = meta:get_inventory()
inv:set_size('src', 9) inv:set_size('src', 9)
inv:set_size('dst', 9) inv:set_size('dst', 9)
end, end,

@ -39,6 +39,36 @@ local function working_start_pos(pos)
return working_pos return working_pos
end end
local Radius2Idx = {[4]=1 ,[6]=2, [8]=3, [10]=4, [12]=5, [14]=6, [16]=7}
local function formspec(self, pos, meta)
-- some recalculations
local this = minetest.deserialize(meta:get_string("this"))
local endless = this.endless == 1 and "true" or "false"
local fuel = this.fuel * 100/BURNING_TIME
if self:get_state(meta) ~= tubelib.RUNNING then
fuel = 0
end
local radius = Radius2Idx[this.radius] or 2
return "size[9,8]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"dropdown[0,0;1.5;radius;4,6,8,10,12,14,16;"..radius.."]"..
"label[1.6,0.2;Area radius]"..
"checkbox[0,1;endless;Run endless;"..endless.."]"..
"list[context;main;5,0;4,4;]"..
"list[context;fuel;1.5,3;1,1;]"..
"item_image[1.5,3;1,1;tubelib_addons1:biofuel]"..
"image[2.5,3;1,1;default_furnace_fire_bg.png^[lowpart:"..
fuel..":default_furnace_fire_fg.png]"..
"image_button[3.5,3;1,1;".. self:get_state_button_image(meta) ..";state_button;]"..
"list[current_player;main;0.5,4.3;8,4;]"..
"listring[context;main]"..
"listring[current_player;main]"
end
local State = tubelib.NodeStates:new({ local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:harvester_base", node_name_passive = "tubelib_addons1:harvester_base",
node_name_defect = "tubelib_addons1:harvester_defect", node_name_defect = "tubelib_addons1:harvester_defect",
@ -53,10 +83,9 @@ local State = tubelib.NodeStates:new({
this.working_pos = working_start_pos(pos) this.working_pos = working_start_pos(pos)
meta:set_string("this", minetest.serialize(this)) meta:set_string("this", minetest.serialize(this))
end, end,
formspec_func = formspec,
}) })
local Radius2Idx = {[4]=1 ,[6]=2, [8]=3, [10]=4, [12]=5, [14]=6, [16]=7}
local function gen_working_steps() local function gen_working_steps()
-- Working steps like a snail shell from inner to outer -- Working steps like a snail shell from inner to outer
local t = {} local t = {}
@ -81,36 +110,6 @@ end
local WorkingSteps = gen_working_steps() local WorkingSteps = gen_working_steps()
local function formspec(pos, meta)
-- some recalculations
local this = minetest.deserialize(meta:get_string("this"))
local endless = this.endless == 1 and "true" or "false"
local fuel = this.fuel * 100/BURNING_TIME
if State:get_state(meta) ~= tubelib.RUNNING then
fuel = 0
end
local radius = Radius2Idx[this.radius] or 2
return "size[9,8]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"dropdown[0,0;1.5;radius;4,6,8,10,12,14,16;"..radius.."]"..
"label[1.6,0.2;Area radius]"..
"checkbox[0,1;endless;Run endless;"..endless.."]"..
"list[context;main;5,0;4,4;]"..
"list[context;fuel;1.5,3;1,1;]"..
"item_image[1.5,3;1,1;tubelib_addons1:biofuel]"..
"image[2.5,3;1,1;default_furnace_fire_bg.png^[lowpart:"..
fuel..":default_furnace_fire_fg.png]"..
"image_button[3.5,3;1,1;".. State:get_state_button_image(meta) ..";state_button;]"..
"list[current_player;main;0.5,4.3;8,4;]"..
"listring[context;main]"..
"listring[current_player;main]"
end
State:register_formspec_func(formspec)
local function allow_metadata_inventory_put(pos, listname, index, stack, player) local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0

@ -21,18 +21,7 @@ local STANDBY_TICKS = 4
local COUNTDOWN_TICKS = 2 local COUNTDOWN_TICKS = 2
local CYCLE_TIME = 8 local CYCLE_TIME = 8
local State = tubelib.NodeStates:new({ local function formspec(self, pos, meta)
node_name_passive = "tubelib_addons1:liquidsampler",
node_name_active = "tubelib_addons1:liquidsampler_active",
node_name_defect = "tubelib_addons1:liquidsampler_defect",
infotext_name = "Liquid Sampler",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 8,
})
local function formspec(pos, meta)
return "size[9,8.5]".. return "size[9,8.5]"..
default.gui_bg.. default.gui_bg..
default.gui_bg_img.. default.gui_bg_img..
@ -40,7 +29,7 @@ local function formspec(pos, meta)
"list[context;src;0,0;1,4;]".. "list[context;src;0,0;1,4;]"..
"image[0,0;1,1;bucket.png]".. "image[0,0;1,1;bucket.png]"..
"image[1,1;1,1;tubelib_gui_arrow.png]".. "image[1,1;1,1;tubelib_gui_arrow.png]"..
"image_button[1,3;1,1;".. State:get_state_button_image(meta) ..";state_button;]".. "image_button[1,3;1,1;".. self:get_state_button_image(meta) ..";state_button;]"..
"list[context;dst;2,0;7,4;]".. "list[context;dst;2,0;7,4;]"..
"list[current_player;main;0.5,4.5;8,4;]".. "list[current_player;main;0.5,4.5;8,4;]"..
"listring[current_player;main]".. "listring[current_player;main]"..
@ -50,7 +39,17 @@ local function formspec(pos, meta)
"listring[current_player;main]" "listring[current_player;main]"
end end
State:register_formspec_func(formspec) local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:liquidsampler",
node_name_active = "tubelib_addons1:liquidsampler_active",
node_name_defect = "tubelib_addons1:liquidsampler_defect",
infotext_name = "Liquid Sampler",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 8,
formspec_func = formspec,
})
local function get_pos(pos, facedir, side) local function get_pos(pos, facedir, side)
local offs = {F=0, R=1, B=2, L=3, D=4, U=5} local offs = {F=0, R=1, B=2, L=3, D=4, U=5}

@ -35,31 +35,14 @@ local Depth2Idx = {[1]=1 ,[2]=2, [3]=3, [5]=4, [10]=5, [15]=6, [20]=7, [25]=8, [
local Level2Idx = {[2]=1, [1]=2, [0]=3, [-1]=4, [-2]=5, [-3]=6, local Level2Idx = {[2]=1, [1]=2, [0]=3, [-1]=4, [-2]=5, [-3]=6,
[-5]=7, [-10]=8, [-15]=9, [-20]=10} [-5]=7, [-10]=8, [-15]=9, [-20]=10}
local State = tubelib.NodeStates:new({ local function formspec(self, pos, meta)
node_name_passive = "tubelib_addons1:quarry",
node_name_active = "tubelib_addons1:quarry_active",
node_name_defect = "tubelib_addons1:quarry_defect",
infotext_name = "Tubelib Quarry",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 12,
on_stop = function(pos, meta, oldstate)
if oldstate == tubelib.RUNNING then
meta:set_int("idx", 1) -- restart from the beginning
meta:set_string("quarry_pos", nil)
end
end,
})
local function formspec(pos, meta)
local depth = meta:get_int("max_levels") or 1 local depth = meta:get_int("max_levels") or 1
local start_level = meta:get_int("start_level") or 1 local start_level = meta:get_int("start_level") or 1
local endless = meta:get_int("endless") or 0 local endless = meta:get_int("endless") or 0
local fuel = meta:get_int("fuel") or 0 local fuel = meta:get_int("fuel") or 0
-- some recalculations -- some recalculations
endless = endless == 1 and "true" or "false" endless = endless == 1 and "true" or "false"
if State:get_state(meta) ~= tubelib.RUNNING then if self:get_state(meta) ~= tubelib.RUNNING then
fuel = fuel * 100/BURNING_TIME fuel = fuel * 100/BURNING_TIME
else else
fuel = 0 fuel = 0
@ -79,13 +62,29 @@ local function formspec(pos, meta)
"item_image[1.5,3;1,1;tubelib_addons1:biofuel]".. "item_image[1.5,3;1,1;tubelib_addons1:biofuel]"..
"image[2.5,3;1,1;default_furnace_fire_bg.png^[lowpart:".. "image[2.5,3;1,1;default_furnace_fire_bg.png^[lowpart:"..
fuel..":default_furnace_fire_fg.png]".. fuel..":default_furnace_fire_fg.png]"..
"image_button[3.5,3;1,1;".. State:get_state_button_image(meta) ..";state_button;]".. "image_button[3.5,3;1,1;".. self:get_state_button_image(meta) ..";state_button;]"..
"list[current_player;main;0.5,4.3;8,4;]".. "list[current_player;main;0.5,4.3;8,4;]"..
"listring[context;main]".. "listring[context;main]"..
"listring[current_player;main]" "listring[current_player;main]"
end end
State:register_formspec_func(formspec) local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:quarry",
node_name_active = "tubelib_addons1:quarry_active",
node_name_defect = "tubelib_addons1:quarry_defect",
infotext_name = "Tubelib Quarry",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 12,
on_stop = function(pos, meta, oldstate)
if oldstate == tubelib.RUNNING then
meta:set_int("idx", 1) -- restart from the beginning
meta:set_string("quarry_pos", nil)
end
end,
formspec_func = formspec,
})
local function get_pos(pos, facedir, side, steps) local function get_pos(pos, facedir, side, steps)
facedir = (facedir + Side2Facedir[side]) % 4 facedir = (facedir + Side2Facedir[side]) % 4

@ -24,17 +24,7 @@ local STANDBY_TICKS = 4
local COUNTDOWN_TICKS = 4 local COUNTDOWN_TICKS = 4
local CYCLE_TIME = 2 local CYCLE_TIME = 2
local State = tubelib.NodeStates:new({ local function formspec(self, pos, meta)
node_name_passive = "tubelib_addons1:reformer",
node_name_defect = "tubelib_addons1:reformer_defect",
infotext_name = "Tubelib Reformer",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 10,
})
local function formspec(pos, meta)
return "size[8,8]".. return "size[8,8]"..
default.gui_bg.. default.gui_bg..
default.gui_bg_img.. default.gui_bg_img..
@ -42,7 +32,7 @@ local function formspec(pos, meta)
"list[context;src;0,0;3,3;]".. "list[context;src;0,0;3,3;]"..
"item_image[0,0;1,1;tubelib_addons1:biogas]".. "item_image[0,0;1,1;tubelib_addons1:biogas]"..
"image[3.5,1;1,1;tubelib_gui_arrow.png]".. "image[3.5,1;1,1;tubelib_gui_arrow.png]"..
"image_button[3.5,3;1,1;".. State:get_state_button_image(meta) ..";state_button;]".. "image_button[3.5,3;1,1;".. self:get_state_button_image(meta) ..";state_button;]"..
"list[context;dst;5,0;3,3;]".. "list[context;dst;5,0;3,3;]"..
"item_image[5,0;1,1;tubelib_addons1:biofuel]".. "item_image[5,0;1,1;tubelib_addons1:biofuel]"..
"list[current_player;main;0,4.3;8,4;]".. "list[current_player;main;0,4.3;8,4;]"..
@ -52,7 +42,16 @@ local function formspec(pos, meta)
"listring[current_player;main]" "listring[current_player;main]"
end end
State:register_formspec_func(formspec) local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:reformer",
node_name_defect = "tubelib_addons1:reformer_defect",
infotext_name = "Tubelib Reformer",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
aging_factor = 10,
formspec_func = formspec,
})
local function allow_metadata_inventory_put(pos, listname, index, stack, player) local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then

@ -25,17 +25,7 @@ local COUNTDOWN_TICKS = 6
local STANDBY_TICKS = 4 local STANDBY_TICKS = 4
local CYCLE_TIME = 2 local CYCLE_TIME = 2
local State = tubelib.NodeStates:new({ local function formspec(self, pos, meta)
node_name_passive = "tubelib_addons3:distributor",
node_name_active = "tubelib_addons3:distributor_active",
node_name_defect = "tubelib_addons3:distributor_defect",
infotext_name = "HighPerf Distributor",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
aging_factor = 50,
})
local function formspec(pos, meta)
local filter = minetest.deserialize(meta:get_string("filter")) local filter = minetest.deserialize(meta:get_string("filter"))
return "size[10.5,8.5]".. return "size[10.5,8.5]"..
default.gui_bg.. default.gui_bg..
@ -43,7 +33,7 @@ local function formspec(pos, meta)
default.gui_slots.. default.gui_slots..
"list[context;src;0,0;2,4;]".. "list[context;src;0,0;2,4;]"..
"image[2,1.5;1,1;tubelib_gui_arrow.png]".. "image[2,1.5;1,1;tubelib_gui_arrow.png]"..
"image_button[2,3;1,1;"..State:get_state_button_image(meta)..";state_button;]".. "image_button[2,3;1,1;"..self:get_state_button_image(meta)..";state_button;]"..
"checkbox[3,0;filter1;On;"..dump(filter[1]).."]".. "checkbox[3,0;filter1;On;"..dump(filter[1]).."]"..
"checkbox[3,1;filter2;On;"..dump(filter[2]).."]".. "checkbox[3,1;filter2;On;"..dump(filter[2]).."]"..
"checkbox[3,2;filter3;On;"..dump(filter[3]).."]".. "checkbox[3,2;filter3;On;"..dump(filter[3]).."]"..
@ -61,7 +51,16 @@ local function formspec(pos, meta)
"listring[current_player;main]" "listring[current_player;main]"
end end
State:register_formspec_func(formspec) local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons3:distributor",
node_name_active = "tubelib_addons3:distributor_active",
node_name_defect = "tubelib_addons3:distributor_defect",
infotext_name = "HighPerf Distributor",
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
aging_factor = 50,
formspec_func = formspec,
})
-- Return the total number of list entries -- Return the total number of list entries
local function invlist_num_entries(list) local function invlist_num_entries(list)

@ -239,7 +239,7 @@ minetest.register_node("tubelib_addons3:pushing_chest_defect", {
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2}, groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })

@ -1,2 +0,0 @@
name=tubelib_stairway