An attempt to fix the pump
This commit is contained in:
parent
f1e960cc1c
commit
10482d52c9
@ -70,6 +70,7 @@ local function timer(pos, elapsed)
|
|||||||
|
|
||||||
-- Pump level
|
-- Pump level
|
||||||
local plevel = meta:get_int("level")
|
local plevel = meta:get_int("level")
|
||||||
|
local pliquid = meta:get_string("liquid")
|
||||||
if plevel == 0 then plevel = -1 end
|
if plevel == 0 then plevel = -1 end
|
||||||
|
|
||||||
local ppos = vector.add(pos, {x=0,y=plevel,z=0})
|
local ppos = vector.add(pos, {x=0,y=plevel,z=0})
|
||||||
@ -87,9 +88,9 @@ local function timer(pos, elapsed)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
local dig_node = fl_buffer.fluid
|
local dig_node = pliquid
|
||||||
local amount = 1000
|
local amount = 1000
|
||||||
if fl_buffer.fluid == "elepower_nuclear:heavy_water_source" and heavy then
|
if pliquid == "elepower_nuclear:heavy_water_source" and heavy then
|
||||||
dig_node = "default:water_source"
|
dig_node = "default:water_source"
|
||||||
amount = 200
|
amount = 200
|
||||||
end
|
end
|
||||||
@ -99,7 +100,7 @@ local function timer(pos, elapsed)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
if fl_buffer.fluid == "" then
|
if pliquid == "" then
|
||||||
local node = minetest.get_node_or_nil(ppos)
|
local node = minetest.get_node_or_nil(ppos)
|
||||||
if not node or node.name == "air" or (bucket.liquids[node.name] and bucket.liquids[node.name].flowing == node.name) then
|
if not node or node.name == "air" or (bucket.liquids[node.name] and bucket.liquids[node.name].flowing == node.name) then
|
||||||
plevel = plevel - 1
|
plevel = plevel - 1
|
||||||
@ -117,7 +118,7 @@ local function timer(pos, elapsed)
|
|||||||
node.name = "elepower_nuclear:heavy_water_source"
|
node.name = "elepower_nuclear:heavy_water_source"
|
||||||
end
|
end
|
||||||
|
|
||||||
fl_buffer.fluid = node.name
|
pliquid = node.name
|
||||||
refresh = true
|
refresh = true
|
||||||
else
|
else
|
||||||
-- Run into a non-liquid node, stop the timer
|
-- Run into a non-liquid node, stop the timer
|
||||||
@ -125,10 +126,10 @@ local function timer(pos, elapsed)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if fl_buffer.fluid ~= "" then
|
if pliquid ~= "" then
|
||||||
-- Filter was installed
|
-- Filter was installed
|
||||||
if fl_buffer.fluid == "default:water_source" and heavy and fl_buffer.amount > 0 then
|
if pliquid == "default:water_source" and heavy and fl_buffer.amount > 0 then
|
||||||
fl_buffer.fluid = "elepower_nuclear:heavy_water_source"
|
pliquid = "elepower_nuclear:heavy_water_source"
|
||||||
fl_buffer.amount = 0
|
fl_buffer.amount = 0
|
||||||
refresh = true
|
refresh = true
|
||||||
break
|
break
|
||||||
@ -144,7 +145,7 @@ local function timer(pos, elapsed)
|
|||||||
node.name = "elepower_nuclear:heavy_water_source"
|
node.name = "elepower_nuclear:heavy_water_source"
|
||||||
end
|
end
|
||||||
|
|
||||||
if not node or (node.name ~= fl_buffer.fluid and node.name ~= "air") then
|
if not node or (node.name ~= pliquid and node.name ~= "air") then
|
||||||
status = "No More Fluid!"
|
status = "No More Fluid!"
|
||||||
refresh = false
|
refresh = false
|
||||||
break
|
break
|
||||||
@ -168,6 +169,8 @@ local function timer(pos, elapsed)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fl_buffer.fluid = pliquid
|
||||||
|
|
||||||
-- Spawn tube entities
|
-- Spawn tube entities
|
||||||
if status == "Pumping" or status == "Seeking" then
|
if status == "Pumping" or status == "Seeking" then
|
||||||
for i = 1, math.abs(plevel) do
|
for i = 1, math.abs(plevel) do
|
||||||
@ -196,6 +199,7 @@ local function timer(pos, elapsed)
|
|||||||
|
|
||||||
meta:set_int("storage", pow_buffer.storage)
|
meta:set_int("storage", pow_buffer.storage)
|
||||||
meta:set_int("level", plevel)
|
meta:set_int("level", plevel)
|
||||||
|
meta:set_string("liquid", pliquid)
|
||||||
|
|
||||||
meta:set_int("pump_fluid_storage", fl_buffer.amount)
|
meta:set_int("pump_fluid_storage", fl_buffer.amount)
|
||||||
meta:set_string("pump_fluid", fl_buffer.fluid)
|
meta:set_string("pump_fluid", fl_buffer.fluid)
|
||||||
|
Loading…
Reference in New Issue
Block a user