burli wrote:Is it possible to make such a leaf shape? It is a normal leaf node with an oversized plantlike inside
D00Med wrote:I already tried just copying dirt with grass using register_on_generated but it was really slow
D00Med wrote:Ok...I should probably learn how then...
Hybrid Dog wrote:Does node metadata become compressed?
minetest.register_node("castle_features:drawbridge_raised", {
description = "Drawbridge Raised",
drawtype = "nodebox",
tiles = {"bridge_timber.png"},
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-2.5, 0.25, 0.25, 2.5, 5.3125, 0.5},
},
},
sounds = default.node_sound_wood_defaults(),
groups = {choppy=2, wood=1,oddly_breakable_by_hand=3,flammable=3},
on_rightclick = function(pos, node, puncher)
minetest.swap_node(pos, {name = "castle_features:drawbridge_lowered", param2 = node.param2})
end,
})
minetest.register_node("castle_features:drawbridge_lowered", {
description = "Drawbridge Lowered",
drawtype = "nodebox",
tiles = {"bridge_timber.png"},
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
node_box = {
type = "fixed",
fixed = {
{-2.5, 0.25, -4.5, 2.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-2.5, 0.25, -4.5, 2.5, 0.5, 0.5},
},
},
groups = {choppy=2,wood=1,oddly_breakable_by_hand=3,flammable=3},
sounds = default.node_sound_wood_defaults(),
on_rightclick = function(pos, node, puncher)
minetest.swap_node(pos, {name = "castle_features:drawbridge_raised", param2 = node.param2})
end,
drop = "castle_features:drawbridge_raised",
})
TumeniNodes wrote:This is the code for a drawbridge I was working on a while back...
Never did figure out why I can't walk it?
burli wrote:Is it possible to make such a leaf shape? It is a normal leaf node with an oversized plantlike inside
sofar wrote:TumeniNodes wrote:This is the code for a drawbridge I was working on a while back...
Never did figure out why I can't walk it?
Add a collision box.
Byakuren wrote:There is a collision box (though only on the lowered bridge), I think Minetest just doesn't detect collisions that far.
kaeza wrote:Byakuren wrote:There is a collision box (though only on the lowered bridge), I think Minetest just doesn't detect collisions that far.
Indeed, Minetest has serious bugs with collision boxes >1 node in size.
Byakuren wrote:sofar wrote:TumeniNodes wrote:This is the code for a drawbridge I was working on a while back...
Never did figure out why I can't walk it?
Add a collision box.
There is a collision box (though only on the lowered bridge), I think Minetest just doesn't detect collisions that far.
sofar wrote:burli wrote:Is it possible to make such a leaf shape? It is a normal leaf node with an oversized plantlike inside
make a mesh node (and yes, this is entirely reasonable geometry)
burli wrote:I'm using the mesh node from the nodebox trees mod. Works fine. I still have a little flicker and waving doesn't work
sofar wrote:A more reliable method would be voxelmanip and do multiple nodes.
Byakuren wrote:There is a collision box (though only on the lowered bridge), I think Minetest just doesn't detect collisions that far.
TumeniNodes wrote:sofar wrote:A more reliable method would be voxelmanip and do multiple nodes.
Hmmm, I have not ventured into using voxelmanip yet. I'd be interested to take a look at it, could you point me in the right direction so I don't have to hunt it down? :P
minetest.register_on_generated(function(minp, maxp)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local data = vm:get_data()
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_glass = minetest.get_content_id("default:glass")
local csize = vector.add(vector.subtract(maxp, minp), 1)
for z = minp.z, maxp.z do
for y = minp.y, maxp.y do
for x = minp.x, maxp.x do
local vi = a:index(x, y, z)
if data[vi] == c_air or data[vi] == c_ignore then
data[vi] = c_glass
end
end
end
end
vm:set_data(data)
vm:write_to_map()
end)
burli wrote:TumeniNodes wrote:sofar wrote:A more reliable method would be voxelmanip and do multiple nodes.
Hmmm, I have not ventured into using voxelmanip yet. I'd be interested to take a look at it, could you point me in the right direction so I don't have to hunt it down? :P
You can take a look at this. It is a simple example that replaces air with glass.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_on_generated(function(minp, maxp)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local data = vm:get_data()
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_glass = minetest.get_content_id("default:glass")
local csize = vector.add(vector.subtract(maxp, minp), 1)
for z = minp.z, maxp.z do
for y = minp.y, maxp.y do
for x = minp.x, maxp.x do
local vi = a:index(x, y, z)
if data[vi] == c_air or data[vi] == c_ignore then
data[vi] = c_glass
end
end
end
end
vm:set_data(data)
vm:write_to_map()
end)
burli wrote:you can also look in trees.lua. The old trees use Voxelmanip. Just look into default.grow_tree()
TumeniNodes wrote:can it be applied to an object which will open and close?
Users browsing this forum: No registered users and 8 guests