Merge pull request #44 from realmicu/master

electrolyzer and growlight fixes
This commit is contained in:
Joachim Stolberg 2020-11-29 18:19:17 +01:00 committed by GitHub
commit 81852ec210
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -156,6 +156,15 @@ local function after_dig_node(pos, oldnode, oldmetadata, digger)
Cable:after_dig_node(pos)
end
local function put(pos, indir, name, amount)
local leftover = liquid.srv_put(pos, indir, name, amount)
if techage.is_activeformspec(pos) then
local nvm = techage.get_nvm(pos)
M(pos):set_string("formspec", formspec(State, pos, nvm))
end
return leftover
end
local function tubelib2_on_update2(pos, outdir, tlib2, node)
if tlib2.tube_type == "pipe2" then
liquid.update_network(pos, outdir, tlib2)
@ -182,14 +191,8 @@ local netw_def = {
local liquid_def = {
capa = CAPACITY,
peek = liquid.srv_peek,
put = function(pos, indir, name, amount)
local leftover = liquid.srv_put(pos, indir, name, amount)
if techage.is_activeformspec(pos) then
local nvm = techage.get_nvm(pos)
M(pos):set_string("formspec", formspec(State, pos, nvm))
end
return leftover
end,
put = put,
untake = put,
take = function(pos, indir, name, amount)
amount, name = liquid.srv_take(pos, indir, name, amount)
if techage.is_activeformspec(pos) then

View File

@ -20,6 +20,7 @@ local Cable = techage.ElectricCable
local power = techage.power
local Flowers = {}
local Plants = {}
local Ignore = { ["flowers:waterlily_waving"] = true }
-- 9 plant positions below the light
local Positions = {
{x = 0, y =-1, z = 0},
@ -143,16 +144,20 @@ minetest.after(1, function()
if name and type(name) == "string" then
local mod = string.split(name, ":")[1]
if mod == "flowers" or mod == "bakedclay" then -- Bakedclay also registers flowers as decoration.
if not Ignore[name] then
techage.register_flower(name)
end
end
end
end
for name,ndef in pairs(minetest.registered_nodes) do
if type(name) == "string" then
local mod = string.split(name, ":")[1]
if mod == "farming" and ndef.on_timer then -- probably a plant that still needs to grow
if not Ignore[name] then
techage.register_plant(name)
end
end
end
end
end)