ostly working particles.
This commit is contained in:
parent
8fe13d84cc
commit
b56f40535a
32
abms.lua
32
abms.lua
@ -26,8 +26,6 @@ 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)
|
||||
ember_particles(pos)
|
||||
meta:set_string('formspec',
|
||||
'size[8,6.75]'..
|
||||
default.gui_bg..
|
||||
@ -48,8 +46,6 @@ 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'})
|
||||
minetest.delete_particlespawner(1)
|
||||
smoke_particles(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
meta:set_string('formspec', more_fire.embers_formspec)
|
||||
timer:start(180)
|
||||
@ -92,8 +88,6 @@ 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)
|
||||
ember_particles(pos)
|
||||
meta:set_string('formspec',
|
||||
'size[8,6.75]'..
|
||||
default.gui_bg..
|
||||
@ -115,8 +109,6 @@ 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)
|
||||
minetest.delete_particlespawner(1)
|
||||
smoke_particles(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(190)
|
||||
end
|
||||
@ -129,3 +121,27 @@ minetest.register_abm({ -- Controls the contained fires.
|
||||
inv:set_stack('fuel', 1, stack)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({ --smoke for embers
|
||||
nodenames = {'more_fire:embers', 'more_fire:embers_contained'},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == "air"
|
||||
and minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == "air" then
|
||||
smoke_particles(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({ --embers for fire
|
||||
nodenames = {'more_fire:campfire', 'more_fire:campfire_contained'},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == "air"
|
||||
and minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == "air" then
|
||||
ember_particles(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -45,7 +45,7 @@ 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)
|
||||
time = 2, -- 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
|
||||
@ -53,7 +53,7 @@ function smoke_particles(pos)
|
||||
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
|
||||
maxexptime = 6, -- 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
|
||||
@ -66,15 +66,15 @@ end
|
||||
function ember_particles(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 1,
|
||||
time = 0,
|
||||
time = 2,
|
||||
minpos = {x=pos.x, y=pos.y, z=pos.z},
|
||||
maxpos = {x=pos.x, y=pos.y, z=pos.z},
|
||||
minvel = {x=-.1, y=.2, z=-.1},
|
||||
minvel = {x=-.15, y=.3, z=-.15},
|
||||
maxvel = {x=.1, y=.6, z=.1},
|
||||
minacc = {x=-.05, y=.02, z=-.05},
|
||||
maxacc = {x=.1, y=.25, z=.1},
|
||||
minexptime = 3,
|
||||
maxexptime = 4,
|
||||
maxacc = {x=.1, y=.3, z=.1},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 1,
|
||||
maxsize = 2,
|
||||
collisiondetection = false,
|
||||
|
@ -142,7 +142,6 @@ 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);
|
||||
@ -155,7 +154,6 @@ 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)
|
||||
@ -260,8 +258,6 @@ minetest.register_node('more_fire:embers_contained', {
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('fuel', 4)
|
||||
timer:start(190)
|
||||
minetest.delete_particlespawner(1)
|
||||
smoke_particles(pos)
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
@ -274,7 +270,6 @@ 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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user