1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-07-12 21:30:37 +02:00

41 Commits

Author SHA1 Message Date
66070dd801 Merge remote-tracking branch 'upstream/master' 2022-03-06 16:37:56 +01:00
5618003be3 fix remaining use_texture_alpha warnings
extension of d2954c52, using the same compatibility check for now, though it would be good to bump the minimum minetest version to 5.4 at some point

fixes #11
2022-02-07 15:53:29 +11:00
06fd754216 fix pipeworks_enable_items_per_tube_limit setting
fixes #7
2022-01-07 13:42:08 +11:00
SX
794cae675e Expose set_tube on public API (#6)
* Expose set_tube on public API
* Added update_meta to public tptube API
2022-01-02 15:14:14 +01:00
7d3a61e595 Fix toggling of autocrafter when digilines is not installed (#5)
Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com>
2021-12-26 17:12:15 +11:00
a70115ab8d update wiki link 2021-12-13 20:20:47 -05:00
23fe215721 Fix furnace block fuel (#2)
* Fix blocking of fuel inventory by fuel replacement and losing of fuel replacements.
2021-11-29 17:01:16 +01:00
8f067db7cd github luacheck workflow 2021-11-28 16:13:11 +11:00
e082ea473b fix missing argument when calling on_rightclick 2021-11-28 14:40:40 +11:00
7ee74133e1 Merge remote-tracking branch 'upstream/master' 2021-06-20 17:21:30 +02:00
cec6049dd1 Merge branch 'tptube-cache-v2' into 'master'
add caching layer to teleport tube

See merge request VanessaE/pipeworks!46
2021-06-01 17:17:34 +00:00
047718b3c3 add caching layer to teleport tube 2021-06-01 18:57:59 +02:00
01f4ea066c Merge branch 'master' into 'master'
Fix autocrafter to match formspec changes and fix setting of channel

See merge request VanessaE/pipeworks!45
2021-05-29 12:22:42 +00:00
7ba685344c fix autocrafter 2021-05-29 17:37:10 +10:00
c39d40e940 Merge branch 'fix_undeclared' into 'master'
Fix Undeclared Global Variable "unified_inventory"

See merge request VanessaE/pipeworks!44
2021-05-14 04:08:02 +00:00
48b082e014 Fix Undeclared global variable "unified_inventory" 2021-05-13 10:57:58 -07:00
c01bd7b888 Merge remote-tracking branch 'upstream/master' 2021-05-09 21:42:46 +02:00
2670fd88a9 Merge branch 'lua-tube-mono' into 'master'
Make the LUA tube editor textarea and error label use monospaced font

See merge request VanessaE/pipeworks!43
2021-05-06 18:21:59 +00:00
3536004667 Merge branch 'fix-protection-check' into 'master'
Skip protection check on formspec close (where not already done)

See merge request VanessaE/pipeworks!42
2021-05-06 18:21:42 +00:00
b53a1ee477 Make LUA editor and error label use mono font 2021-05-06 18:28:47 +02:00
29bac67d3a Skip protection check on formspec close
Prevents protector flip/player being hurt/protection violation if the
player closes the formspec without attempting any changes (sorting tube
and autocrafter).
2021-05-06 18:02:19 +02:00
e2fdcc4fb2 Merge remote-tracking branch 'upstream/master' 2021-04-08 13:32:05 +02:00
e4db1e885e Merge remote-tracking branch 'upstream/master' 2021-04-04 21:02:57 +02:00
f7839444cd Merge remote-tracking branch 'upstream/master' 2021-03-25 21:57:03 +01:00
93f5fb3d87 Merge remote-tracking branch 'upstream/master' 2021-03-12 12:36:16 +01:00
a535bebd2e Merge remote-tracking branch 'upstream/master' 2021-02-13 14:18:53 +01:00
be2776fc46 Merge remote-tracking branch 'upstream/master' 2021-02-07 13:13:20 +01:00
ee03959a65 Merge remote-tracking branch 'upstream/master' 2020-12-20 15:26:00 +01:00
4dd30df37a Merge remote-tracking branch 'upstream/master' 2020-10-29 22:16:20 +01:00
946da11206 Merge remote-tracking branch 'upstream/master' 2020-10-18 02:13:58 +02:00
77c8026400 Merge remote-tracking branch 'upstream/master' 2020-09-26 11:40:25 +02:00
70b521c721 Merge remote-tracking branch 'upstream/master' 2020-09-11 20:50:17 +02:00
6d795b7d34 Merge remote-tracking branch 'upstream/master' 2020-08-11 20:30:19 +02:00
92249b7941 Merge remote-tracking branch 'upstream/master' 2020-07-31 22:18:16 +02:00
e04fb691ad Merge remote-tracking branch 'upstream/master' 2020-07-19 22:41:58 +02:00
ac80224371 Merge remote-tracking branch 'upstream/master' 2020-07-17 22:41:46 +02:00
34262ed8d5 Merge remote-tracking branch 'upstream/master' into nalc-1.2-dev 2020-06-14 21:11:09 +02:00
5cfe8d893f Merge branch 'master' of yunohost.local:mtcontrib/pipeworks into nalc-1.2-dev 2020-03-25 23:00:57 +01:00
975e20f704 Merge branch 'master' of yunohost.local:mtcontrib/pipeworks into nalc-1.2-dev 2019-12-22 14:33:13 +01:00
2693e2ecbb Merge branch 'master' into nalc-1.2 2019-05-04 19:56:03 +02:00
c93df73a5c Rend les items du groupe limitcraft non craftable par l'autocrafter 2019-03-02 19:29:26 +01:00
12 changed files with 90 additions and 21 deletions

13
.github/workflows/luacheck.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: luacheck
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: apt
run: sudo apt-get install -y luarocks
- name: luacheck install
run: luarocks install --local luacheck
- name: luacheck run
run: $HOME/.luarocks/bin/luacheck ./

View File

@ -1,8 +0,0 @@
stages:
- test
luacheck:
stage: test
image: pipelinecomponents/luacheck:latest
script:
- luacheck .

2
README
View File

@ -1,7 +1,7 @@
This mod uses nodeboxes to supply a complete set of 3D pipes and tubes, This mod uses nodeboxes to supply a complete set of 3D pipes and tubes,
along devices that work with them. along devices that work with them.
See https://gitlab.com/VanessaE/pipeworks/wikis/ for detailed information about usage of this mod. See https://github.com/mt-mods/pipeworks/wiki/ for detailed information about usage of this mod.
Unlike the previous version of this mod, these pipes are rounded, and when Unlike the previous version of this mod, these pipes are rounded, and when
placed, they'll automatically join together as needed. Pipes can go vertically placed, they'll automatically join together as needed. Pipes can go vertically

View File

@ -67,8 +67,11 @@ local function run_autocrafter(pos, elapsed)
local inventory = meta:get_inventory() local inventory = meta:get_inventory()
local craft = get_craft(pos, inventory) local craft = get_craft(pos, inventory)
local output_item = craft.output.item local output_item = craft.output.item
-- NALC: existence de limitgroup ?
local limitcraft = minetest.get_item_group(output_item:get_name(), "limitcraft") or 0
-- only use crafts that have an actual result -- only use crafts that have an actual result
if output_item:is_empty() then -- NALC: ou si l'item n'est pas dans le group limitcraft
if output_item:is_empty() or limitcraft > 0 then
meta:set_string("infotext", S("unconfigured Autocrafter: unknown recipe")) meta:set_string("infotext", S("unconfigured Autocrafter: unknown recipe"))
return false return false
end end
@ -190,8 +193,9 @@ local function update_meta(meta, enabled)
"listring[context;dst]" .. "listring[context;dst]" ..
"listring[current_player;main]" "listring[current_player;main]"
if minetest.get_modpath("digilines") then if minetest.get_modpath("digilines") then
fs = fs.."field[1,3.5;4,1;channel;"..S("Channel")..";${channel}]" fs = fs.."field[0.3,3.5;4.5,1;channel;"..S("Channel")..";${channel}]"..
fs = fs.."button_exit[5,3.2;2,1;save;"..S("Save").."]" "button[4.5,3.2;1.5,1;set_channel;"..S("Set").."]"..
"button_exit[6,3.2;2,1;close;"..S("Close").."]"
end end
meta:set_string("formspec",fs) meta:set_string("formspec",fs)
@ -276,7 +280,9 @@ minetest.register_node("pipeworks:autocrafter", {
update_meta(meta, false) update_meta(meta, false)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if not pipeworks.may_configure(pos, sender) then return end if (fields.quit and not fields.key_enter_field) or not pipeworks.may_configure(pos, sender) then
return
end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if fields.on then if fields.on then
update_meta(meta, false) update_meta(meta, false)
@ -285,8 +291,9 @@ minetest.register_node("pipeworks:autocrafter", {
if update_meta(meta, true) then if update_meta(meta, true) then
start_crafter(pos) start_crafter(pos)
end end
elseif fields.save then end
meta:set_string("channel",fields.channel) if fields.channel then
meta:set_string("channel", fields.channel)
end end
end, end,
can_dig = function(pos, player) can_dig = function(pos, player)

View File

@ -189,8 +189,25 @@ local function furnace_node_timer(pos, elapsed)
fuel_totaltime = 0 fuel_totaltime = 0
src_time = 0 src_time = 0
else else
-- Take fuel from fuel list -- prevent blocking of fuel inventory (for automatization mods)
inv:set_stack("fuel", 1, afterfuel.items[1]) local is_fuel = minetest.get_craft_result({method = "fuel", width = 1, items = {afterfuel.items[1]:to_string()}})
if is_fuel.time == 0 then
table.insert(fuel.replacements, afterfuel.items[1])
inv:set_stack("fuel", 1, "")
else
-- Take fuel from fuel list
inv:set_stack("fuel", 1, afterfuel.items[1])
end
-- Put replacements in dst list or drop them on the furnace.
local replacements = fuel.replacements
if replacements[1] then
local leftover = inv:add_item("dst", replacements[1])
if not leftover:is_empty() then
local above = vector.new(pos.x, pos.y + 1, pos.z)
local drop_pos = minetest.find_node_near(above, 1, {"air"}) or above
minetest.item_drop(replacements[1], nil, drop_pos)
end
end
update = true update = true
fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime)
src_time = src_time + elapsed src_time = src_time + elapsed

View File

@ -1,6 +1,8 @@
local S = minetest.get_translator("pipeworks") local S = minetest.get_translator("pipeworks")
local new_flow_logic_register = pipeworks.flowables.register local new_flow_logic_register = pipeworks.flowables.register
local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes
local polys = "" local polys = ""
if pipeworks.enable_lowpoly then polys = "_lowpoly" end if pipeworks.enable_lowpoly then polys = "_lowpoly" end
@ -28,7 +30,9 @@ function pipeworks.rotate_on_place(itemstack, placer, pointed_thing)
if (not placer:get_player_control().sneak) if (not placer:get_player_control().sneak)
and minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name]
and minetest.registered_nodes[node.name].on_rightclick then and minetest.registered_nodes[node.name].on_rightclick then
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under,
node, placer, itemstack, pointed_thing)
else else
local pitch = placer:get_look_pitch() local pitch = placer:get_look_pitch()
@ -140,6 +144,7 @@ for s in ipairs(states) do
drawtype = "mesh", drawtype = "mesh",
mesh = "pipeworks_pump"..polys..".obj", mesh = "pipeworks_pump"..polys..".obj",
tiles = { "pipeworks_pump_"..states[s]..".png" }, tiles = { "pipeworks_pump_"..states[s]..".png" },
use_texture_alpha = texture_alpha_mode and "clip" or true,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = dgroups, groups = dgroups,
@ -284,6 +289,7 @@ minetest.register_node("pipeworks:grating", {
"pipeworks_grating_sides.png", "pipeworks_grating_sides.png",
"pipeworks_grating_sides.png" "pipeworks_grating_sides.png"
}, },
use_texture_alpha = texture_alpha_mode and "clip" or true,
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -355,6 +361,7 @@ minetest.register_node(nodename_spigot_loaded, {
}, },
{ name = "pipeworks_spigot.png" } { name = "pipeworks_spigot.png" }
}, },
use_texture_alpha = texture_alpha_mode and "blend" or true,
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",

View File

@ -151,7 +151,7 @@ minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
-- Unified Inventory categories integration -- Unified Inventory categories integration
if unified_inventory and unified_inventory.registered_categories then if minetest.global_exists("unified_inventory") and unified_inventory.registered_categories then
if not unified_inventory.registered_categories["automation"] then if not unified_inventory.registered_categories["automation"] then
unified_inventory.register_category("automation", { unified_inventory.register_category("automation", {
symbol = "pipeworks:lua_tube000000", symbol = "pipeworks:lua_tube000000",

View File

@ -1,5 +1,5 @@
local luaentity = pipeworks.luaentity local luaentity = pipeworks.luaentity
local enable_max_limit = minetest.settings:get("pipeworks_enable_items_per_tube_limit") local enable_max_limit = minetest.settings:get_bool("pipeworks_enable_items_per_tube_limit")
local max_tube_limit = tonumber(minetest.settings:get("pipeworks_max_items_per_tube")) or 30 local max_tube_limit = tonumber(minetest.settings:get("pipeworks_max_items_per_tube")) or 30
if enable_max_limit == nil then enable_max_limit = true end if enable_max_limit == nil then enable_max_limit = true end

View File

@ -666,6 +666,7 @@ local function reset_formspec(meta, code, errmsg)
code = minetest.formspec_escape(code or "") code = minetest.formspec_escape(code or "")
errmsg = minetest.formspec_escape(tostring(errmsg or "")) errmsg = minetest.formspec_escape(tostring(errmsg or ""))
meta:set_string("formspec", "size[12,10]" meta:set_string("formspec", "size[12,10]"
.."style_type[label,textarea;font=mono]"
.."background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]" .."background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]"
.."label[0.1,8.3;"..errmsg.."]" .."label[0.1,8.3;"..errmsg.."]"
.."textarea[0.2,0.2;12.2,9.5;code;;"..code.."]" .."textarea[0.2,0.2;12.2,9.5;code;;"..code.."]"

View File

@ -163,11 +163,15 @@ if pipeworks.enable_crossing_tube then
}) })
end end
local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes
and "clip" or true
if pipeworks.enable_one_way_tube then if pipeworks.enable_one_way_tube then
minetest.register_node("pipeworks:one_way_tube", { minetest.register_node("pipeworks:one_way_tube", {
description = S("One way tube"), description = S("One way tube"),
tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png", tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png",
"pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"}, "pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"},
use_texture_alpha = texture_alpha_mode,
paramtype2 = "facedir", paramtype2 = "facedir",
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",

View File

@ -110,9 +110,22 @@ if pipeworks.enable_mese_tube then
update_formspec(pos) update_formspec(pos)
meta:set_string("infotext", S("Sorting pneumatic tube")) meta:set_string("infotext", S("Sorting pneumatic tube"))
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and placer:is_player() and placer:get_player_control().aux1 then
local meta = minetest.get_meta(pos)
for i = 1, 6 do
meta:set_int("l"..tostring(i).."s", 0)
end
update_formspec(pos)
end
return pipeworks.after_place(pos, placer, itemstack, pointed_thing)
end,
on_punch = update_formspec, on_punch = update_formspec,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if not pipeworks.may_configure(pos, sender) then return end if (fields.quit and not fields.key_enter_field)
or not pipeworks.may_configure(pos, sender) then
return
end
fs_helpers.on_receive_fields(pos, fields) fs_helpers.on_receive_fields(pos, fields)
update_formspec(pos) update_formspec(pos)
end, end,

View File

@ -4,6 +4,9 @@ local filename=minetest.get_worldpath() .. "/teleport_tubes"
local tp_tube_db = nil -- nil forces a read local tp_tube_db = nil -- nil forces a read
local tp_tube_db_version = 2.0 local tp_tube_db_version = 2.0
-- cached rceiver list: hash(pos) => {receivers}
local cache = {}
local function hash(pos) local function hash(pos)
return string.format("%.30g", minetest.hash_node_position(pos)) return string.format("%.30g", minetest.hash_node_position(pos))
end end
@ -18,6 +21,8 @@ local function save_tube_db()
else else
error(err) error(err)
end end
-- reset tp-tube cache
cache = {}
end end
local function migrate_tube_db() local function migrate_tube_db()
@ -101,6 +106,12 @@ local function read_node_with_vm(pos)
end end
local function get_receivers(pos, channel) local function get_receivers(pos, channel)
local hash = minetest.hash_node_position(pos)
if cache[hash] then
-- re-use cached result
return cache[hash]
end
local tubes = tp_tube_db or read_tube_db() local tubes = tp_tube_db or read_tube_db()
local receivers = {} local receivers = {}
local dirty = false local dirty = false
@ -121,6 +132,8 @@ local function get_receivers(pos, channel)
if dirty then if dirty then
save_tube_db() save_tube_db()
end end
-- cache the result for next time
cache[hash] = receivers
return receivers return receivers
end end
@ -274,5 +287,7 @@ pipeworks.tptube = {
hash = hash, hash = hash,
save_tube_db = save_tube_db, save_tube_db = save_tube_db,
get_db = function() return tp_tube_db or read_tube_db() end, get_db = function() return tp_tube_db or read_tube_db() end,
set_tube = set_tube,
update_meta = update_meta,
tp_tube_db_version = tp_tube_db_version tp_tube_db_version = tp_tube_db_version
} }