Fires now can cook food.
parent
0430efb196
commit
b37bc0de6d
232
abms.lua
232
abms.lua
|
@ -3,61 +3,82 @@ minetest.register_abm({ -- Controls non-contained fire
|
||||||
interval = 1.0,
|
interval = 1.0,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
for i, name in ipairs({
|
|
||||||
'fuel_totaltime',
|
|
||||||
'fuel_time',
|
|
||||||
}) do
|
|
||||||
if meta:get_string(name) == '' then
|
|
||||||
meta:set_float(name, 5.0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
local fuel_time = meta:get_float("fuel_time") or 0
|
||||||
|
local src_time = meta:get_float("src_time") or 0
|
||||||
|
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
local srclist = inv:get_list("src")
|
||||||
|
local cooked = nil
|
||||||
|
if srclist then
|
||||||
|
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||||
|
end
|
||||||
local was_active = false
|
local was_active = false
|
||||||
if meta:get_float('fuel_time') < meta:get_float('fuel_totaltime') then
|
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||||
was_active = true
|
was_active = true
|
||||||
meta:set_float('fuel_time', meta:get_float('fuel_time') + 0.25)
|
meta:set_float("fuel_time", meta:get_float("fuel_time") + 0.25)
|
||||||
end
|
meta:set_float("src_time", meta:get_float("src_time") + 0.25)
|
||||||
if meta:get_float('fuel_time') < meta:get_float('fuel_totaltime') then
|
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
|
||||||
minetest.sound_play({name='fire_small'},{gain=0.07},
|
if inv:room_for_item("dst",cooked.item) then
|
||||||
{loop=true})
|
inv:add_item("dst", cooked.item)
|
||||||
local percent = math.floor(meta:get_float('fuel_time') /
|
local srcstack = inv:get_stack("src", 1)
|
||||||
meta:get_float('fuel_totaltime') * 100)
|
srcstack:take_item()
|
||||||
meta:set_string('infotext','Campfire active: '..percent..'%')
|
inv:set_stack("src", 1, srcstack)
|
||||||
minetest.swap_node(pos, {name = 'more_fire:campfire'})
|
else
|
||||||
meta:set_string('formspec',
|
print("Could not insert '"..cooked.item:to_string().."'")
|
||||||
'size[8,6.75]'..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_slots..
|
|
||||||
'background[5,5;1,1;more_fire_campfire_active.png;true]'..
|
|
||||||
'list[current_name;fuel;1,1.5;1,1;]'..
|
|
||||||
'list[current_player;main;0,2.75;8,1;]'..
|
|
||||||
'list[current_player;main;0,4;8,3;8]')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local fuel = nil
|
|
||||||
local fuellist = inv:get_list('fuel')
|
|
||||||
if fuellist then
|
|
||||||
fuel = minetest.get_craft_result({method = 'fuel', width = 1, items = fuellist})
|
|
||||||
end
|
|
||||||
if fuel.time <= 0 then
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if node.name == 'more_fire:campfire' then
|
|
||||||
meta:set_string('infotext','Put more wood on the fire!')
|
|
||||||
minetest.swap_node(pos, {name = 'more_fire:embers'})
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
|
||||||
meta:set_string('formspec', more_fire.embers_formspec)
|
|
||||||
timer:start(180)
|
|
||||||
end
|
end
|
||||||
|
meta:set_string("src_time", 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||||
|
minetest.sound_play({name="campfire_small"},{pos=pos}, {max_hear_distance = 1},{loop=true},{gain=0.009})
|
||||||
|
local percent = math.floor(meta:get_float("fuel_time") /
|
||||||
|
meta:get_float("fuel_totaltime") * 100)
|
||||||
|
meta:set_string("infotext","Campfire active: "..percent.."%")
|
||||||
|
minetest.swap_node(pos, {name = 'more_fire:campfire'})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
meta:set_string('fuel_totaltime', fuel.time)
|
|
||||||
meta:set_string('fuel_time', 0)
|
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||||
local stack = inv:get_stack('fuel', 1)
|
local cookable = true
|
||||||
|
if cooked.time == 0 then
|
||||||
|
cookable = false
|
||||||
|
end
|
||||||
|
|
||||||
|
local item_state = ''
|
||||||
|
local item_percent = 0
|
||||||
|
if cookable then
|
||||||
|
item_percent = math.floor(src_time / cooked.time * 100)
|
||||||
|
item_state = item_percent .. "%"
|
||||||
|
end
|
||||||
|
|
||||||
|
meta:set_string("formspec", more_fire.fire_formspec(item_percent))
|
||||||
|
|
||||||
|
local fuel = nil
|
||||||
|
local cooked = nil
|
||||||
|
local fuellist = inv:get_list("fuel")
|
||||||
|
local srclist = inv:get_list("src")
|
||||||
|
if srclist then
|
||||||
|
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||||
|
end
|
||||||
|
|
||||||
|
if fuellist then
|
||||||
|
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||||
|
end
|
||||||
|
|
||||||
|
if fuel.time <= 0 then
|
||||||
|
meta:set_string("infotext","The campfire is out.")
|
||||||
|
minetest.swap_node(pos, {name = 'more_fire:embers'})
|
||||||
|
meta:set_string("formspec", more_fire.fire_formspec(item_percent))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
meta:set_string("fuel_totaltime", fuel.time)
|
||||||
|
meta:set_string("fuel_time", 0)
|
||||||
|
local stack = inv:get_stack("fuel", 1)
|
||||||
stack:take_item()
|
stack:take_item()
|
||||||
inv:set_stack('fuel', 1, stack)
|
inv:set_stack("fuel", 1, stack)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({ -- Controls the contained fires.
|
minetest.register_abm({ -- Controls the contained fires.
|
||||||
|
@ -65,63 +86,86 @@ minetest.register_abm({ -- Controls the contained fires.
|
||||||
interval = 1.0,
|
interval = 1.0,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local meta = minetest.env:get_meta(pos)
|
|
||||||
for i, name in ipairs({
|
|
||||||
'fuel_totaltime',
|
|
||||||
'fuel_time',
|
|
||||||
}) do
|
|
||||||
if meta:get_string(name) == '' then
|
|
||||||
meta:set_float(name, 0.0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local fuel_time = meta:get_float("fuel_time") or 0
|
||||||
|
local src_time = meta:get_float("src_time") or 0
|
||||||
|
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
local srclist = inv:get_list("src")
|
||||||
|
local cooked = nil
|
||||||
|
if srclist then
|
||||||
|
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||||
|
end
|
||||||
local was_active = false
|
local was_active = false
|
||||||
if meta:get_float('fuel_time') < meta:get_float('fuel_totaltime') then
|
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||||
was_active = true
|
was_active = true
|
||||||
meta:set_float('fuel_time', meta:get_float('fuel_time') + 0.25)
|
meta:set_float("fuel_time", meta:get_float("fuel_time") + 0.25)
|
||||||
end
|
meta:set_float("src_time", meta:get_float("src_time") + 0.25)
|
||||||
if meta:get_float('fuel_time') < meta:get_float('fuel_totaltime') then
|
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
|
||||||
minetest.sound_play({name='fire_small'},{gain=0.07},
|
if inv:room_for_item("dst",cooked.item) then
|
||||||
{loop=true})
|
inv:add_item("dst", cooked.item)
|
||||||
local percent = math.floor(meta:get_float('fuel_time') /
|
local srcstack = inv:get_stack("src", 1)
|
||||||
meta:get_float('fuel_totaltime') * 100)
|
srcstack:take_item()
|
||||||
meta:set_string('infotext','Campfire active: '..percent..'%')
|
inv:set_stack("src", 1, srcstack)
|
||||||
minetest.swap_node(pos, {name = 'more_fire:campfire_contained'})
|
else
|
||||||
meta:set_string('formspec',
|
print("Could not insert '"..cooked.item:to_string().."'")
|
||||||
'size[8,6.75]'..
|
|
||||||
default.gui_bg..
|
|
||||||
default.gui_slots..
|
|
||||||
'background[5,5;1,1;more_fire_campfire_active.png;true]'..
|
|
||||||
'list[current_name;fuel;1,1.5;1,1;]'..
|
|
||||||
'list[current_player;main;0,2.75;8,1;]'..
|
|
||||||
'list[current_player;main;0,4;8,3;8]')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local fuel = nil
|
|
||||||
local fuellist = inv:get_list('fuel')
|
|
||||||
if fuellist then
|
|
||||||
fuel = minetest.get_craft_result({method = 'fuel', width = 1, items = fuellist})
|
|
||||||
end
|
|
||||||
if fuel.time <= 0 then
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if node.name == 'more_fire:campfire_contained' then
|
|
||||||
meta:set_string('infotext','Put more wood on the fire!')
|
|
||||||
minetest.swap_node(pos, {name = 'more_fire:embers_contained'})
|
|
||||||
meta:set_string('formspec', more_fire.embers_formspec)
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
|
||||||
timer:start(190)
|
|
||||||
end
|
end
|
||||||
|
meta:set_string("src_time", 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||||
|
minetest.sound_play({name="campfire_small"},{pos=pos}, {max_hear_distance = 1},{loop=true},{gain=0.009})
|
||||||
|
local percent = math.floor(meta:get_float("fuel_time") /
|
||||||
|
meta:get_float("fuel_totaltime") * 100)
|
||||||
|
meta:set_string("infotext","Campfire active: "..percent.."%")
|
||||||
|
minetest.swap_node(pos, {name = 'more_fire:campfire_contained'})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
meta:set_string('fuel_totaltime', fuel.time)
|
|
||||||
meta:set_string('fuel_time', 0)
|
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||||
local stack = inv:get_stack('fuel', 1)
|
local cookable = true
|
||||||
|
if cooked.time == 0 then
|
||||||
|
cookable = false
|
||||||
|
end
|
||||||
|
|
||||||
|
local item_state = ''
|
||||||
|
local item_percent = 0
|
||||||
|
if cookable then
|
||||||
|
item_percent = math.floor(src_time / cooked.time * 100)
|
||||||
|
item_state = item_percent .. "%"
|
||||||
|
end
|
||||||
|
|
||||||
|
meta:set_string("formspec", more_fire.fire_formspec(item_percent))
|
||||||
|
|
||||||
|
local fuel = nil
|
||||||
|
local cooked = nil
|
||||||
|
local fuellist = inv:get_list("fuel")
|
||||||
|
local srclist = inv:get_list("src")
|
||||||
|
if srclist then
|
||||||
|
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||||
|
end
|
||||||
|
|
||||||
|
if fuellist then
|
||||||
|
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||||
|
end
|
||||||
|
|
||||||
|
if fuel.time <= 0 then
|
||||||
|
meta:set_string("infotext","The campfire is out.")
|
||||||
|
minetest.swap_node(pos, {name = 'more_fire:embers_contained'})
|
||||||
|
meta:set_string("formspec", more_fire.embers_formspec)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
meta:set_string("fuel_totaltime", fuel.time)
|
||||||
|
meta:set_string("fuel_time", 0)
|
||||||
|
local stack = inv:get_stack("fuel", 1)
|
||||||
stack:take_item()
|
stack:take_item()
|
||||||
inv:set_stack('fuel', 1, stack)
|
inv:set_stack("fuel", 1, stack)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_abm({ --smoke for embers
|
minetest.register_abm({ --smoke for embers
|
||||||
nodenames = {'more_fire:embers', 'more_fire:embers_contained'},
|
nodenames = {'more_fire:embers', 'more_fire:embers_contained'},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
8-26-15:
|
||||||
|
You can finally cook in the fires, there seems to be a little bug yet in the arrow showing the progress of the cooking, but mechanics all seem to work alright.
|
||||||
|
|
||||||
6-3-15:
|
6-3-15:
|
||||||
Campfires and embers now have particles, smoke for the embers, and little sparks for the fires. Also lava now spawns little lava particles, the particles do nothing other than add a little visual effect.
|
Campfires and embers now have particles, smoke for the embers, and little sparks for the fires. Also lava now spawns little lava particles, the particles do nothing other than add a little visual effect.
|
||||||
|
|
||||||
|
|
|
@ -18,3 +18,15 @@ minetest.register_craftitem('more_fire:oil', {
|
||||||
description = 'lantern oil',
|
description = 'lantern oil',
|
||||||
inventory_image = 'more_fire_oil.png',
|
inventory_image = 'more_fire_oil.png',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem('more_fire:dried_grass', {
|
||||||
|
description = 'dried grass',
|
||||||
|
inventory_image = 'more_fire_grass_dried.png',
|
||||||
|
groups = {kindling=1}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem('more_fire:kindle', {
|
||||||
|
description = 'Kindling',
|
||||||
|
inventory_image = 'more_fire_kindle.png',
|
||||||
|
groups = {flammable=1, kindling=1, stick=1}
|
||||||
|
})
|
||||||
|
|
31
crafts.lua
31
crafts.lua
|
@ -25,8 +25,7 @@ minetest.register_craft({
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'more_fire:embers 1',
|
output = 'more_fire:embers 1',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'', '', ''},
|
{'group:kindling', 'default:torch', 'group:kindling'},
|
||||||
{'default:stick', 'default:torch', 'default:stick'},
|
|
||||||
{'group:wood', 'group:wood', 'group:wood'},
|
{'group:wood', 'group:wood', 'group:wood'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -48,17 +47,24 @@ minetest.register_craft({
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'default:torch 4',
|
output = 'more_fire:torch_weak 4',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'more_fire:charcoal'},
|
{'group:kindling', 'group:kindling', 'group:kindling'},
|
||||||
{'group:stick'},
|
{'group:kindling', 'group:stick', 'group:kindling'},
|
||||||
|
{'', 'group:stick', ''}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = 'shapeless',
|
||||||
|
output = 'default:torch',
|
||||||
|
recipe = {'more_fire:torch_weak', 'group:coal'},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = 'shapeless',
|
type = 'shapeless',
|
||||||
output = 'more_fire:kindling 1',
|
output = 'more_fire:kindling 1',
|
||||||
recipe = {'group:stick', 'group:wood', 'group:flammable', 'group:flammable'},
|
recipe = {'group:kindling', 'group:wood', 'group:kindling', 'group:kindling', 'group:kindling'},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -107,14 +113,6 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'more_fire:marker 1',
|
|
||||||
recipe = {
|
|
||||||
{'more_fire:torch_stub', 'more_fire:torch_stub', 'more_fire:torch_stub'}
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- cooking recipes
|
-- cooking recipes
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = 'cooking',
|
type = 'cooking',
|
||||||
|
@ -124,8 +122,9 @@ minetest.register_craft({
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = 'cooking',
|
type = 'cooking',
|
||||||
recipe = 'default:stick',
|
recipe = 'default:grass_1',
|
||||||
output = 'more_fire:marker'
|
output = 'more_fire:dried_grass',
|
||||||
|
cooktime = 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- fuel recipes
|
-- fuel recipes
|
||||||
|
|
|
@ -6,28 +6,25 @@ function default.get_hotbar_bg(x,y)
|
||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
|
|
||||||
function more_fire.campfire(pos, percent, item_percent)
|
function more_fire.fire_formspec(item_percent)
|
||||||
local formspec =
|
local formspec =
|
||||||
'size[8,6.75]'..
|
'size[8,6.75]'..
|
||||||
default.gui_bg..
|
default.gui_slots..
|
||||||
default.gui_bg_img..
|
'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'..
|
||||||
default.gui_slots..
|
'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'..
|
||||||
'background[5,5;1,1;more_fire_campfire_active.png;true]'..
|
'label[2,.75;< Add More Wood]'..
|
||||||
'list[current_name;fuel;1,1.5;1,1;]'..
|
'label[1.25,2; Cook Something >]'..
|
||||||
'list[current_player;main;0,2.75;8,1;]'..
|
'list[current_name;fuel;1,.5;1,1;]'..
|
||||||
'list[current_player;main;0,4;8,3;8]'..
|
'list[current_name;src;4,1.75;1,1;]'..
|
||||||
default.get_hotbar_bg(0,2.75)
|
'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[lowpart:'..
|
||||||
|
(item_percent)..':gui_furnace_arrow_fg.png^[transformR270]'..
|
||||||
|
'list[current_name;dst;6,1.75;2,1;]'..
|
||||||
|
'list[current_player;main;0,2.75;8,1;]'..
|
||||||
|
'list[current_player;main;0,4;8,3;8]'..
|
||||||
|
default.get_hotbar_bg(0,2.75)
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
function more_fire.get_campfire_formspec(pos, percent)
|
|
||||||
local meta = minetest.get_meta(pos)local inv = meta:get_inventory()
|
|
||||||
local fuellist = inv:get_list('fuel')
|
|
||||||
if fuellist then
|
|
||||||
end
|
|
||||||
return more_fire.campfire(pos, percent, item_percent)
|
|
||||||
end
|
|
||||||
|
|
||||||
function burn(pointed_thing) --kindling doesn't always start from the first spark
|
function burn(pointed_thing) --kindling doesn't always start from the first spark
|
||||||
local ignite_chance = math.random(5)
|
local ignite_chance = math.random(5)
|
||||||
if ignite_chance == 1
|
if ignite_chance == 1
|
||||||
|
|
11
init.lua
11
init.lua
|
@ -10,12 +10,15 @@ more_fire = {}
|
||||||
-- formspecs
|
-- formspecs
|
||||||
more_fire.embers_formspec =
|
more_fire.embers_formspec =
|
||||||
'size[8,6.75]'..
|
'size[8,6.75]'..
|
||||||
default.gui_bg..
|
|
||||||
default.gui_bg_img..
|
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'..
|
'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'..
|
||||||
'background[5,5;1,1;more_fire_campfire_inactive.png;true]'..
|
'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'..
|
||||||
'list[current_name;fuel;1,1.5;1,1;]'..
|
'label[2,.75;< Add More Wood]'..
|
||||||
|
'label[1.25,2; Cook Something >]'..
|
||||||
|
'list[current_name;fuel;1,.5;1,1;]'..
|
||||||
|
'list[current_name;src;4,1.75;1,1;]'..
|
||||||
|
'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270]'..
|
||||||
|
'list[current_name;dst;6,1.75;2,1;]'..
|
||||||
'list[current_player;main;0,2.75;8,1;]'..
|
'list[current_player;main;0,2.75;8,1;]'..
|
||||||
'list[current_player;main;0,4;8,3;8]'..
|
'list[current_player;main;0,4;8,3;8]'..
|
||||||
default.get_hotbar_bg(0,2.75)
|
default.get_hotbar_bg(0,2.75)
|
||||||
|
|
121
nodes.lua
121
nodes.lua
|
@ -41,7 +41,7 @@ minetest.register_node(':default:torch', {
|
||||||
wall_bottom = {-0.1, -0.5 , -0.1, 0.1, 0.0625, 0.1},
|
wall_bottom = {-0.1, -0.5 , -0.1, 0.1, 0.0625, 0.1},
|
||||||
wall_side = {-0.35, -0.5 , -0.1, -0.5, 0.0625, 0.1},
|
wall_side = {-0.35, -0.5 , -0.1, -0.5, 0.0625, 0.1},
|
||||||
},
|
},
|
||||||
groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, hot = 2},
|
groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, hot = 2, kindling=1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if finite_torches == true then
|
if finite_torches == true then
|
||||||
|
@ -57,6 +57,50 @@ minetest.register_node(':default:torch', {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node('more_fire:torch_weak', {
|
||||||
|
description = 'Weak Torch',
|
||||||
|
drawtype = 'nodebox',
|
||||||
|
tiles = {
|
||||||
|
{name = 'more_fire_torch_top.png'},
|
||||||
|
{name = 'more_fire_torch_bottom.png'},
|
||||||
|
{name = 'more_fire_torch_side.png'},
|
||||||
|
},
|
||||||
|
inventory_image = 'more_fire_torch_inv.png',
|
||||||
|
wield_image = 'more_fire_torch_inv.png',
|
||||||
|
paramtype = 'light',
|
||||||
|
paramtype2 = 'wallmounted',
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = false,
|
||||||
|
light_source = LIGHT_MAX - 6,
|
||||||
|
node_box = {
|
||||||
|
type = 'wallmounted',
|
||||||
|
wall_top = {-0.0625, -0.0625, -0.0625, 0.0625, 0.5 , 0.0625},
|
||||||
|
wall_bottom = {-0.0625, -0.5 , -0.0625, 0.0625, 0.0625, 0.0625},
|
||||||
|
wall_side = {-0.5 , -0.5 , -0.0625, -0.375, 0.0625, 0.0625},
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = 'wallmounted',
|
||||||
|
wall_top = {-0.1, -0.05, -0.1, 0.1, 0.5 , 0.1},
|
||||||
|
wall_bottom = {-0.1, -0.5 , -0.1, 0.1, 0.0625, 0.1},
|
||||||
|
wall_side = {-0.35, -0.5 , -0.1, -0.5, 0.0625, 0.1},
|
||||||
|
},
|
||||||
|
groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, hot = 2, kindling=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
on_construct = function(pos)
|
||||||
|
if finite_torches == true then
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
timer:start(480)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
minetest.swap_node(pos, {name = 'more_fire:torch_stub', param2 = node.param2})
|
||||||
|
timer:stop()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node('more_fire:torch_stub', {
|
minetest.register_node('more_fire:torch_stub', {
|
||||||
description = 'burnt out torch',
|
description = 'burnt out torch',
|
||||||
drawtype = 'nodebox',
|
drawtype = 'nodebox',
|
||||||
|
@ -84,7 +128,7 @@ minetest.register_node('more_fire:torch_stub', {
|
||||||
wall_bottom = {-0.1, -0.5 , -0.1, 0.1, -0.2, 0.1},
|
wall_bottom = {-0.1, -0.5 , -0.1, 0.1, -0.2, 0.1},
|
||||||
wall_side = {-0.35, -0.5 , -0.1, -0.5, -0.2, 0.1},
|
wall_side = {-0.35, -0.5 , -0.1, -0.5, -0.2, 0.1},
|
||||||
},
|
},
|
||||||
groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, not_in_creative_inventory =1},
|
groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, not_in_creative_inventory = 1, kindling=1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -113,7 +157,9 @@ minetest.register_node('more_fire:kindling', {
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size('fuel', 4)
|
inv:set_size('fuel', 1)
|
||||||
|
inv:set_size("src", 1)
|
||||||
|
inv:set_size("dst", 2)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -141,12 +187,18 @@ minetest.register_node('more_fire:embers', {
|
||||||
meta:set_string('infotext', 'Campfire');
|
meta:set_string('infotext', 'Campfire');
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size('fuel', 1)
|
inv:set_size('fuel', 1)
|
||||||
|
inv:set_size("src", 1)
|
||||||
|
inv:set_size("dst", 2)
|
||||||
timer:start(180)
|
timer:start(180)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos, player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty('fuel') then
|
if not inv:is_empty("fuel") then
|
||||||
|
return false
|
||||||
|
elseif not inv:is_empty("dst") then
|
||||||
|
return false
|
||||||
|
elseif not inv:is_empty("src") then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
@ -186,19 +238,24 @@ minetest.register_node('more_fire:campfire', {
|
||||||
damage_per_second = 1,
|
damage_per_second = 1,
|
||||||
light_source = 14,
|
light_source = 14,
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
|
drop = 'more_fire:charcoal',
|
||||||
groups = {cracky=2,hot=2,attached_node=1,igniter=1,not_in_creative_inventory=1},
|
groups = {cracky=2,hot=2,attached_node=1,igniter=1,not_in_creative_inventory=1},
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = 'fixed',
|
type = 'fixed',
|
||||||
fixed = { -0.48, -0.5, -0.48, 0.48, 0.0, 0.48 },
|
fixed = { -0.48, -0.5, -0.48, 0.48, 0.0, 0.48 },
|
||||||
},
|
},
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.env:get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty('fuel') then
|
if not inv:is_empty("fuel") then
|
||||||
return false
|
return false
|
||||||
end
|
elseif not inv:is_empty("dst") then
|
||||||
|
return false
|
||||||
|
elseif not inv:is_empty("src") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
get_staticdata = function(self)
|
get_staticdata = function(self)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -222,11 +279,17 @@ minetest.register_node('more_fire:kindling_contained', {
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size('fuel', 4)
|
inv:set_size('fuel', 4)
|
||||||
|
inv:set_size("src", 1)
|
||||||
|
inv:set_size("dst", 2)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos, player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty('fuel') then
|
if not inv:is_empty("fuel") then
|
||||||
|
return false
|
||||||
|
elseif not inv:is_empty("dst") then
|
||||||
|
return false
|
||||||
|
elseif not inv:is_empty("src") then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
@ -257,13 +320,18 @@ minetest.register_node('more_fire:embers_contained', {
|
||||||
meta:set_string('infotext', 'Campfire');
|
meta:set_string('infotext', 'Campfire');
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size('fuel', 4)
|
inv:set_size('fuel', 4)
|
||||||
|
inv:set_size("src", 1)
|
||||||
|
inv:set_size("dst", 2)
|
||||||
timer:start(190)
|
timer:start(190)
|
||||||
print 'called the on_construct function.'
|
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos, player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty('fuel') then
|
if not inv:is_empty("fuel") then
|
||||||
|
return false
|
||||||
|
elseif not inv:is_empty("dst") then
|
||||||
|
return false
|
||||||
|
elseif not inv:is_empty("src") then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
@ -309,14 +377,18 @@ minetest.register_node('more_fire:campfire_contained', {
|
||||||
type = 'fixed',
|
type = 'fixed',
|
||||||
fixed = { -0.48, -0.5, -0.48, 0.48, 0.0, 0.48 },
|
fixed = { -0.48, -0.5, -0.48, 0.48, 0.0, 0.48 },
|
||||||
},
|
},
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.env:get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty('fuel') then
|
if not inv:is_empty("fuel") then
|
||||||
return false
|
return false
|
||||||
end
|
elseif not inv:is_empty("dst") then
|
||||||
|
return false
|
||||||
|
elseif not inv:is_empty("src") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
get_staticdata = function(self)
|
get_staticdata = function(self)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -509,18 +581,3 @@ minetest.register_node('more_fire:oil_lamp_table_off', {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node('more_fire:marking', {
|
|
||||||
description = 'Nathan is really cool ;)',
|
|
||||||
paramtype = 'light',
|
|
||||||
paramtype2 = 'facedir',
|
|
||||||
tiles = {'more_fire_mark.png'},
|
|
||||||
drawtype = 'mesh',
|
|
||||||
mesh = 'more_fire_mark.obj',
|
|
||||||
selection_box = {
|
|
||||||
type = 'fixed',
|
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}, -- Right, Bottom, Back, Left, Top, Front
|
|
||||||
},
|
|
||||||
walkable = false,
|
|
||||||
groups = {choppy = 2, dig_immediate = 3, attached_node = 1, not_in_creative_inventory=1},
|
|
||||||
drop = '',
|
|
||||||
})
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 354 KiB |
Binary file not shown.
After Width: | Height: | Size: 382 KiB |
Binary file not shown.
Before Width: | Height: | Size: 357 KiB |
Loading…
Reference in New Issue