incremental

master
dhunt 2013-10-11 19:37:26 -07:00
parent b2c2862bf0
commit f75247b9bc
5 changed files with 252 additions and 116 deletions

View File

@ -21,6 +21,10 @@ inv textures:
lpg regulator
pipes
sounds:
metal sounds
filling sounds
craft items:
^ lpg regulator
small lpg bottle
@ -46,34 +50,49 @@ box models:
]]
--[[
minetest.register_node("technic:water_can", {
description = "Water Can",
inventory_image = "technic_water_can.png",
bitumen.containers = {}
bitumen.containers.max_fill = {
{oil_drum = 200},
{gas_can = 20},
}
-- gas can is a tool
minetest.register_tool("bitumen:gas_can", {
description = "Gas Can",
inventory_image = "bitumen_gas_can.png",
stack_max = 1,
liquids_pointable = true,
-- liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return end
n = minetest.env:get_node(pointed_thing.under)
n = minetest.env:get_node(pointed_thing)
-- only operate on oil givers
if n.group.oilpipe_give ~= 1 then
return end
item=itemstack:to_table()
local load=nil
if item["metadata"]=="" then load=0
else load=tonumber(item["metadata"])
local fill=nil
if item["metadata"]=="" then fill=0
else fill=tonumber(item["metadata"])
end
if n.name == "default:water_source" then
if load+1<17 then
minetest.env:add_node(pointed_thing.under, {name="air"})
load=load+1;
item["metadata"]=tostring(load)
technic.set_RE_wear(item,load,water_can_max_load)
itemstack:replace(item)
end
return itemstack
end
-- can is empty
if fill <= 0 then return end
-- if n.name == "default:water_source" then
-- if load+1<17 then
-- minetest.env:add_node(pointed_thing.under, {name="air"})
-- load=load+1;
-- item["metadata"]=tostring(load)
-- technic.set_RE_wear(item,load,water_can_max_load)
-- itemstack:replace(item)
-- end
-- return itemstack
-- end
item=itemstack:to_table()
if load==0 then return end
@ -96,47 +115,52 @@ minetest.register_node("technic:water_can", {
return itemstack
end
end,
})]]
})
minetest.register_node(":bitumen:oil_drum", {
description = "Oil Drum",
tiles = {"technic_copper_chest_top.png", "technic_copper_chest_top.png", "technic_copper_chest_side.png",
"technic_copper_chest_side.png", "technic_copper_chest_side.png", "technic_copper_chest_front.png"},
paramtype2 = "facedir",
inventory_image = "technic_water_can.png",
--groups = chest_groups1,
stack_max = 1,
-- inventory_image = "bitumen_oil_drum.png",
groups = {
cracky=2,
oddly_breakable_by_hand=2,
oilpipe=1,
oilpipe_receive=1,
oil_container = 1
},
-- stack_max = 99,
-- tube = tubes_properties,legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"invsize[10,10;]"..
"label[0,0;Copper Chest]"..
"list[current_name;main;0,1;10,4;]"..
"list[current_player;main;0,6;8,4;]"..
"background[-0.19,-0.25;10.4,10.75;ui_form_bg.png]"..
"background[0,1;10,4;ui_copper_chest_inventory.png]"..
"background[0,6;8,4;ui_main_inventory.png]")
meta:set_string("infotext", "Copper Chest")
meta:set_string("infotext", "Oil Drum (Empty)")
meta:set_string("oiltype", "Empty")
meta:set_int("filllevel", "0")
-- meta:set_string("fillmax", "200") -- 55 US Gal, 44 Imp. Gal, 200 L
local inv = meta:get_inventory()
inv:set_size("main", 10*4)
end,
can_dig = chest_can_dig,
on_metadata_inventory_move = def_on_metadata_inventory_move,
on_metadata_inventory_put = def_on_metadata_inventory_put,
on_metadata_inventory_take = def_on_metadata_inventory_take
can_dig = function(pos, player)
local meta = minetest.env:get_meta(pos)
if meta:get_int('filllevel') > 0 then
return false
end
return true
end,
})
minetest.register_tool("bitumen:oil_drum", {
description = "55 Gallon Oil Drum",
inventory_image = "technic_battery.png",
tool_capabilities = {
charge = 0,
max_drop_level = 0,
groupcaps = {
fleshy = {times={}, uses=10000, maxlevel=0}
}
}
})
-- minetest.register_tool("bitumen:oil_drum", {
-- description = "55 Gallon Oil Drum",
-- inventory_image = "technic_battery.png",
-- tool_capabilities = {
-- charge = 0,
-- max_drop_level = 0,
-- groupcaps = {
-- fleshy = {times={}, uses=10000, maxlevel=0}
-- }
-- }
-- })

View File

@ -1,11 +1,30 @@
-- a few hacks
minetest.register_craft({
type = 'shapeless',
output = 'bitumen:small_lpg_bottle 1',
recipe = { 'bitumen:lpg_regulator','vessels:steel_bottle' },
output = 'bitumen:bitumen 1',
recipe = { 'bitumen:tar_sand' },
}
})
-- items
minetest.register_craft({
output = 'bitumen:oil_drum 2',
recipe = {
{'default:steel_ingot', 'technic:rubber', 'default:steel_ingot'},
{'default:steel_ingot', '', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
}
})
minetest.register_craft({
output = 'bitumen:lpg_regulator 4',
recipe = {
@ -13,14 +32,21 @@ minetest.register_craft({
{'', 'bitumen:lpg_pipe', 'bitumen:lpg_pipe'},
{'', 'technic:rubber', ''},
}
})
})
minetest.register_craft({
output = 'bitumen:oil_drum 2',
output = 'bitumen:gas_can 2',
recipe = {
{'default:steel_ingot', 'technic:rubber', 'default:steel_ingot'},
{'default:steel_ingot', '', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:reddye', 'homedecor:plastic_sheet', 'default:yellowdye'},
{'homedecor:plastic_sheet', '', 'homedecor:plastic_sheet'},
{'homedecor:plastic_sheet', 'homedecor:plastic_sheet', 'homedecor:plastic_sheet'},
}
})
minetest.register_craft({
type = 'shapeless',
output = 'bitumen:small_lpg_bottle 1',
recipe = { 'bitumen:lpg_regulator','vessels:steel_bottle' },
}
})
@ -32,4 +58,25 @@ minetest.register_craft({
{'default:steel_ingot', '', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
}
})
})
minetest.register_craft({
output = 'bitumen:cracking_boiler',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'pipeworks:steel_pipe', 'technic:lv_electric_furnace', 'pipeworks:steel_pipe'},
{'', 'technic:lv_cable0', ''},
}
})
minetest.register_craft({
output = 'bitumen:cracking_column',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'default:steel_ingot', '', 'pipeworks:steel_pipe'},
{'default:steel_ingot', '', 'default:steel_ingot'},
}
})

