Spots wrote:just wondering because i get a little bored when night hits in the game has anyone thought of making like fireflys or something that has a glow to it at night to make night time a little more fun for players, at night i tend to hit caves to mine and farm ores and coal but i'd like to see if you guys have any ideas for it . Thanks !!
minetest.register_abm({
nodenames = {"default:grass_5"},
interval = 5,
chance = 5,
action = function(pos, node)
if ((minetest.env:get_timeofday() < 0.2) or (minetest.env:get_timeofday() > 0.8)) then
node.name = "firefly:grass_5"
minetest.env:add_node(pos, node)
end
end
})
minetest.register_abm({
nodenames = {"firefly:grass_5"},
interval = 5,
chance = 5,
action = function(pos, node)
if ((minetest.env:get_timeofday() > 0.2) and (minetest.env:get_timeofday() < 0.8)) then
node.name = "default:grass_5"
minetest.env:add_node(pos, node)
end
end
})
minetest.register_node("firefly:grass_5", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_5.png"},
inventory_image = "default_grass_5.png",
wield_image = "default_grass_5.png",
paramtype = "light",
walkable = false,
light_source = 10,
buildable_to = true,
is_ground_content = true,
drop = "default:grass_1",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})I could see if I can figure out the code in the bee mod, and maybe change it to fireflies. Emitting light, however, is going to be much more difficult.Casimir wrote:Just had an idea:
Turn grass into grass with fireflies that emits light and spawns firefly-particles. Now I need someone to make the particle spawner, i don't understand how to use them.Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_abm({
nodenames = {"default:grass_5"},
interval = 5,
chance = 5,
action = function(pos, node)
if ((minetest.env:get_timeofday() < 0.2) or (minetest.env:get_timeofday() > 0.8)) then
node.name = "firefly:grass_5"
minetest.env:add_node(pos, node)
end
end
})
minetest.register_abm({
nodenames = {"firefly:grass_5"},
interval = 5,
chance = 5,
action = function(pos, node)
if ((minetest.env:get_timeofday() > 0.2) and (minetest.env:get_timeofday() < 0.8)) then
node.name = "default:grass_5"
minetest.env:add_node(pos, node)
end
end
})
minetest.register_node("firefly:grass_5", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_5.png"},
inventory_image = "default_grass_5.png",
wield_image = "default_grass_5.png",
paramtype = "light",
walkable = false,
light_source = 10,
buildable_to = true,
is_ground_content = true,
drop = "default:grass_1",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
Yes, I was kind of thinking of doing it that way myself.Casimir wrote:The node itself is the one emitting light, that's the trick.
minetest.register_abm({
nodenames = {"firefly:grass_5"},
interval = 0.1,
chance = 3,
action = function(pos, node, _, _)
local p = {x=pos.x, y=pos.y+math.random(), z=pos.z}
minetest.add_particle(p, {x=(math.random()-0.8),y=(math.random()-0.8),z=(math.random()-0.8)}, {x=math.random()-0.5,y=math.random()-0.5,z=math.random()-0.5}, math.random(2,5), math.random(1,1.5), true, "firefly_particle.png")
end,
})
I actually just finished the code, and added a texture. I just have to do a bit of tweaking. Also, you are right about the light being too bright.Casimir wrote:That's what I have now. But the particles move to fast.Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_abm({
nodenames = {"firefly:grass_5"},
interval = 0.1,
chance = 3,
action = function(pos, node, _, _)
local p = {x=pos.x, y=pos.y+math.random(), z=pos.z}
minetest.add_particle(p, {x=(math.random()-0.8),y=(math.random()-0.8),z=(math.random()-0.8)}, {x=math.random()-0.5,y=math.random()-0.5,z=math.random()-0.5}, math.random(2,5), math.random(1,1.5), true, "firefly_particle.png")
end,
})
And there is one major problem: the night is to bright.
Users browsing this forum: No registered users and 2 guests