add a brasier for when a torch is too small
This commit is contained in:
parent
d632111341
commit
94080d8a49
131
brasier.lua
Normal file
131
brasier.lua
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
if not minetest.get_modpath("fire") then return end
|
||||||
|
|
||||||
|
-- internationalization boilerplate
|
||||||
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
local brasier_nodebox = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.25, 0, -0.25, 0.25, 0.125, 0.25}, -- base
|
||||||
|
{-0.375, 0.125, -0.375, 0.375, 0.25, 0.375}, -- mid
|
||||||
|
{-0.5, 0.25, -0.5, 0.5, 0.375, 0.5}, -- plat
|
||||||
|
{-0.5, 0.375, 0.375, 0.5, 0.5, 0.5}, -- edge
|
||||||
|
{-0.5, 0.375, -0.5, 0.5, 0.5, -0.375}, -- edge
|
||||||
|
{0.375, 0.375, -0.375, 0.5, 0.5, 0.375}, -- edge
|
||||||
|
{-0.5, 0.375, -0.375, -0.375, 0.5, 0.375}, -- edge
|
||||||
|
{0.25, -0.5, -0.375, 0.375, 0.125, -0.25}, -- leg
|
||||||
|
{-0.375, -0.5, 0.25, -0.25, 0.125, 0.375}, -- leg
|
||||||
|
{0.25, -0.5, 0.25, 0.375, 0.125, 0.375}, -- leg
|
||||||
|
{-0.375, -0.5, -0.375, -0.25, 0.125, -0.25}, -- leg
|
||||||
|
{-0.125, -0.0625, -0.125, 0.125, 0, 0.125}, -- bottom_knob
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local brasier_burn = function(pos)
|
||||||
|
local inv = minetest.get_inventory({type="node", pos=pos})
|
||||||
|
local item = inv:get_stack("fuel", 1)
|
||||||
|
local fuel_burned = minetest.get_craft_result({method="fuel", width=1, items={item:peek_item(1)}}).time
|
||||||
|
local pos_above = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||||
|
local node_above = minetest.get_node(pos_above)
|
||||||
|
if fuel_burned > 0 then
|
||||||
|
item:set_count(item:get_count() - 1)
|
||||||
|
inv:set_stack("fuel", 1, item)
|
||||||
|
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
timer:start(fuel_burned * 60) -- one minute of flame per second of burn time, for balance.
|
||||||
|
minetest.debug("burned a thing", item:get_name())
|
||||||
|
|
||||||
|
if node_above.name == "air" then
|
||||||
|
minetest.set_node(pos_above, {name = "fire:permanent_flame"})
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if node_above.name == "fire:permanent_flame" then
|
||||||
|
minetest.set_node(pos_above, {name = "air"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("castle_lighting:brasier_floor", {
|
||||||
|
description = S("Brasier"),
|
||||||
|
tiles = {
|
||||||
|
"castle_steel.png^(castle_coal_bed.png^[mask:castle_brasier_bed_mask.png)",
|
||||||
|
"castle_steel.png",
|
||||||
|
"castle_steel.png",
|
||||||
|
"castle_steel.png",
|
||||||
|
"castle_steel.png",
|
||||||
|
"castle_steel.png",
|
||||||
|
},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
groups = {cracky=2},
|
||||||
|
paramtype = "light",
|
||||||
|
node_box = brasier_nodebox,
|
||||||
|
selection_box ={
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.375, -0.5, -0.375, 0.375, 0.25, 0.375}, -- mid
|
||||||
|
{-0.5, 0.25, -0.5, 0.5, 0.5, 0.5}, -- plat
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
on_construct = function(pos)
|
||||||
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
|
inv:set_size("fuel", 1)
|
||||||
|
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec",
|
||||||
|
"size[8,5.3]" ..
|
||||||
|
default.gui_bg ..
|
||||||
|
default.gui_bg_img ..
|
||||||
|
default.gui_slots ..
|
||||||
|
"list[current_name;fuel;3.5,0;1,1;]" ..
|
||||||
|
"list[current_player;main;0,1.15;8,1;]" ..
|
||||||
|
"list[current_player;main;0,2.38;8,3;8]" ..
|
||||||
|
"listring[current_name;main]" ..
|
||||||
|
"listring[current_player;main]" ..
|
||||||
|
default.get_hotbar_bg(0,1.15)
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_destruct = function(pos, oldnode)
|
||||||
|
local pos_above = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||||
|
local node_above = minetest.get_node(pos_above)
|
||||||
|
if node_above.name == "fire:permanent_flame" then
|
||||||
|
minetest.set_node(pos_above, {name = "air"})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
can_dig = function(pos, player)
|
||||||
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
|
return inv:is_empty("fuel")
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- Only allow fuel items to be placed in fuel
|
||||||
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
if listname == "fuel" then
|
||||||
|
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
|
||||||
|
return stack:get_count()
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
brasier_burn(pos)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
brasier_burn(pos)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "castle_lighting:brasier_floor",
|
||||||
|
recipe = {
|
||||||
|
{"default:steel_ingot", "default:torch", "default:steel_ingot"},
|
||||||
|
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||||
|
}
|
||||||
|
})
|
@ -1,2 +1,3 @@
|
|||||||
default
|
default
|
||||||
intllib?
|
intllib?
|
||||||
|
fire?
|
2
init.lua
2
init.lua
@ -8,6 +8,8 @@ minetest.register_alias("castle:chandelier_chain", "castle_lighting:chandelier
|
|||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
dofile(MP.."/brasier.lua")
|
||||||
|
|
||||||
minetest.register_node("castle_lighting:light",{
|
minetest.register_node("castle_lighting:light",{
|
||||||
drawtype = "glasslike",
|
drawtype = "glasslike",
|
||||||
description = S("Light Block"),
|
description = S("Light Block"),
|
||||||
|
@ -8,22 +8,27 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2017-02-25 19:02-0700\n"
|
"POT-Creation-Date: 2017-02-26 15:16-0700\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=CHARSET\n"
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: init.lua:13
|
#: brasier.lua:50
|
||||||
|
msgid "Brasier"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua:15
|
||||||
msgid "Light Block"
|
msgid "Light Block"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua:33
|
#: init.lua:35
|
||||||
msgid "Chandelier"
|
msgid "Chandelier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua:72
|
#: init.lua:74
|
||||||
msgid "Chandelier Chain"
|
msgid "Chandelier Chain"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
BIN
textures/castle_brasier_bed_mask.png
Normal file
BIN
textures/castle_brasier_bed_mask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 497 B |
BIN
textures/castle_coal_bed.png
Normal file
BIN
textures/castle_coal_bed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 762 B |
BIN
textures/castle_steel.png
Normal file
BIN
textures/castle_steel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 214 B |
Loading…
x
Reference in New Issue
Block a user