Primitive Pipeworks support

This commit is contained in:
Evert Prants 2018-04-06 20:53:30 +03:00
parent 9d728b38f6
commit af627a6b41
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
8 changed files with 95 additions and 24 deletions

View File

@ -1,4 +0,0 @@
default
bucket
technic?
moreores?

View File

@ -1 +0,0 @@
Adds Molten versions of commonly occuring metals. Supports default, technic and moreores.

View File

@ -495,16 +495,50 @@ local function on_receive_fields(pos, formname, fields, sender)
end
end
-- Pipeworks integration
local pipeworks = {}
local tube_entry = ""
if minetest.get_modpath("pipeworks") ~= nil then
tube_entry = "^pipeworks_tube_connection_metallic.png"
local function insert_object(pos, node, stack, direction, owner)
local stack_name = stack:get_name()
local inv = minetest.get_meta(pos):get_inventory()
minetest.get_node_timer(pos):start(1.0)
if stack_name == "bucket:bucket_empty" or fluidity.florbs.get_is_empty_florb(stack) then
return inv:add_item("bucket_out", stack)
elseif stack_name == "bucket:bucket_water" then
return inv:add_item("coolant", stack)
elseif stack_name:find(":bucket_") ~= nil or fluidity.florbs.get_is_florb(stack) then
return inv:add_item("bucket_in", stack)
end
return ItemStack(nil)
end
pipeworks = {
connect_sides = {left = 1, right = 1, back = 1, bottom = 1, top = 1},
insert_object = insert_object,
input_inventory = "output",
}
end
-- Register the caster
minetest.register_node("metal_melter:metal_caster", {
description = "Metal Caster",
tiles = {
"melter_side.png", "melter_side.png",
"melter_side.png", "melter_side.png",
"melter_side.png", "caster_front.png"
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,
"melter_side.png"..tube_entry, "caster_front.png"
},
paramtype2 = "facedir",
groups = {cracky=2},
groups = {
cracky=2,
tubedevice = 1,
tubedevice_receiver = 1,
},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
@ -537,6 +571,8 @@ minetest.register_node("metal_melter:metal_caster", {
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
tube = pipeworks,
})
for i,v in pairs(metal_caster.casts) do

View File

@ -155,3 +155,5 @@ minetest.register_craft({
recipe = "metal_melter:heat_gravel",
cooktime = 3,
})
-- Pipeworks

View File

@ -1,4 +0,0 @@
default
bucket
fluidity
unified_inventory?

View File

@ -1 +0,0 @@
Melt and cast metals.

View File

@ -4,7 +4,7 @@
metal_melter.max_fuel = 8000
-- Spec divided by this number is the lava usage.
metal_melter.lava_usage = 4
metal_melter.lava_usage = 9
-- Max metal that can be held by the melter.
metal_melter.max_metal = 16000
@ -402,15 +402,49 @@ local function on_receive_fields(pos, formname, fields, sender)
end
end
-- Pipeworks integration
local pipeworks = {}
local tube_entry = ""
if minetest.get_modpath("pipeworks") ~= nil then
tube_entry = "^pipeworks_tube_connection_metallic.png"
local function insert_object(pos, node, stack, direction, owner)
local stack_name = stack:get_name()
local inv = minetest.get_meta(pos):get_inventory()
minetest.get_node_timer(pos):start(1.0)
if stack_name == "bucket:bucket_empty" or fluidity.florbs.get_is_empty_florb(stack) then
return inv:add_item("bucket_out", stack)
elseif stack_name == "bucket:bucket_lava" then
return inv:add_item("heat", stack)
elseif stack_name:find(":bucket_") ~= nil or fluidity.florbs.get_is_florb(stack) then
return inv:add_item("bucket_in", stack)
else
return inv:add_item("input", stack)
end
end
pipeworks = {
connect_sides = {left = 1, right = 1, back = 1, bottom = 1, top = 1},
insert_object = insert_object,
input_inventory = "bucket_out",
}
end
minetest.register_node("metal_melter:metal_melter", {
description = "Metal Melter",
tiles = {
"melter_side.png", "melter_side.png",
"melter_side.png", "melter_side.png",
"melter_side.png", "melter_front.png"
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,
"melter_side.png"..tube_entry, "melter_front.png"
},
paramtype2 = "facedir",
groups = {cracky=2},
groups = {
cracky = 2,
tubedevice = 1,
tubedevice_receiver = 1,
},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
@ -439,16 +473,23 @@ minetest.register_node("metal_melter:metal_melter", {
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
tube = pipeworks,
})
minetest.register_node("metal_melter:metal_melter_filled", {
tiles = {
"melter_side.png", "melter_side.png",
"melter_side.png", "melter_side.png",
"melter_side.png", "melter_front.png^melter_front_lava.png"
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,
"melter_side.png"..tube_entry, "melter_front.png^melter_front_lava.png"
},
paramtype2 = "facedir",
groups = {cracky=2,not_in_creative_inventory=1},
groups = {
cracky = 2,
tubedevice = 1,
tubedevice_receiver = 1,
not_in_creative_inventory = 1
},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
@ -470,6 +511,8 @@ minetest.register_node("metal_melter:metal_melter_filled", {
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
tube = pipeworks,
})
-- Set a spec

View File

@ -1,4 +1,4 @@
name = metal_melter
description = Melt and cast metals.
depends = default,fluidity,bucket
optional_depends = unified_inventory
optional_depends = pipeworks