View File

@ -1,4 +1,6 @@
local modpath = minetest.get_modpath("bitumen")
bitumen ={}
-- dofile(modpath.."/plastic.lua")
dofile(modpath.."/craftitems.lua")
dofile(modpath.."/containers.lua")

View File

@ -11,51 +11,17 @@ machine defs:
]]
minetest.register_craft({
output = 'bitumen:cracking_boiler',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'pipeworks:steel_pipe', 'technic:lv_electric_furnace', 'pipeworks:steel_pipe'},
{'', 'technic:lv_cable0', ''},
}
})
minetest.register_craft({
output = 'bitumen:cracking_column',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'default:steel_ingot', '', 'pipeworks:steel_pipe'},
{'default:steel_ingot', '', 'default:steel_ingot'},
}
})
-- technic.extractor_recipes ={}
--[[
technic.register_extractor_recipe = function(src, src_count, dst, dst_count)
technic.extractor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count}
if unified_inventory then
unified_inventory.register_craft({
type = "extracting",
output = dst.." "..dst_count,
items = {src.." "..src_count},
width = 0,
})
end
end
-- Receive an ItemStack of result by an ItemStack input
technic.get_extractor_recipe = function(item)
if technic.extractor_recipes[item.name] and
item.count >= technic.extractor_recipes[item.name].src_count then
return technic.extractor_recipes[item.name]
else
return nil
end
end]]
-- 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]"..
@ -63,19 +29,66 @@ local extractor_formspec =
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
--need pipeworks integration
minetest.register_node("bitumen:cracking_column", {
paramtype = "light",
description = "Cracking Column Segment",
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.png"},
paramtype2 = "facedir",
groups = {cracky=2},
tiles = {"default_steel_block.png", "default_steel_block.png", "default_steel_block.png",
"default_steel_block.png", "default_steel_block.png", "default_steel_block.png"},
node_box = {
type = "fixed",
fixed = {
{-0.35, -0.5, -0.35, 0.35, 0.5, 0.35},
{-0.40, -0.5, -0.25, 0.40, 0.5, 0.25},
{-0.25, -0.5, -0.40, 0.25, 0.5, 0.40},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.35, -0.5, -0.35, 0.35, 0.5, 0.35},
{-0.40, -0.5, -0.25, 0.40, 0.5, 0.25},
{-0.25, -0.5, -0.40, 0.25, 0.5, 0.40},
},
},
drawtype = "nodebox",
groups = {cracky=3,oddly_breakable_by_hand=3},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("dst", 1)
end,
})
bitumen.cracking_stack = {
"lube_oil",
"fuel_oil",
"diesel",
"gasoline",
"jet_fuel",
"lpg",
}
local function check_cracking_stack(pos)
local ret = { }
pos.y = pos.y + 1
local height = 1
local n
while minetest.get_node(pos).name == "bitumen:cracking_column" and height < 7 do
ret[bitumen.cracking_stack[height]] = pos
print("Found stack "..bitumen.cracking_stack[height].." at ".. height)
height = height+1
pos.y = pos.y+1
end
return ret
end
minetest.register_node("bitumen:cracking_boiler", {
description = "Cracking Column Boiler",
tiles = {"technic_lv_grinder_top.png", "technic_lv_grinder_bottom.png", "technic_lv_grinder_side.png",
@ -89,13 +102,12 @@ minetest.register_node("bitumen:cracking_boiler", {
meta:set_string("infotext", "Extractor")
meta:set_string("formspec", extractor_formspec)
local inv = meta:get_inventory()
inv:set_size("src", 1)
inv:set_size("dst", 4)
inv:set_size("src", 4)
end,
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
if not inv:is_empty("src") then
minetest.chat_send_player(player:get_player_name(),
"Machine cannot be removed because it is not empty");
return false
@ -127,6 +139,63 @@ minetest.register_node("bitumen:cracking_boiler_active", {
end,
})
bitumen.cracking_yield_rate = {
lpg = 5 ,
jet_fuel = 1 ,
gasoline = 4 ,
diesel = 5,
fuel_oil = 10,
lube_oil = 9,
}
bitumen.energy_density = {
lpg = { 33 },
jet_fuel = { 40 },
gasoline = { 30 },
diesel = { 25 },
fuel_oil = { 18 },
lube_oil = { 12 },
synth_crude = { 10 }
}
--temp hack for dev
minetest.register_abm({
nodenames = {"bitumen:cracking_boiler", "bitumen:cracking_boiler_active"},
interval = 1,
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({
nodenames = {"bitumen:cracking_boiler", "bitumen:cracking_boiler_active"},
interval = 1,
@ -192,15 +261,7 @@ minetest.register_abm({
})
technic.register_machine("LV", "bitumen:cracking_boiler", technic.receiver)
technic.register_machine("LV", "bitumen:cracking_boiler_active", technic.receiver)
technic.register_machine("LV", "bitumen:cracking_boiler_active", technic.receiver)]]
energy_density = {
lpg = { 26 },
jet_fuel = { 31 },
gasoline = { 34 },
diesel = { 37 },
fuel_oil = { 40 },
lube_oil = { 43 },
synth_crude = { 50 }
}

View File

@ -19,10 +19,12 @@ minetest.register_node( "bitumen:tar_sand", {
is_ground_content = true,
groups = {choppy=2},
sounds = default.node_sound_wood_defaults(),
drop = 'craft "bitumen:bitumen" 1',
-- drop = 'craft "bitumen:bitumen" 1',
})
technic.register_extractor_recipe("bitumen:tar_sand", 1, "bitumen:bitumen", 2)
-- upper layer
minetest.register_ore({