2019-03-09 11:49:50 +00:00
|
|
|
-- Metal Melter for Minetest 5.0.0+
|
|
|
|
-- Copyright (c) 2019 Evert "Diamond" Prants <evert@lunasqu.ee>
|
2018-04-02 10:39:41 +00:00
|
|
|
|
|
|
|
local modpath = minetest.get_modpath("metal_melter")
|
2018-04-04 17:19:33 +00:00
|
|
|
metal_melter = {}
|
|
|
|
|
2018-04-02 10:39:41 +00:00
|
|
|
-- Crafting components
|
|
|
|
dofile(modpath.."/components.lua")
|
|
|
|
|
2018-07-28 16:15:16 +00:00
|
|
|
-- Fluid bar for formspec
|
|
|
|
function metal_melter.fluid_bar(x, y, fluid_buffer)
|
|
|
|
local texture = "default_water.png"
|
|
|
|
local metric = 0
|
|
|
|
|
|
|
|
if fluid_buffer and fluid_buffer.fluid and fluid_buffer.fluid ~= "" and
|
|
|
|
minetest.registered_nodes[fluid_buffer.fluid] ~= nil then
|
|
|
|
texture = minetest.registered_nodes[fluid_buffer.fluid].tiles[1]
|
|
|
|
if type(texture) == "table" then
|
|
|
|
texture = texture.name
|
|
|
|
end
|
|
|
|
metric = math.floor(100 * fluid_buffer.amount / fluid_buffer.capacity)
|
|
|
|
end
|
|
|
|
|
|
|
|
return "image["..x..","..y..";1,2.8;melter_gui_barbg.png"..
|
|
|
|
"\\^[lowpart\\:"..metric.."\\:"..texture.."\\\\^[resize\\\\:64x128]"..
|
|
|
|
"image["..x..","..y..";1,2.8;melter_gui_gauge.png]"
|
|
|
|
end
|
|
|
|
|
2018-04-02 10:39:41 +00:00
|
|
|
-- Melter
|
|
|
|
dofile(modpath.."/melter.lua")
|
|
|
|
|
|
|
|
-- Caster
|
|
|
|
dofile(modpath.."/caster.lua")
|