local furnace = {}
function furnace.get_furnace_active_formspec(fuel_percent, item_percent)
- return "size[8,8.5]"..
+ return "size[9,8.75]"..
+ "background[-0.19,-0.25;9.41,9.49;gui_hb_bg.png]"..
+ "listcolors[#8b8a89;#c9c3c6;#3e3d3e;#000000;#FFFFFF]"..
"list[context;src;2.75,0.5;1,1;]"..
"list[context;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
"list[context;dst;4.75,0.96;2,2;]"..
- "list[current_player;main;0,4.25;8,1;]"..
- "list[current_player;main;0,5.5;8,3;8]"..
+ "list[current_player;main;0,4.5;9,1;]".. --hotbar
+ "list[current_player;main;0,6;9,3;9]".. --inventory
+
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
"listring[context;fuel]"..
- "listring[current_player;main]"..
- furnace.get_hotbar_bg(0, 4.25)
+ "listring[current_player;main]"
+ --furnace.get_hotbar_bg(0, 4.25)
end
function furnace.get_furnace_inactive_formspec()
- return "size[8,8.5]"..
+ return "size[9,8.75]"..
+ "background[-0.19,-0.25;9.41,9.49;gui_hb_bg.png]"..
+ "listcolors[#8b8a89;#c9c3c6;#3e3d3e;#000000;#FFFFFF]"..
"list[context;src;2.75,0.5;1,1;]"..
"list[context;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[context;dst;4.75,0.96;2,2;]"..
- "list[current_player;main;0,4.25;8,1;]"..
- "list[current_player;main;0,5.5;8,3;8]"..
+ "list[current_player;main;0,4.5;9,1;]"..
+ "list[current_player;main;0,6;9,3;9]"..
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
"listring[context;fuel]"..
- "listring[current_player;main]"..
- furnace.get_hotbar_bg(0, 4.25)
+ "listring[current_player;main]"
+ --furnace.get_hotbar_bg(0, 4.25)
end
--
-- Node callback functions that are the same for active and inactive furnace
--
+--[[
local function can_dig(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src")
end
+]]--
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
- if inv:is_empty("src") then
- meta:set_string("infotext", "Furnace is empty")
- end
+ --if inv:is_empty("src") then
+ -- meta:set_string("infotext", "Furnace is empty")
+ --end
return stack:get_count()
else
return 0
inv:set_stack("src", 1, aftercooked.items[1])
src_time = src_time - cooked.time
update = true
+ local dir = vector.divide(minetest.facedir_to_dir(minetest.get_node(pos).param2),-1.95)
+ local newpos = vector.add(pos,dir)
+ minetest.throw_experience(newpos, 1)
else
dst_full = true
end
end
+ --[[
local infotext
if active then
infotext = ("Furnace active")
infotext = ("Furnace inactive")
end
infotext = infotext .. "\n" .. "Item:"..item_state.. "Fuel:"..fuel_state
-
+ ]]--
--
-- Set meta values
--
meta:set_float("fuel_time", fuel_time)
meta:set_float("src_time", src_time)
meta:set_string("formspec", formspec)
- meta:set_string("infotext", infotext)
+ --meta:set_string("infotext", infotext)
return result
end
+--throw all items in furnace out on destroy
+local function destroy_furnace(pos)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ local lists = inv:get_lists()
+ for listname,_ in pairs(lists) do
+ local size = inv:get_size(listname)
+ for i = 1,size do
+ local stack = inv:get_stack(listname, i)
+ minetest.add_item(pos, stack)
+ end
+ end
+end
--
-- Node definitions
minetest.register_node("utility:furnace", {
description = ("Furnace"),
tiles = {
- "default_furnace_top.png", "default_furnace_bottom.png",
- "default_furnace_side.png", "default_furnace_side.png",
- "default_furnace_side.png", "default_furnace_front.png"
+ "furnace_top.png", "furnace_bottom.png",
+ "furnace_side.png", "furnace_side.png",
+ "furnace_side.png", "furnace_front.png"
},
paramtype2 = "facedir",
- groups = {cracky=2},
+ groups = {stone=2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = main.stoneSound(),
- can_dig = can_dig,
+ --can_dig = can_dig,
on_timer = furnace_node_timer,
end,
on_metadata_inventory_move = function(pos)
- minetest.get_node_timer(pos):start(1.0)
+ local timer = minetest.get_node_timer(pos)
+ if timer:is_started() == false then
+ timer:start(1.0)
+ end
end,
on_metadata_inventory_put = function(pos)
-- start timer function, it will sort out whether furnace can burn or not.
- minetest.get_node_timer(pos):start(1.0)
+ local timer = minetest.get_node_timer(pos)
+ if timer:is_started() == false then
+ timer:start(1.0)
+ end
end,
+ --[[
on_blast = function(pos)
local drops = {}
furnace.get_inventory_drops(pos, "src", drops)
minetest.remove_node(pos)
return drops
end,
-
+ ]]--
+ on_destruct = function(pos)
+ destroy_furnace(pos)
+ end,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
minetest.register_node("utility:furnace_active", {
description = ("Furnace"),
tiles = {
- "default_furnace_top.png", "default_furnace_bottom.png",
- "default_furnace_side.png", "default_furnace_side.png",
- "default_furnace_side.png",
+ "furnace_top.png", "furnace_bottom.png",
+ "furnace_side.png", "furnace_side.png",
+ "furnace_side.png",
{
- image = "default_furnace_front_active.png",
+ image = "furnace_front_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
paramtype2 = "facedir",
light_source = 8,
drop = "utility:furnace",
- groups = {cracky=2, not_in_creative_inventory=1},
+ groups = {stone=2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = main.stoneSound(),
on_timer = furnace_node_timer,
- can_dig = can_dig,
+ --can_dig = can_dig,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
+ on_destruct = function(pos)
+ destroy_furnace(pos)
+ end,
})
minetest.register_craft({
output = "utility:furnace",
recipe = {
- {"group:stone", "group:stone", "group:stone"},
- {"group:stone", "", "group:stone"},
- {"group:stone", "group:stone", "group:stone"},
+ {"main:cobble", "main:cobble", "main:cobble"},
+ {"main:cobble", "", "main:cobble"},
+ {"main:cobble", "main:cobble", "main:cobble"},
}
})