Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1701671
trashcan voids water
The4codeblocks Apr 25, 2025
5ba89d0
trashcan updates pipes
The4codeblocks Apr 25, 2025
392677f
trash can needs pipe logic now
The4codeblocks Apr 25, 2025
52aca25
offsets
The4codeblocks Apr 25, 2025
5a543ce
pressure default
The4codeblocks Apr 25, 2025
54c40b6
creative water source
The4codeblocks Apr 25, 2025
f7dbcbe
fluid crafts
The4codeblocks Apr 25, 2025
2e2a63a
autocrafter with fluids
The4codeblocks Apr 25, 2025
0fab0c2
Add files via upload
The4codeblocks Apr 25, 2025
8d5d92d
fluid crafts without core
The4codeblocks Apr 26, 2025
02bb507
update crafts
The4codeblocks Apr 26, 2025
4348a21
fix offsets
The4codeblocks Apr 26, 2025
8961f1a
flow sensor info
The4codeblocks Apr 26, 2025
976c971
don't global
The4codeblocks Apr 26, 2025
a4f1a35
stuff
The4codeblocks Apr 26, 2025
ff5015d
add lava and defs
The4codeblocks Apr 26, 2025
c023b39
Update autocrafter.lua
The4codeblocks Apr 26, 2025
1e70b48
remove unnecessary registration
The4codeblocks Apr 26, 2025
4a8bf02
Add files via upload
The4codeblocks Apr 26, 2025
fadcae3
recipes
The4codeblocks Apr 26, 2025
f1e78f0
Update crafts.lua
The4codeblocks Apr 26, 2025
70bf3ef
enforcing load order
The4codeblocks Apr 26, 2025
9407ba3
merge on_place and on_dig (contains leak from wip)
The4codeblocks Apr 28, 2025
0a0bd36
fix luacheck again
The4codeblocks Apr 28, 2025
d72b540
remove space-only lines
The4codeblocks Apr 28, 2025
92e7f29
Update .luacheckrc
The4codeblocks Apr 28, 2025
ba8dc61
generalize flag
The4codeblocks Apr 28, 2025
0302121
Update init.lua
The4codeblocks Apr 28, 2025
a5439f2
actual multifluid support
The4codeblocks Apr 28, 2025
fe984ad
casewise finity
The4codeblocks Apr 28, 2025
5e57cc3
try dehardcoding possibly useless code
The4codeblocks Apr 28, 2025
e221eca
sensor show type
The4codeblocks Apr 28, 2025
fb5aa1f
semantic changes (water → fluid)
The4codeblocks Apr 28, 2025
329bff4
support for existing stuff for multitype
The4codeblocks Apr 28, 2025
35ab87d
a WHOLE lot
The4codeblocks Apr 28, 2025
253e1ef
fix, bad copy
The4codeblocks Apr 28, 2025
5333b2e
fix allowing fluid outs to change stored type for some reason
The4codeblocks Apr 28, 2025
2543866
last commit summary was a bit vague
The4codeblocks Apr 28, 2025
4989f96
Update pressure_logic.txt
The4codeblocks Apr 28, 2025
161f367
did that not fix? hmm
The4codeblocks Apr 28, 2025
bc4a489
oops, forgot to remove that logger
The4codeblocks Apr 29, 2025
c21f4be
oops, forgot to remove that logger
The4codeblocks Apr 29, 2025
8cc9465
multifluid source
The4codeblocks Apr 30, 2025
60fe317
check for definitions 1st
The4codeblocks Apr 30, 2025
0e6ff9e
shut luacheck up
The4codeblocks Apr 30, 2025
4d8c9c3
stop with the manually constructed vector
The4codeblocks May 7, 2025
e2c0d3f
shut luacheck up
The4codeblocks May 7, 2025
22e4522
fix crash
The4codeblocks Jun 16, 2025
42975f7
forgot a paren
The4codeblocks Jun 16, 2025
3c2ea2c
Merge branch 'master' into patch-1
The4codeblocks Aug 14, 2025
2116395
Merge branch 'master' into patch-1
The4codeblocks Dec 29, 2025
fc00172
readability
The4codeblocks Dec 30, 2025
4a6a0f3
xcompat where possible
The4codeblocks Dec 30, 2025
c254776
announce deprecation
The4codeblocks Dec 30, 2025
4890374
reduce loading baggage
The4codeblocks Dec 30, 2025
86cf653
fix styling
The4codeblocks Dec 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
375 changes: 289 additions & 86 deletions autocrafter.lua

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,21 @@ function fs_helpers.cycling_button(meta, base, meta_name, values)
return base..";"..(texture_name and texture_name..";" or "")..field..";"..minetest.formspec_escape(text)..(addopts and ";"..addopts or "").."]"
end

