Compare commits

..

No commits in common. "5b7d61d7d97904ba02e1d32cb37b88edfadca875" and "4b9b42c4091b48bea8323fd99f49770a863cf8d0" have entirely different histories.

3 changed files with 10 additions and 49 deletions

View File

@ -34,7 +34,6 @@ function fluid_lib.register_extractor_node(nodename, nodedef)
nodedef.on_punch = function (pos, node, puncher, pointed_thing)
minetest.get_node_timer(pos):start(1.0)
minetest.chat_send_player(puncher:get_player_name(),"Pump Started")
minetest.node_punch(pos, node, puncher, pointed_thing)
end

View File

@ -124,13 +124,12 @@ end
function fluid_lib.transfer_timer_tick(pos, elapsed)
local refresh = true
local node = minetest.get_node_or_nil(pos)
local status = "Fluid Pump"
if not node then
return false
end
local meta = minetest.get_meta(pos)
local targets = {}
-- Only allow the node directly behind to be a start of a network
@ -145,9 +144,9 @@ function fluid_lib.transfer_timer_tick(pos, elapsed)
-- Retrieve network
targets = fluid_targets(pos, tpos)
-- No targets, don't proceed
if #targets == 0 then
meta:set_string("infotext", status.."\nNo Recieving Tank")
return true
end
@ -157,7 +156,6 @@ function fluid_lib.transfer_timer_tick(pos, elapsed)
-- Make sure source node is not air
if not srcnode or srcnode.name == "air" then
meta:set_string("infotext", status.."\nNo Source Tank")
return true
end
@ -165,15 +163,11 @@ function fluid_lib.transfer_timer_tick(pos, elapsed)
-- Make sure source node is a registered fluid container
if not srcdef or not srcdef['node_io_can_take_liquid'] then
meta:set_string("infotext", status.." Off")
return false
end
local c = srcdef.node_io_can_take_liquid(srcpos, srcnode, "")
if not c then
meta:set_string("infotext", status.." Off")
return false
end
if not c then return false end
local srcmeta = minetest.get_meta(srcpos)
local fl_size = srcdef.node_io_get_liquid_size(srcpos, srcnode, "")
@ -181,10 +175,7 @@ function fluid_lib.transfer_timer_tick(pos, elapsed)
for i = 1, fl_size do
buffers[i] = srcdef.node_io_get_liquid_name(srcpos, srcnode, "", i)
end
if not #buffers then
meta:set_string("infotext", status.."\nNo Source Tank")
return true
end
if not #buffers then return true end
-- Limit the amount of fluid pumped per cycle
local pcapability = get_node_property(meta, pos, "fluid_pump_capacity")
@ -193,9 +184,7 @@ function fluid_lib.transfer_timer_tick(pos, elapsed)
-- Transfer some fluid here
for _,pos in pairs(targets) do
if not vector.equals(pos, srcpos) then
if pumped >= pcapability then break end
local destnode = minetest.get_node(pos)
local destdef = minetest.registered_nodes[destnode.name]
local pp = nil
@ -214,48 +203,24 @@ function fluid_lib.transfer_timer_tick(pos, elapsed)
local changed = false
if pp ~= nil then
for bindex,bfluid in pairs(pp) do -- bfluid = destination fluid name
for aindex,afluid in pairs(buffers) do -- afluid = source fluid name
-- get fluid names for pump status
local bfluid_des = ""
local afluid_des = ""
if bfluid ~= "" then
bfluid_des = minetest.registered_nodes[bfluid].description
end
if afluid ~= "" then
afluid_des = minetest.registered_nodes[afluid].description
end
if pumped >= pcapability then
meta:set_string("infotext", status.."\nPumped Max Volume".." "..bfluid_des)
break
end
if (afluid == bfluid or bfluid == "") then -- bfluid = "", empty destiniation
for bindex,bfluid in pairs(pp) do
for aindex,afluid in pairs(buffers) do
if pumped >= pcapability then break end
if (afluid == bfluid or bfluid == "") then
local idef = destdef.node_io_room_for_liquid(pos, destnode, "", afluid, pcapability)
if idef > 0 then
local fluidcount = srcdef.node_io_get_liquid_stack(srcpos, srcnode, "", aindex):get_count()
local defc = math.min(fluidcount, idef)
local defi = srcdef.node_io_take_liquid(srcpos, srcnode, "", nil, afluid, defc)
if defi and defi.millibuckets > 0 then
local lo = destdef.node_io_put_liquid(pos, destnode, "", nil, afluid, defi.millibuckets)
pumped = pumped + (defi.millibuckets - lo)
meta:set_string("infotext", status.."\nPumping "..afluid_des)
changed = true
end
else
meta:set_string("infotext", status.."\nStandby")
end
end
end
end
else
meta:set_string("infotext", status.."\nStandby")
end
if changed then

View File

@ -2,7 +2,6 @@
fluid_lib.register_extractor_node("fluid_transfer:fluid_transfer_pump", {
description = "Fluid Transfer Pump\nPunch to start pumping",
tiles = {"fluid_transfer_pump.png"},
use_texture_alpha = "clip",
drawtype = "mesh",
mesh = "fluid_transfer_pump.obj",
groups = {oddly_breakable_by_hand = 1, cracky = 1},
@ -19,7 +18,6 @@ fluid_lib.register_extractor_node("fluid_transfer:fluid_transfer_pump", {
fluid_lib.register_transfer_node("fluid_transfer:fluid_duct", {
description = "Fluid Duct",
tiles = {"fluid_transfer_duct.png"},
use_texture_alpha = "clip",
groups = {oddly_breakable_by_hand = 1, cracky = 1}
})
@ -28,7 +26,6 @@ minetest.register_node("fluid_transfer:fluid_trash", {
drawtype = "mesh",
mesh = "fluid_transfer_trash.obj",
tiles = {"fluid_transfer_trash.png"},
use_texture_alpha = "clip",
groups = {oddly_breakable_by_hand = 1, cracky = 1, fluid_container = 1},
node_io_can_put_liquid = function (pos, node, side)
return true