fixed pump, removed some debugging print()'s

master
Izzy 2019-03-07 22:04:16 -07:00
parent c38e4ad1f6
commit df49a5c3f6
3 changed files with 20 additions and 9 deletions

View File

@ -66,6 +66,7 @@ local function register_fluid(modname, name, info)
buildable_to = true,
post_effect_color = info.post_effect_color,
groups = groups,
nonfull_name = fname,
sounds = default.node_sound_water_defaults(),
node_box = {
type = "leveled",
@ -118,6 +119,7 @@ local function register_fluid(modname, name, info)
buildable_to = true,
post_effect_color = info.post_effect_color,
groups = full_groups,
nonfull_name = fname,
sounds = default.node_sound_water_defaults(),
node_box = {
type = "leveled",

View File

@ -492,13 +492,15 @@ minetest.register_abm({
if pnet.fluid == 'air' or pnet.buffer == 0 then
if minetest.registered_nodes[unode.name].groups.petroleum ~= nil then
-- BUG: check for "full" nodes
pnet.fluid = unode.name
pnet.fluid = minetest.registered_nodes[unode.name].nonfull_name
print("intake: here".. (pnet.fluid or "<nil>"))
else
print("intake: no fluid available ".. pos.x.. ",".. pos.y..",".. pos.z)
return -- no available liquids
end
else -- only suck in existing fluid
if unode.name ~= pnet.fluid and unode.name ~= pnet.fluid.."_full" then
--print("no water near intake")
print("bitumen: no fluid near intake: " .. unode.name .. " != " .. pnet.fluid)
return
end
end
@ -512,7 +514,7 @@ minetest.register_abm({
pnet.in_pressure = pnet.in_pressure or -32000
if pnet.in_pressure > pos.y - 1 then
print("backflow at intake: " .. pnet.in_pressure.. " > " ..(pos.y - 1) )
print("petroleum backflow at intake: " .. pnet.in_pressure.. " > " ..(pos.y - 1) )
return
end

View File

@ -136,7 +136,7 @@ minetest.register_abm({
local backpos = vector.add(pos, back_dir)
local backnet = bitumen.pipes.get_net(backpos)
if backnet == nil then
-- print("pump no backnet at "..minetest.pos_to_string(backpos))
print("bpump no backnet at "..minetest.pos_to_string(backpos))
return
end
@ -144,24 +144,31 @@ minetest.register_abm({
local frontpos = vector.add(pos, front_dir)
local frontnet = bitumen.pipes.get_net(frontpos)
if frontnet == nil then
-- print("pump no frontnet at "..minetest.pos_to_string(frontpos))
print("bpump no frontnet at "..minetest.pos_to_string(frontpos))
return
end
if backnet.fluid ~= frontnet.fluid and backnet.fluid ~= "air" then
-- print("pump: bad_fluid")
print("bpump: bad_fluid")
return -- incompatible fluids
end
local lift = 25
--print("fpos ".. minetest.pos_to_string(frontpos) .. " | bpos "..minetest.pos_to_string(backpos))
--print("fp ".. frontnet.in_pressure .. " | bp "..backnet.in_pressure)
local taken, fluid = bitumen.pipes.take_fluid(frontpos, 20)
-- HACK: hardcoded buffer amount
local to_take = math.min(20, 64 - backnet.buffer)
if to_take == 0 then
print("pump: output pipe full")
return
end
local taken, fluid = bitumen.pipes.take_fluid(frontpos, to_take)
local pushed = bitumen.pipes.push_fluid(backpos, fluid, taken, lift)
--print("pumped " ..taken .. " > "..pushed)
print("bitumen pumped " ..taken .. " > "..pushed)
if pushed < taken then
--print("pump leaked ".. (taken - pushed))
print("bitumen pump leaked ".. (taken - pushed))
end
--print("")