function fs_helpers.get_inv(y)
function fs_helpers.get_inv(y,x)
local x = x or 0
local fs = {}
if minetest.get_modpath("i3") then
local inv_x = i3.settings.legacy_inventory and 0.75 or 0.22
local inv_x = (i3.settings.legacy_inventory and 0.75 or 0.22) + x
local inv_y = (y + 0.4) or 6.9
local size, spacing = 1, 0.1
local hotbar_len = i3.settings.hotbar_len or (i3.settings.legacy_inventory and 8 or 9)
local inv_size = i3.settings.inv_size or (hotbar_len * 4)
local hotbar_width = 4
local inv_size = i3.settings.inv_size or (hotbar_len * hotbar_width)

table.insert(fs, "style_type[box;colors=#77777710,#77777710,#777,#777]")

for i = 0, hotbar_len - 1 do
table.insert(fs, "box["..(i * size + inv_x + (i * spacing))..","..inv_y..";"..size..","..size..";]")
table.insert(fs, "box["..(inv_x + (i * (spacing + size)))..","..inv_y..";"..size..","..size..";]")
end

table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]")
Expand All @@ -232,14 +234,14 @@ function fs_helpers.get_inv(y)
table.insert(fs, "style_type[box;colors=#666]")
for i=0, 2 do
for j=0, hotbar_len - 1 do
table.insert(fs, "box["..0.2+(j*0.1)+(j*size)..","..(inv_y+size+spacing+0.05)+(i*0.1)+(i*size)..";"..size..","..size..";]")
table.insert(fs, "box["..inv_x+(j*(spacing+size))..","..(inv_y+size+spacing+0.05)+(i*(spacing+size))..";"..size..","..size..";]")
end
end

table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]")
table.insert(fs, "list[current_player;main;"..inv_x..","..(inv_y + 1.15)..";"..hotbar_len..","..(inv_size / hotbar_len)..";"..hotbar_len.."]")
table.insert(fs, "list[current_player;main;"..inv_x..","..(inv_y + 1.15)..";"..hotbar_len..","..hotbar_width..";"..hotbar_len.."]")
elseif minetest.get_modpath("mcl_formspec") then
local inv_x = 0.22
local inv_x = 0.22 + x
local inv_y = (y + 0.4) or 6.9
local size, spacing = 1, 0.1
local hotbar_len = 9
Expand All @@ -248,7 +250,7 @@ function fs_helpers.get_inv(y)
table.insert(fs, "style_type[box;colors=#77777710,#77777710,#777,#777]")

for i = 0, hotbar_len - 1 do
table.insert(fs, "box["..(i * size + inv_x + (i * spacing))..","..inv_y..";"..size..","..size..";]")
table.insert(fs, "box["..(inv_x + (i * (spacing + size)))..","..inv_y..";"..size..","..size..";]")
end

table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]")
Expand All @@ -257,14 +259,14 @@ function fs_helpers.get_inv(y)
table.insert(fs, "style_type[box;colors=#666]")
for i=0, 2 do
for j=0, hotbar_len - 1 do
table.insert(fs, "box["..0.2+(j*0.1)+(j*size)..","..(inv_y+size+spacing+0.05)+(i*0.1)+(i*size)..";"..size..","..size..";]")
table.insert(fs, "box["..inv_x+(j*(spacing+size))..","..(inv_y+size+spacing+0.05)+(i*(spacing+size))..";"..size..","..size..";]")
end
end

table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]")
table.insert(fs, "list[current_player;main;"..inv_x..","..(inv_y + 1.15)..";"..hotbar_len..","..(inv_size / hotbar_len)..";"..hotbar_len.."]")
else
table.insert(fs, "list[current_player;main;0.22,"..y..";8,4;]")
table.insert(fs, "list[current_player;main;".. (0.22 + x) ..","..y..";8,4;]")
end

