summaryrefslogtreecommitdiff
path: root/homedecor/handlers/furnaces.lua
diff options
context:
space:
mode:
Diffstat (limited to 'homedecor/handlers/furnaces.lua')
-rw-r--r--homedecor/handlers/furnaces.lua44
1 files changed, 22 insertions, 22 deletions
diff --git a/homedecor/handlers/furnaces.lua b/homedecor/handlers/furnaces.lua
index d436b49..36a7939 100644
--- a/homedecor/handlers/furnaces.lua
+++ b/homedecor/handlers/furnaces.lua
@@ -1,6 +1,6 @@
-- This code supplies an oven/stove. Basically it's just a copy of the default furnace with different textures.
-local S = homedecor.gettext
+local S = homedecor_i18n.gettext
local function swap_node(pos, name)
local node = minetest.get_node(pos)
@@ -88,7 +88,7 @@ function homedecor.register_furnace(name, furnacedef)
furnacedef.cook_speed = furnacedef.cook_speed or 1
- local description = furnacedef.description or "Furnace"
+ local description = furnacedef.description or S("Furnace")
local furnace_construct = function(pos)
local meta = minetest.get_meta(pos)
@@ -106,7 +106,7 @@ function homedecor.register_furnace(name, furnacedef)
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", S("%s is empty"):format(description))
+ meta:set_string("infotext", S("@1 (empty)", description))
end
return stack:get_count()
else
@@ -125,7 +125,7 @@ function homedecor.register_furnace(name, furnacedef)
if to_list == "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", S("%s is empty"):format(description))
+ meta:set_string("infotext", S("@1 (empty)", description))
end
return count
else
@@ -151,7 +151,7 @@ function homedecor.register_furnace(name, furnacedef)
}
local def_active = {
- description = description .. " (active)",
+ description = S("@1 (active)", description),
tiles = make_tiles(furnacedef.tiles_active, furnacedef.tile_format, true),
light_source = 8,
drop = "homedecor:" .. name,
@@ -171,28 +171,28 @@ function homedecor.register_furnace(name, furnacedef)
end
end
- local name_active = name.."_active"
+ local n_active = name.."_active"
homedecor.register(name, def)
- homedecor.register(name_active, def_active)
+ homedecor.register(n_active, def_active)
- local name, name_active = "homedecor:"..name, "homedecor:"..name_active
+ local nname, name_active = "homedecor:"..name, "homedecor:"..n_active
minetest.register_abm({
- nodenames = {name, name_active, name.."_locked", name_active.."_locked"},
+ nodenames = {nname, name_active, nname.."_locked", name_active.."_locked"},
label = "furnaces",
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
- for i, name in ipairs({
+ for i, pname in ipairs({
"fuel_totaltime",
"fuel_time",
"src_totaltime",
"src_time"
}) do
- if meta:get_string(name) == "" then
- meta:set_float(name, 0.0)
+ if meta:get_string(pname) == "" then
+ meta:set_float(pname, 0.0)
end
end
@@ -226,12 +226,12 @@ function homedecor.register_furnace(name, furnacedef)
-- XXX: Quick patch, make it better in the future.
local locked = node.name:find("_locked$") and "_locked" or ""
- local desc = minetest.registered_nodes[name..locked].description
+ local desc = minetest.registered_nodes[nname..locked].description
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
- meta:set_string("infotext",S("%s active: %d%%"):format(desc,percent))
+ meta:set_string("infotext", S("@1 (active: @2%)", desc, percent))
swap_node(pos,name_active..locked)
meta:set_string("formspec", make_formspec(furnacedef, percent))
return
@@ -239,9 +239,9 @@ function homedecor.register_furnace(name, furnacedef)
local fuel = nil
local afterfuel
- local cooked = nil
+ cooked = nil
local fuellist = inv:get_list("fuel")
- local srclist = inv:get_list("src")
+ srclist = inv:get_list("src")
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
@@ -251,24 +251,24 @@ function homedecor.register_furnace(name, furnacedef)
end
if (not fuel) or (fuel.time <= 0) then
- meta:set_string("infotext",desc..S(": Out of fuel"))
- swap_node(pos, name..locked)
+ meta:set_string("infotext", S("@1 (out of fuel)", desc))
+ swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return
end
if cooked.item:is_empty() then
if was_active then
- meta:set_string("infotext",S("%s is empty"):format(desc))
- swap_node(pos, name..locked)
+ meta:set_string("infotext", S("@1 (empty)", desc))
+ swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
end
return
end
if not inv:room_for_item("dst", cooked.item) then
- meta:set_string("infotext", desc..S(": output bins are full"))
- swap_node(pos, name..locked)
+ meta:set_string("infotext", S("@1 (output bins are full)", desc))
+ swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return
end