add support for Unified Inventory categories

This commit is contained in:
Vanessa Dannenberg 2021-04-02 15:48:28 -04:00
parent a6e4f2dceb
commit fc6efb450c
12 changed files with 41 additions and 2 deletions

@ -423,6 +423,7 @@ minetest.register_node("pipeworks:autocrafter", {
},
},
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:autocrafter"
minetest.register_craft( {
output = "pipeworks:autocrafter 2",

@ -28,6 +28,7 @@ minetest.register_node("pipeworks:steel_block_embedded_tube", {
after_dig_node = pipeworks.after_dig,
on_rotate = pipeworks.on_rotate,
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:steel_block_embedded_tube"
minetest.register_craft( {
output = "pipeworks:steel_block_embedded_tube 1",
@ -81,6 +82,7 @@ minetest.register_node("pipeworks:steel_pane_embedded_tube", {
after_dig_node = pipeworks.after_dig,
on_rotate = pipeworks.on_rotate,
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:steel_pane_embedded_tube"
minetest.register_craft( {
output = "pipeworks:steel_pane_embedded_tube 1",

@ -222,6 +222,8 @@ for s in ipairs(states) do
new_flow_logic_register.directional_horizonal_rotate(nodename_valve_empty, true)
end
end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:pump_off"
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:valve_off_empty"
local nodename_valve_loaded = "pipeworks:valve_on_loaded"
minetest.register_node(nodename_valve_loaded, {
@ -301,6 +303,7 @@ minetest.register_node("pipeworks:grating", {
end,
on_rotate = false
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:grating"
-- outlet spigot
@ -378,6 +381,8 @@ minetest.register_node(nodename_spigot_loaded, {
drop = "pipeworks:spigot",
on_rotate = pipeworks.fix_after_rotation
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:spigot"
-- new flow logic does not currently distinguish between these two visual states.
-- register both so existing flowing spigots continue to work (even if the visual doesn't match the spigot's behaviour).
new_flow_logic_register.directional_horizonal_rotate(nodename_spigot_empty, false)
@ -441,6 +446,9 @@ minetest.register_node(nodename_panel_loaded, {
drop = "pipeworks:entry_panel_empty",
on_rotate = pipeworks.fix_after_rotation
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:entry_panel_empty"
-- TODO: AFAIK the two panels have no visual difference, so are redundant under new flow logic - alias?
new_flow_logic_register.directional_horizonal_rotate(nodename_panel_empty, true)
new_flow_logic_register.directional_horizonal_rotate(nodename_panel_loaded, true)
@ -525,6 +533,8 @@ minetest.register_node(nodename_sensor_loaded, {
mesecons = pipereceptor_on,
on_rotate = pipeworks.fix_after_rotation
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:flow_sensor_empty"
new_flow_logic_register.directional_horizonal_rotate(nodename_sensor_empty, true)
new_flow_logic_register.directional_horizonal_rotate(nodename_sensor_loaded, true)
-- activate flow sensor at roughly half the pressure pumps drive pipes
@ -603,6 +613,7 @@ for fill = 0, 10 do
on_rotate = false
})
end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:storage_tank_0"
-- fountainhead
@ -639,6 +650,7 @@ minetest.register_node(nodename_fountain_empty, {
},
on_rotate = false
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:fountainhead"
local nodename_fountain_loaded = "pipeworks:fountainhead_pouring"
minetest.register_node(nodename_fountain_loaded, {
@ -734,6 +746,7 @@ minetest.register_node(nodename_sp_loaded, {
check_for_pole = pipeworks.check_for_vert_pipe,
check_for_horiz_pole = pipeworks.check_for_horiz_pipe
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:straight_pipe_empty"
new_flow_logic_register.directional_horizonal_rotate(nodename_sp_empty, true)
new_flow_logic_register.directional_horizonal_rotate(nodename_sp_loaded, true)

@ -472,6 +472,7 @@ for _, data in ipairs({
minetest.register_node("pipeworks:"..data.name, node)
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:"..data.name
end
minetest.register_craft( {

@ -5,6 +5,7 @@
--
pipeworks = {}
pipeworks.ui_cat_tube_list = {}
pipeworks.worldpath = minetest.get_worldpath()
pipeworks.modpath = minetest.get_modpath("pipeworks")
@ -148,4 +149,16 @@ end
minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
-- Unified Inventory categories integration
if unified_inventory and unified_inventory.registered_categories then
if not unified_inventory.registered_categories["automation"] then
unified_inventory.register_category("automation", {
symbol = "pipeworks:lua_tube000000",
label = "Automation components"
})
end
unified_inventory.add_category_items("automation", pipeworks.ui_cat_tube_list)
end
minetest.log("info", "Pipeworks loaded!")

@ -981,6 +981,8 @@ end
end
end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = BASENAME.."000000"
------------------------------------
-- Overheated Lua controlled Tube --
------------------------------------

@ -1,5 +1,5 @@
name = pipeworks
description = This mod uses mesh nodes and nodeboxes to supply a complete set of 3D pipes and tubes, along with devices that work with them.
depends = default, basic_materials, screwdriver
optional_depends = mesecons, mesecons_mvps, digilines, signs_lib
optional_depends = mesecons, mesecons_mvps, digilines, signs_lib, unified_inventory
min_minetest_version = 5.2.0

@ -133,7 +133,7 @@ for index, connects in ipairs(cconnects) do
new_flow_logic_register.simple(emptypipe)
new_flow_logic_register.simple(fullpipe)
end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:pipe_1_empty"
if REGISTER_COMPATIBILITY then

@ -193,6 +193,7 @@ if pipeworks.enable_one_way_tube then
check_for_pole = pipeworks.check_for_vert_tube,
check_for_horiz_pole = pipeworks.check_for_horiz_tube
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:one_way_tube"
minetest.register_craft({
output = "pipeworks:one_way_tube 2",
recipe = {

@ -40,6 +40,7 @@ minetest.register_node("pipeworks:trashcan", {
minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack(""))
end,
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:trashcan"
minetest.register_craft({
output = "pipeworks:trashcan",

@ -200,6 +200,7 @@ local register_all_tubes = function(name, desc, plain, noctrs, ends, short, inv,
end
end
end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = name.."_000000"
else
-- 6d tubes: uses only 10 nodes instead of 64, but the textures must be rotated
local cconnects = {{}, {1}, {1, 2}, {1, 3}, {1, 3, 5}, {1, 2, 3}, {1, 2, 3, 5}, {1, 2, 3, 4}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5, 6}}
@ -222,6 +223,7 @@ local register_all_tubes = function(name, desc, plain, noctrs, ends, short, inv,
tube = {connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1}},
drop = name.."_1",
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = name.."_1"
table.insert(tubenodes, cname)
for xm = 0, 1 do
for xp = 0, 1 do

@ -371,6 +371,7 @@ if pipeworks.enable_node_breaker then
eject_drops = true,
}
register_wielder(data)
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:nodebreaker_off"
minetest.register_craft({
output = "pipeworks:nodebreaker_off",
recipe = {
@ -422,6 +423,7 @@ if pipeworks.enable_deployer then
end,
eject_drops = false,
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:deployer_off"
minetest.register_craft({
output = "pipeworks:deployer_off",
recipe = {
@ -457,6 +459,7 @@ if pipeworks.enable_dispenser then
end,
eject_drops = false,
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:dispenser_off"
minetest.register_craft({
output = "pipeworks:dispenser_off",
recipe = {