return table.concat(fs, "")
Expand Down
48 changes: 48 additions & 0 deletions crafts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,51 @@ if pipeworks.enable_node_breaker then
}
})
end

if pipeworks.enable_autocrafter then

local buckets = {}
if core.get_modpath("bucket") then
buckets.air = "bucket:bucket_empty"
buckets.water = "bucket:bucket_water"
buckets.river_water = "bucket:bucket_river_water"
buckets.lava = "bucket:bucket_lava"
elseif core.get_modpath("mcl_buckets") then
buckets.air = "mcl_buckets:bucket_empty"
buckets.water = "mcl_buckets:bucket_water"
buckets.river_water = "mcl_buckets:bucket_river_water"
buckets.lava = "mcl_buckets:bucket_lava"
end
Comment on lines 325 to 331
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should come from xcompat

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be done
(riverwater & lava buckets don't have xcompat entries)


if buckets.air and buckets.water then
local def = {
fluid = {type = "water", amount = 1},
output = ItemStack(buckets.water),
items = {
buckets.air, "", "", "", "", "", "", "", ""
}
}
pipeworks.fluid_recipes:register(def)
end
if buckets.air and buckets.lava then
local def = {
fluid = {type = "lava", amount = 1},
output = ItemStack(buckets.lava),
items = {
buckets.air, "", "", "", "", "", "", "", ""
}
}
pipeworks.fluid_recipes:register(def)
end
if buckets.river_water and buckets.lava then
local def = {
fluid = {type = "river_water", amount = 1},
output = ItemStack(buckets.river_water),
items = {
buckets.air, "", "", "", "", "", "", "", ""
}
}
pipeworks.fluid_recipes:register(def)
end

end
2 changes: 1 addition & 1 deletion default_settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pipeworks.toggles = {}
-- setting to nil inhibits all flow logic, useful for debugging ABM crashes,
-- or for rendering the pipes purely decorative.
]]
pipeworks.toggles.pipe_mode = "classic"
pipeworks.toggles.pipe_mode = "pressure"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does that affect existing worlds?

Copy link
Contributor Author

@The4codeblocks The4codeblocks Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a lot of the things I'm doing (whether they're currently in this PR or not) are going to break things, but the old way things work is likely simple enough to auto-reinstate the original function

