diff --git a/abms.lua b/abms.lua index 5b73603..29879fe 100644 --- a/abms.lua +++ b/abms.lua @@ -26,6 +26,7 @@ minetest.register_abm({ -- Controls non-contained fire meta:get_float('fuel_totaltime') * 100) meta:set_string('infotext','Campfire active: '..percent..'%') minetest.swap_node(pos, {name = 'more_fire:campfire'}) + minetest.delete_particlespawner(1) meta:set_string('formspec', 'size[8,6.75]'.. default.gui_bg.. @@ -46,6 +47,7 @@ minetest.register_abm({ -- Controls non-contained fire 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'}) + smoke_particles(pos) local timer = minetest.get_node_timer(pos) meta:set_string('formspec', more_fire.embers_formspec) timer:start(180) @@ -88,6 +90,7 @@ minetest.register_abm({ -- Controls the contained fires. meta:get_float('fuel_totaltime') * 100) meta:set_string('infotext','Campfire active: '..percent..'%') minetest.swap_node(pos, {name = 'more_fire:campfire_contained'}) + minetest.delete_particlespawner(1) meta:set_string('formspec', 'size[8,6.75]'.. default.gui_bg.. @@ -109,6 +112,7 @@ minetest.register_abm({ -- Controls the contained fires. 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) + smoke_particles(pos) local timer = minetest.get_node_timer(pos) timer:start(190) end diff --git a/changelog.txt b/changelog.txt index b772127..4af1b63 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +5-12-15: +Lanterns are here, both wall mounted a table top. Craft with a piece of glass above a string above a lump of iron. Yields one lantern, craft the lantern to change between wall mounted and table top. +Lanterns burn oil, twelve minutes of light for one bottle of oil. Put six leaves above a glass vessel to create lantern oil. + 4-15-15: All fires now die after time. When you create embers either by lighting kindling or crafting directly you have about three minutes to add wood. After the wood all burns up you have three minutes to add more wood or the embers turn back into kindling and need to be activated with a lighter again. diff --git a/crafts.lua b/crafts.lua index 9809fc0..42b98b9 100644 --- a/crafts.lua +++ b/crafts.lua @@ -107,6 +107,14 @@ 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 minetest.register_craft({ type = 'cooking', @@ -114,6 +122,12 @@ minetest.register_craft({ output = 'more_fire:charcoal', }) +minetest.register_craft({ + type = 'cooking', + recipe = 'default:stick', + output = 'more_fire:marker' +}) + -- fuel recipes minetest.register_craft({ type = 'fuel', diff --git a/functions.lua b/functions.lua index d05efeb..0b86c5d 100644 --- a/functions.lua +++ b/functions.lua @@ -1,4 +1,3 @@ - function default.get_hotbar_bg(x,y) local out = '' for i=0,7,1 do @@ -42,3 +41,24 @@ function burn(pointed_thing) --kindling doesn't always start from the first spar else --Do nothing end end + +function smoke_particles(pos) + minetest.add_particlespawner({ + amount = 1, -- how many particles do you want + time = 0, -- spawner stops after this time (use 0 for infinite) + minpos = {x=pos.x, y=pos.y, z=pos.z}, -- minimum offset + maxpos = {x=pos.x, y=pos.y, z=pos.z}, -- maximum offset + minvel = {x=-.1, y=0, z=-.1}, -- minimum velocity + maxvel = {x=.1, y=.4, z=.1}, -- maximum velocity + minacc = {x=-.05, y=.02, z=-.05}, -- minimum acceleration + maxacc = {x=.1, y=.1, z=.1}, -- maximim acceleration + minexptime = 3, -- minimum expiration time + maxexptime = 8, -- maximum expiration time + minsize = 3, -- minimum size (0.5 = half size) + maxsize = 8, -- maximum size (1=full resolution) + collisiondetection = false, -- do particles stop when they hit solid node + texture = 'more_fire_smoke.png', -- image to use (e.g. "bubble.png" ) + vertical = false, -- upright/vertical image for rain +-- playername = "singleplayer", -- particles only appear for this player + }) +end diff --git a/init.lua b/init.lua index 27d3229..5f1c427 100644 --- a/init.lua +++ b/init.lua @@ -7,6 +7,39 @@ default.gui_slots = 'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]' more_fire = {} +--[[local function start_embers(pos) + local this_spawner_meta = minetest.get_meta(pos) + id = minetest.add_particlespawner({ + amount = 1, time = 0, + minpos = { x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4 }, + maxpos = { x = pos.x + 0.4, y = pos.y - 0.4, z = pos.z + 0.4 }, + minvel = { x = 0, y = 0, z = 0 }, + maxvel = { x = 0, y = .3, z = 0 }, + minacc = { x = 0, y = .1, z = 0 }, + maxacc = { x = 0, y = .25, z = 0 }, + minexptime = 3, maxexptime = 5, + size = 8, + collisiondetection = false, + vertical = false, + texture = 'more_fire_embers.png', + }) + this_spawner_meta:set_int(id) + end + +smoke_particles = { + amount = 1, time = 0, + minpos = { x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4 }, + maxpos = { x = pos.x + 0.4, y = pos.y - 0.4, z = pos.z + 0.4 }, + minvel = { x = 0, y = 0, z = 0 }, + maxvel = { x = 0, y = .2, z = 0 }, + minacc = { x = 0, y = .05, z = 0 }, + maxacc = { x = 0, y = .1, z = 0 }, + minexptime = 3, maxexptime = 5, + size = 2, + collisiondetection = false, + vertical = false, + texture = 'more_fire_smoke.png',}--]] + -- formspecs more_fire.embers_formspec = 'size[8,6.75]'.. @@ -20,8 +53,6 @@ default.gui_slots.. 'list[current_player;main;0,4;8,3;8]'.. default.get_hotbar_bg(0,2.75) ---configpath = minetest.get_mod_directory() ..'/config.txt' ---dofile(configpath) dofile(minetest.get_modpath('more_fire')..'/config.txt') dofile(minetest.get_modpath('more_fire')..'/functions.lua') dofile(minetest.get_modpath('more_fire')..'/abms.lua') diff --git a/models/more_fire_mark.obj b/models/more_fire_mark.obj new file mode 100644 index 0000000..f5e4cd7 --- /dev/null +++ b/models/more_fire_mark.obj @@ -0,0 +1,14 @@ +# Blender v2.74 (sub 5) OBJ File: '' +# www.blender.org +o Plane +v -0.500000 -0.479483 0.500000 +v 0.500000 -0.479483 0.500000 +v -0.500000 -0.479483 -0.500000 +v 0.500000 -0.479483 -0.500000 +vt 0.000100 0.000100 +vt 0.999900 0.000100 +vt 0.999900 0.999900 +vt 0.000100 0.999900 +vn 0.000000 1.000000 0.000000 +s off +f 1/1/1 2/2/1 4/3/1 3/4/1 diff --git a/nodes.lua b/nodes.lua index 4f60ab1..8365651 100644 --- a/nodes.lua +++ b/nodes.lua @@ -85,7 +85,8 @@ minetest.register_node('more_fire:torch_stub', { 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}, - sounds = default.node_sound_wood_defaults(),}) + sounds = default.node_sound_wood_defaults(), +}) minetest.register_node('more_fire:charcoal_block', { description = 'Charcoal Block', @@ -107,11 +108,10 @@ minetest.register_node('more_fire:kindling', { paramtype = 'light', selection_box = { type = 'fixed', - fixed = { -0.48, -0.5, -0.48, 0.48, 0.0, 0.48 }, -- Right, Bottom, Back, Left, Top, Front + fixed = { -0.48, -0.5, -0.48, 0.48, 0.0, 0.48 }, }, on_construct = function(pos) local meta = minetest.env:get_meta(pos) --- meta:set_string('formspec', more_fire.embers_formspec) local inv = meta:get_inventory() inv:set_size('fuel', 4) end, @@ -142,6 +142,7 @@ minetest.register_node('more_fire:embers', { local inv = meta:get_inventory() inv:set_size('fuel', 1) timer:start(180) + smoke_particles(pos) end, can_dig = function(pos, player) local meta = minetest.get_meta(pos); @@ -154,6 +155,7 @@ minetest.register_node('more_fire:embers', { on_timer = function(pos, elapsed) local timer = minetest.get_node_timer(pos) timer:stop() + minetest.delete_particlespawner(1) minetest.set_node(pos, {name = 'more_fire:kindling'}) end, after_place_node = function(pos) @@ -258,6 +260,7 @@ minetest.register_node('more_fire:embers_contained', { local inv = meta:get_inventory() inv:set_size('fuel', 4) timer:start(190) + smoke_particles(pos) end, can_dig = function(pos, player) local meta = minetest.get_meta(pos); @@ -270,6 +273,7 @@ minetest.register_node('more_fire:embers_contained', { on_timer = function(pos, elapsed) local timer = minetest.get_node_timer(pos) timer:stop() + minetest.delete_particlespawner(1) minetest.set_node(pos, {name = 'more_fire:kindling_contained'}) end, after_place_node = function(pos) @@ -384,7 +388,7 @@ minetest.register_node('more_fire:oil_lamp_off', { inv:set_size('fuel', 1) meta:set_string('formspec', 'size[8,6]'.. - 'label[2,.75;Add lantern oil for a brighter flame.]' .. + 'label[2,.75;Add lantern oil for a bright flame.]' .. 'list[current_name;fuel;1,.5;1,1]'.. 'list[current_player;main;0,2;8,4;]') meta:set_string('infotext', 'Oil Lantern') @@ -428,7 +432,7 @@ minetest.register_node('more_fire:oil_lamp_table_on', { drop = 'more_fire:oil_lamp_off', selection_box = { type = 'fixed', - fixed = {-.2, -.5, -0.2, 0.2, .25, .2}, -- Right, Bottom, Back, Left, Top, Front + fixed = {-.2, -.5, -0.2, 0.2, .25, .2}, }, on_timer = function(pos, itemstack) local meta = minetest.env:get_meta(pos) @@ -478,7 +482,7 @@ minetest.register_node('more_fire:oil_lamp_table_off', { inv:set_size('fuel', 1) meta:set_string('formspec', 'size[8,6]'.. - 'label[2,.75;Add lantern oil for a brighter flame.]' .. + 'label[2,.75;Add lantern oil for a bright flame.]' .. 'list[current_name;fuel;1,.5;1,1]'.. 'list[current_player;main;0,2;8,4;]') meta:set_string('infotext', 'Oil Lantern') @@ -507,3 +511,19 @@ minetest.register_node('more_fire:oil_lamp_table_off', { return true 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 = '', +}) diff --git a/textures/more_fire_chard_stick.png b/textures/more_fire_chard_stick.png new file mode 100644 index 0000000..427cda9 Binary files /dev/null and b/textures/more_fire_chard_stick.png differ diff --git a/textures/more_fire_embers.png b/textures/more_fire_embers.png new file mode 100644 index 0000000..b425aea Binary files /dev/null and b/textures/more_fire_embers.png differ diff --git a/textures/more_fire_lamp.png b/textures/more_fire_lamp.png index c0d7158..7856dda 100644 Binary files a/textures/more_fire_lamp.png and b/textures/more_fire_lamp.png differ diff --git a/textures/more_fire_mark.png b/textures/more_fire_mark.png new file mode 100644 index 0000000..1cd6a7d Binary files /dev/null and b/textures/more_fire_mark.png differ diff --git a/textures/more_fire_smoke.png b/textures/more_fire_smoke.png new file mode 100644 index 0000000..3094060 Binary files /dev/null and b/textures/more_fire_smoke.png differ diff --git a/tools.lua b/tools.lua index e7eba22..d9292b9 100644 --- a/tools.lua +++ b/tools.lua @@ -9,7 +9,7 @@ minetest.register_tool('more_fire:lighter', { flammable = {uses = 200, maxlevel = 1}, } }, - on_use = function(itemstack, user, pointed_thing, pos) + on_use = function(itemstack, user, pointed_thing) minetest.sound_play("spark", {gain = 1.0, max_hear_distance = 32, loop = false }) if pointed_thing.type == 'node' and string.find(minetest.get_node(pointed_thing.under).name, 'more_fire:kindling') @@ -20,3 +20,17 @@ minetest.register_tool('more_fire:lighter', { end end, }) + +local USES = 20 +minetest.register_tool('more_fire:marker', { + description = 'chard stick', + inventory_image = 'more_fire_chard_stick.png', + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type == 'node' then + minetest.set_node(pointed_thing.above, {name = "more_fire:marking", param2=minetest.dir_to_facedir(user:get_look_dir())}) + itemstack:add_wear(65535 / (USES - 1)) + return itemstack + end + end, +})