fluids, pipes, drilling
parent
7917109951
commit
27de4d5ee9
|
@ -0,0 +1,201 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local function check_drill_stack(opos)
|
||||||
|
local pos = vector.new(opos)
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
|
||||||
|
while 1 == 1 do
|
||||||
|
if minetest.get_node(pos).name == "bitumen:drill_pipe" then
|
||||||
|
-- noop
|
||||||
|
else
|
||||||
|
-- end of the stack
|
||||||
|
break
|
||||||
|
end
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
print("well depth: "..pos.y)
|
||||||
|
|
||||||
|
return {x=pos.x, y=pos.y, z=pos.z}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("bitumen:drill_pipe", {
|
||||||
|
paramtype = "light",
|
||||||
|
description = "Drill Pipe",
|
||||||
|
tiles = {"default_copper_block.png", "default_copper_block.png", "default_copper_block.png",
|
||||||
|
"default_copper_block.png", "default_copper_block.png", "default_copper_block.png"},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
--11.25
|
||||||
|
{-0.49, -0.5, -0.10, 0.49, 0.5, 0.10},
|
||||||
|
{-0.10, -0.5, -0.49, 0.10, 0.5, 0.49},
|
||||||
|
--22.5
|
||||||
|
{-0.46, -0.5, -0.19, 0.46, 0.5, 0.19},
|
||||||
|
{-0.19, -0.5, -0.46, 0.19, 0.5, 0.46},
|
||||||
|
-- 33.75
|
||||||
|
{-0.416, -0.5, -0.28, 0.416, 0.5, 0.28},
|
||||||
|
{-0.28, -0.5, -0.416, 0.28, 0.5, 0.416},
|
||||||
|
--45
|
||||||
|
{-0.35, -0.5, -0.35, 0.35, 0.5, 0.35},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
groups = {cracky=3,oddly_breakable_by_hand=3 },
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
on_punch = function(pos)
|
||||||
|
check_drill_stack(pos)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("bitumen:well_siphon", {
|
||||||
|
paramtype = "light",
|
||||||
|
description = "Well Siphon",
|
||||||
|
tiles = {"default_bronze_block.png", "default_bronze_block.png", "default_bronze_block.png",
|
||||||
|
"default_bronze_block.png", "default_bronze_block.png", "default_bronze_block.png"},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
--11.25
|
||||||
|
{-0.49, -0.5, -0.10, 0.49, 0.5, 0.10},
|
||||||
|
{-0.10, -0.5, -0.49, 0.10, 0.5, 0.49},
|
||||||
|
--22.5
|
||||||
|
{-0.46, -0.5, -0.19, 0.46, 0.5, 0.19},
|
||||||
|
{-0.19, -0.5, -0.46, 0.19, 0.5, 0.46},
|
||||||
|
-- 33.75
|
||||||
|
{-0.416, -0.5, -0.28, 0.416, 0.5, 0.28},
|
||||||
|
{-0.28, -0.5, -0.416, 0.28, 0.5, 0.416},
|
||||||
|
--45
|
||||||
|
{-0.35, -0.5, -0.35, 0.35, 0.5, 0.35},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
groups = {cracky=3,oddly_breakable_by_hand=3 },
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
on_construct = function(pos)
|
||||||
|
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local function drill(pos)
|
||||||
|
|
||||||
|
local dp = check_drill_stack(pos)
|
||||||
|
|
||||||
|
local n = minetest.get_node(dp)
|
||||||
|
|
||||||
|
if n.name == "ignore" then
|
||||||
|
if minetest.forceload_block(pos, true) then
|
||||||
|
print("forceload successful")
|
||||||
|
minetest.emerge_area(pos, pos)
|
||||||
|
local n = minetest.get_node(dp)
|
||||||
|
else
|
||||||
|
print("forceload failed")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- minetest.emerge_area(pos, pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if n.name == "bitumen:crude_oil" then
|
||||||
|
pos.y = pos.y + 2
|
||||||
|
minetest.set_node(pos, {name = "bitumen:crude_oil"})
|
||||||
|
minetest.set_node_level(pos, 64)
|
||||||
|
else
|
||||||
|
print("drilling "..n.name)
|
||||||
|
minetest.set_node(dp, {name = "bitumen:drill_pipe"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("bitumen:drill_rig", {
|
||||||
|
description = "Drill Rig",
|
||||||
|
tiles = {"default_tin_block.png", "default_steel_block.png", "default_steel_block.png",
|
||||||
|
"default_tin_block.png", "default_tin_block.png", "default_steel_block.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=2, petroleum_fixture=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
can_dig = function(pos,player)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_timer = dcb_node_timer,
|
||||||
|
on_punch = function(pos)
|
||||||
|
drill(pos)
|
||||||
|
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"bitumen:drill_rig"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
print("trydrill")
|
||||||
|
drill(pos)
|
||||||
|
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local function pump_oil(pos)
|
||||||
|
|
||||||
|
local dp = check_drill_stack(pos)
|
||||||
|
|
||||||
|
local n = minetest.get_node(dp)
|
||||||
|
|
||||||
|
if n.name == "bitumen:crude_oil" then
|
||||||
|
minetest.set_node(dp, {name="air"})
|
||||||
|
|
||||||
|
pos.x = pos.x + 1
|
||||||
|
minetest.set_node(pos, {name="bitumen:crude_oil"})
|
||||||
|
minetest.set_node_level(pos, 64)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("bitumen:well_pump", {
|
||||||
|
description = "Drill Rig",
|
||||||
|
tiles = {"default_gold_block.png", "default_steel_block.png", "default_copper_block.png",
|
||||||
|
"default_tin_block.png", "default_gold_block.png", "default_steel_block.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=2, petroleum_fixture=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
can_dig = function(pos,player)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_timer = dcb_node_timer,
|
||||||
|
on_punch = function(pos)
|
||||||
|
pump_oil(pos)
|
||||||
|
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
74
gasoline.lua
74
gasoline.lua
|
@ -217,8 +217,8 @@ local function register_fluid(modname, name, info)
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {full_fname},
|
nodenames = {full_fname},
|
||||||
neighbors = {"air"},
|
neighbors = {"air"},
|
||||||
interval = 5,
|
interval = info.reflow_interval or 5,
|
||||||
chance = 1,
|
chance = info.flow_chance or 1,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
-- if it's near air it might flow
|
-- if it's near air it might flow
|
||||||
minetest.set_node(pos, {name = fname})
|
minetest.set_node(pos, {name = fname})
|
||||||
|
@ -231,8 +231,8 @@ local function register_fluid(modname, name, info)
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {fname},
|
nodenames = {fname},
|
||||||
neighbors = {"group:"..gname, "air"},
|
neighbors = {"group:"..gname, "air"},
|
||||||
interval = 1,
|
interval = info.flow_interval or 1,
|
||||||
chance = 1,
|
chance = info.flow_chance or 1,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
local mylevel = minetest.get_node_level(pos)
|
local mylevel = minetest.get_node_level(pos)
|
||||||
-- print("\n mylevel ".. mylevel)
|
-- print("\n mylevel ".. mylevel)
|
||||||
|
@ -426,6 +426,21 @@ register_fluid("bitumen", "tar", {
|
||||||
desc = "Tar",
|
desc = "Tar",
|
||||||
groups = {flammable=1, petroleum=1},
|
groups = {flammable=1, petroleum=1},
|
||||||
|
|
||||||
|
colorize = "^[colorize:black:210",
|
||||||
|
post_effect_color = {a = 103, r = 80, g = 76, b = 90},
|
||||||
|
|
||||||
|
evap_chance = 0,
|
||||||
|
})
|
||||||
|
|
||||||
|
register_fluid("bitumen", "crude_oil", {
|
||||||
|
desc = "Crude Oil",
|
||||||
|
groups = {flammable=1, petroleum=1},
|
||||||
|
|
||||||
|
reflow_interval = 10,
|
||||||
|
reflow_chance = 2,
|
||||||
|
flow_interval = 3,
|
||||||
|
flow_chance = 3,
|
||||||
|
|
||||||
colorize = "^[colorize:black:240",
|
colorize = "^[colorize:black:240",
|
||||||
post_effect_color = {a = 103, r = 80, g = 76, b = 90},
|
post_effect_color = {a = 103, r = 80, g = 76, b = 90},
|
||||||
|
|
||||||
|
@ -433,3 +448,54 @@ register_fluid("bitumen", "tar", {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("bitumen:crudesource", {
|
||||||
|
description = "thing",
|
||||||
|
tiles = { "default_copper_block.png" },
|
||||||
|
groups = { cracky = 3 },
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--temp hack for dev
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"bitumen:crudesource"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
minetest.set_node(pos, {name = "bitumen:crude_oil"})
|
||||||
|
minetest.set_node_level(pos, 64)
|
||||||
|
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "blob",
|
||||||
|
ore = "bitumen:crude_oil_full",
|
||||||
|
wherein = {"default:stone"},
|
||||||
|
clust_scarcity = 64 * 64 * 64,
|
||||||
|
-- clust_scarcity = 16 * 16 * 16,
|
||||||
|
clust_size = 30,
|
||||||
|
y_min = -10000,
|
||||||
|
y_max = -500,
|
||||||
|
noise_threshold = 0.04,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0.5,
|
||||||
|
scale = 0.7,
|
||||||
|
spread = {x = 40, y = 40, z = 40},
|
||||||
|
seed = 2316,
|
||||||
|
octaves = 4,
|
||||||
|
persist = 0.7
|
||||||
|
},
|
||||||
|
--[[ it's all "underground" anyway
|
||||||
|
biomes = {
|
||||||
|
"taiga", "tundra", "snowy_grassland", "coniferous_forest",
|
||||||
|
"coniferous_forest_dunes",
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
})
|
||||||
|
|
38
pipes.lua
38
pipes.lua
|
@ -206,10 +206,42 @@ bitumen.pipes.push_fluid = function(pos, fluid, amount, extra_pressure)
|
||||||
return take
|
return take
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- used by external machines to remove fluid from the pipe network
|
||||||
|
-- returns amount and fluid type
|
||||||
|
bitumen.pipes.take_fluid = function(pos, max_amount)
|
||||||
|
local hash = minetest.hash_node_position(pos)
|
||||||
|
local phash = net_members[hash]
|
||||||
|
if phash == nil then
|
||||||
|
return 0, "air" -- no network
|
||||||
|
end
|
||||||
|
local pnet = networks[phash]
|
||||||
|
|
||||||
|
if pnet.buffer <= 0 then
|
||||||
|
--print("spout: no water in pipe")
|
||||||
|
return 0, "air" -- no water in the pipe
|
||||||
|
end
|
||||||
|
|
||||||
|
-- hack
|
||||||
|
pnet.in_pressure = pnet.in_pressure or -32000
|
||||||
|
|
||||||
|
if pnet.in_pressure <= pos.y then
|
||||||
|
print("insufficient pressure at spout: ".. pnet.in_pressure .. " < " ..pos.y )
|
||||||
|
return 0, "air"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
|
||||||
|
local bnode = minetest.get_node(pos)
|
||||||
|
local take = math.min(pnet.buffer, max_amount)
|
||||||
|
pnet.buffer = pnet.buffer - take
|
||||||
|
|
||||||
|
return take, pnet.fluid
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("bitumen:intake", {
|
minetest.register_node("bitumen:intake", {
|
||||||
description = "Intake",
|
description = "Petroleum Intake",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "connected",
|
type = "connected",
|
||||||
|
@ -308,7 +340,7 @@ minetest.register_abm({
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("bitumen:spout", {
|
minetest.register_node("bitumen:spout", {
|
||||||
description = "Spout",
|
description = "Petroleum Spout",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "connected",
|
type = "connected",
|
||||||
|
@ -441,7 +473,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("bitumen:pipe", {
|
minetest.register_node("bitumen:pipe", {
|
||||||
description = "water pipe",
|
description = "petroleum pipe",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "connected",
|
type = "connected",
|
||||||
|
|
104
refinery.lua
104
refinery.lua
|
@ -1,37 +1,16 @@
|
||||||
-- need:
|
-- need:
|
||||||
-- boiler
|
|
||||||
-- distillation column
|
|
||||||
-- bottler?
|
-- bottler?
|
||||||
|
|
||||||
--[[ NEED:
|
|
||||||
|
|
||||||
|
|
||||||
machine defs:
|
|
||||||
synth crude upgrader
|
|
||||||
|
|
||||||
]]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- technic.register_extractor_recipe("technic:coal_dust", 1, "dye:black", 2)
|
|
||||||
-- technic.register_extractor_recipe("default:cactus", 1, "dye:green", 2)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local extractor_formspec =
|
|
||||||
"invsize[8,9;]"..
|
|
||||||
"label[0,0;Extractor]"..
|
|
||||||
"list[current_name;src;3,1;1,1;]"..
|
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
|
||||||
"list[current_player;main;0,5;8,4;]"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--need pipeworks integration
|
--
|
||||||
|
-- usage: alternate distillation columns and dist. col. outlets
|
||||||
|
-- put boiler on the bottom
|
||||||
|
-- pipe various distillates out
|
||||||
|
--
|
||||||
|
--
|
||||||
minetest.register_node("bitumen:distillation_column", {
|
minetest.register_node("bitumen:distillation_column", {
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
description = "Distillation Column Segment",
|
description = "Distillation Column Segment",
|
||||||
|
@ -190,35 +169,13 @@ minetest.register_abm({
|
||||||
|
|
||||||
for fluid,p in pairs(stack) do
|
for fluid,p in pairs(stack) do
|
||||||
print("pushing "..fluid.." at "..p.y)
|
print("pushing "..fluid.." at "..p.y)
|
||||||
bitumen.pipes.push_fluid(p, "bitumen:"..fluid, 10, 10)
|
local yield = bitumen.distillation_yield[fluid] * .64 -- convert to levels
|
||||||
|
bitumen.pipes.push_fluid(p, "bitumen:"..fluid, yield, 10)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
--[[
|
|
||||||
minetest.register_node("bitumen:cracking_boiler_active", {
|
|
||||||
description = "Cracking Column Boiler",
|
|
||||||
tiles = {"technic_lv_grinder_top.png", "technic_lv_grinder_bottom.png",
|
|
||||||
"technic_lv_grinder_side.png", "technic_lv_grinder_side.png",
|
|
||||||
"technic_lv_grinder_side.png", "technic_lv_grinder_front_active.png"},
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {cracky=2, not_in_creative_inventory=1},
|
|
||||||
legacy_facedir_simple = true,
|
|
||||||
sounds = default.node_sound_wood_defaults(),
|
|
||||||
can_dig = function(pos,player)
|
|
||||||
local meta = minetest.get_meta(pos);
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
|
||||||
"Machine cannot be removed because it is not empty");
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
]]
|
|
||||||
|
|
||||||
-- must add up to 100
|
-- must add up to 100
|
||||||
bitumen.distillation_yield = {
|
bitumen.distillation_yield = {
|
||||||
|
@ -234,19 +191,6 @@ bitumen.distillation_yield = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bitumen.cracking_yield_rate = {
|
|
||||||
lpg = 5 ,
|
|
||||||
jet_fuel = 1 ,
|
|
||||||
gasoline = 4 ,
|
|
||||||
diesel = 5,
|
|
||||||
fuel_oil = 10,
|
|
||||||
lube_oil = 9,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bitumen.energy_density = {
|
bitumen.energy_density = {
|
||||||
lpg = { 33 },
|
lpg = { 33 },
|
||||||
jet_fuel = { 40 },
|
jet_fuel = { 40 },
|
||||||
|
@ -258,37 +202,7 @@ bitumen.energy_density = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--temp hack for dev
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"bitumen:cracking_boiler", "bitumen:cracking_boiler_active"},
|
|
||||||
interval = 3,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
local srcstack = inv:get_stack("src", 1)
|
|
||||||
|
|
||||||
local avail = srcstack:get_count()
|
|
||||||
|
|
||||||
local columns = check_cracking_stack(pos)
|
|
||||||
for otype,colpos in pairs(columns) do
|
|
||||||
local cmeta = minetest.get_meta(colpos)
|
|
||||||
local cinv = cmeta:get_inventory()
|
|
||||||
local dststack = cinv:get_stack("dst", 1)
|
|
||||||
|
|
||||||
local yield = bitumen.cracking_yield_rate[otype]
|
|
||||||
|
|
||||||
-- cinv:add_item("dst", )
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- srcstack:take_item(recipe.src_count)
|
|
||||||
-- inv:set_stack("src", 1, srcstack)
|
|
||||||
-- inv:add_item("dst", result)
|
|
||||||
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
--[[
|
--[[
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"bitumen:cracking_boiler_active"},
|
nodenames = {"bitumen:cracking_boiler_active"},
|
||||||
|
|
Loading…
Reference in New Issue