--[[
-- force-enable finite water handling mode.
-- this changes the way that water node placement is handled;
Expand Down
37 changes: 36 additions & 1 deletion devices.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,32 @@ local pipes_devicelist = {

-- Now define the nodes.

local sourcename = "pipeworks:source_loaded"
local tile = table.copy(core.registered_nodes[pipeworks.liquids.water.source].tiles[1])
tile.name = tile.name .. "^pipeworks_source_frame.png"
core.register_node(sourcename, {
description = S("Infinite Water Source"),
tiles = { tile },
paramtype = "light",
groups = {snappy=3, pipe=1, dig_generic = 4, axey=1, handy=1, pickaxey=1},
is_ground_content = false,
_mcl_hardness=0.8,
_sound_def = {
key = "node_sound_metal_defaults",
},
walkable = true,
pipe_connections = { top = 1, bottom = 1, front = 1, back = 1, left = 1, right = 1},
after_place_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end
})

new_flow_logic_register.simple(sourcename)
new_flow_logic_register.intake(sourcename, 4, function() return 4 end)

local states = { "on", "off" }

for s in ipairs(states) do
Expand Down Expand Up @@ -579,7 +605,16 @@ new_flow_logic_register.directional_horizonal_rotate(nodename_sensor_loaded, tru
-- activate flow sensor at roughly half the pressure pumps drive pipes
local sensor_pressure_set = { { nodename_sensor_empty, 0.0 }, { nodename_sensor_loaded, 1.0 } }
new_flow_logic_register.transition_simple_set(sensor_pressure_set, { mesecons=pipeworks.mesecons_rules })

core.register_abm({
label = "flow sensor info",
nodenames = { "pipeworks:flow_sensor_empty", "pipeworks:flow_sensor_loaded" },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = core.get_meta(pos)
meta:set_string("infotext", S("Pressure: @1", meta:get("pipeworks.water_pressure")))
end
})


-- tanks
Expand Down
28 changes: 18 additions & 10 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ pipeworks = {
modpath = minetest.get_modpath("pipeworks"),
liquids = {
water = {
def = core.registered_nodes["mapgen_water_source"],
source = minetest.registered_nodes["mapgen_water_source"].name,
flowing = minetest.registered_nodes["mapgen_water_source"].liquid_alternative_flowing
},
river_water = {
def = core.registered_nodes["mapgen_river_water_source"],
source = minetest.registered_nodes["mapgen_river_water_source"].name,
flowing = minetest.registered_nodes["mapgen_river_water_source"].liquid_alternative_flowing
},
lava = {
def = core.registered_nodes["mapgen_lava_source"],
source = core.registered_nodes["mapgen_lava_source"].name,
flowing = core.registered_nodes["mapgen_lava_source"].liquid_alternative_flowing
}
}
}
Expand Down Expand Up @@ -51,6 +58,17 @@ if minetest.get_modpath("signs_lib") then
dofile(pipeworks.modpath.."/signs_compat.lua")
end

local logicdir = "/pressure_logic/"

-- note that even with these files the new flow logic is not yet default.
-- registration will take place but no actual ABMs/node logic will be installed,
-- unless the toggle flag is specifically enabled in the per-world settings flag.
-- -- disregard previous comments, new flow logic is default now
dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua")
dofile(pipeworks.modpath..logicdir.."abms.lua")
dofile(pipeworks.modpath..logicdir.."abm_register.lua")
dofile(pipeworks.modpath..logicdir.."flowable_node_registry_install.lua")

dofile(pipeworks.modpath.."/common.lua")
dofile(pipeworks.modpath.."/models.lua")
dofile(pipeworks.modpath.."/autoplace_pipes.lua")
Expand Down Expand Up @@ -80,16 +98,6 @@ if pipeworks.enable_sand_tube or pipeworks.enable_mese_sand_tube then
dofile(pipeworks.modpath.."/tubes/vacuum.lua")
end

local logicdir = "/pressure_logic/"

-- note that even with these files the new flow logic is not yet default.
-- registration will take place but no actual ABMs/node logic will be installed,
-- unless the toggle flag is specifically enabled in the per-world settings flag.
dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua")
dofile(pipeworks.modpath..logicdir.."abms.lua")
dofile(pipeworks.modpath..logicdir.."abm_register.lua")
dofile(pipeworks.modpath..logicdir.."flowable_node_registry_install.lua")

if pipeworks.enable_pipes then
dofile(pipeworks.modpath.."/pipes.lua")
end
Expand Down
2 changes: 1 addition & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -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 = basic_materials, xcompat, fakelib
optional_depends = mesecons, mesecons_mvps, digilines, signs_lib, unified_inventory, default, screwdriver, fl_mapgen, sound_api, i3, hades_core, hades_furnaces, hades_chests, mcl_mapgen_core, mcl_barrels, mcl_furnaces, mcl_experience, vizlib
optional_depends = mesecons, mesecons_mvps, digilines, signs_lib, unified_inventory, default, screwdriver, fl_mapgen, sound_api, i3, hades_core, hades_furnaces, hades_chests, mcl_mapgen_core, mcl_barrels, mcl_furnaces, mcl_experience, vizlib, bucket, mcl_buckets
min_minetest_version = 5.5.0
Binary file added textures/pipeworks_fluid_lava.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added textures/pipeworks_fluid_river_water.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added textures/pipeworks_fluid_water.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added textures/pipeworks_fluidbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added textures/pipeworks_source_frame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added textures/text_div1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added textures/text_req.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions trashcan.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local S = minetest.get_translator("pipeworks")
minetest.register_node("pipeworks:trashcan", {
local voidname = "pipeworks:trashcan"
minetest.register_node(voidname, {
description = S("Trash Can"),
drawtype = "normal",
tiles = {
Expand All @@ -20,6 +21,7 @@ minetest.register_node("pipeworks:trashcan", {
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1},
priority = 1, -- Lower than anything else
},
pipe_connections = { top = 1, bottom = 1, front = 1, back = 1, left = 1, right = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local size = "10.2,9"
Expand Down Expand Up @@ -48,5 +50,13 @@ minetest.register_node("pipeworks:trashcan", {
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack(""))
end,
after_place_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
})
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:trashcan"
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = voidname
pipeworks.flowables.register.simple(voidname)
pipeworks.flowables.register.output(voidname, 0, 0, function() return 4 end, function()end)