12Me21 wrote:How do you use default.generate_ore and minetest.register_ore?
specifically, how do you convert code for default.generate_ore to minetest.register_ore?
http://dev.minetest.net/register_ore
12Me21 wrote:How do you use default.generate_ore and minetest.register_ore?
specifically, how do you convert code for default.generate_ore to minetest.register_ore?
Rui wrote: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:furnace_active"},
interval = 1,
chance = 2,
action = function(pos, node)
local frontpos = vector.subtract(pos, minetest.facedir_to_dir(node.param2))
minetest.add_particlespawner({
amount = 6,
time = 4,
minpos = frontpos,
maxpos = frontpos,
minvel = {x=0, y=0, z=0},
maxvel = {x=0, y=0.6, z=0},
minacc = {x=0,y=0,z=0},
maxacc = {x=0,y=0,z=0},
minexptime = 0.1,
maxexptime = 0.5,
minsize = 2,
maxsize = 2.5,
collisiondetection = false,
vertical = true,
texture = "default_furnace_particle.png"
})
end
})
minetest.register_abm({
nodenames = {"default:furnace_active"},
interval = 1,
chance = 2,
action = function(pos, node)
local frontpos = vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), 0.5))
minetest.add_particlespawner({
amount = 6,
time = 4,
minpos = frontpos,
maxpos = frontpos,
minvel = {x=0, y=0, z=0},
maxvel = {x=0, y=0.6, z=0},
minacc = {x=0,y=0,z=0},
maxacc = {x=0,y=0,z=0},
minexptime = 0.1,
maxexptime = 0.5,
minsize = 2,
maxsize = 2.5,
collisiondetection = false,
vertical = true,
texture = "default_furnace_particle.png"
})
end
})
Rui wrote:@Hybrid Dog
Thank you!
However, would not be able to change the height and horizontal?
minetest.register_abm({
nodenames = {"default:furnace_active"},
interval = 1,
chance = 2,
action = function(pos, node)
local fdir = minetest.facedir_to_dir(node.param2)
local minp = {x=pos.x-fdir.x*0.51, y=pos.y-5/16, z=pos.z-fdir.z*0.51}
local maxp = vector.new(minp)
maxp.y = maxp.y+3/16
if fdir.x == 0 then
minp.x = minp.x-0.4
maxp.x = maxp.x+0.4
elseif fdir.z == 0 then
minp.z = minp.z-0.4
maxp.z = maxp.z+0.4
end
minetest.add_particlespawner({
amount = 6,
time = 4,
minpos = minp,
maxpos = maxp,
minvel = {x=0, y=0, z=0},
maxvel = {x=0, y=0.6, z=0},
minacc = {x=-0.2,y=0,z=-0.2},
maxacc = {x=0.2,y=0,z=0.2},
minexptime = 0.1,
maxexptime = 0.6,
minsize = 1.5,
maxsize = 2.5,
collisiondetection = false,
vertical = true,
texture = "default_furnace_particle.png^[transform"..math.random(0,7)
})
end
})
if itemstack:get_name()== "default:leaves" then
-- Get real name if it is an alias (eg "leaves" -> "default:leaves")
local name = minetest.registered_aliases[itemstack:get_name()]
if not name then
name = itemstack:get_name()]
end
-- Check group
local item = minetest.registered_items[name]
if item and item.groups and item.groups["leaves"] then
-- success
end
rubenwardy wrote:Do this: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
-- Get real name if it is an alias (eg "leaves" -> "default:leaves")
local name = minetest.registered_aliases[itemstack:get_name()]
if not name then
name = itemstack:get_name()]
end
-- Check group
local item = minetest.registered_items[name]
if item and item.groups and item.groups["leaves"] then
-- success
end
Untested. WTFPL or CC0
Rui wrote:By the way, do I should merge this to minetest_game?
Nathan.S wrote:Is there a way to set the length of time required for a cooking recipe? I've looked on the wiki and at the default mod and can't find anything. I want to make a canteen that lets you purify water, but to do that you need to cook it and I want it to take longer than cooking other things.
48inches wrote:What I want to do is make a growing ivy mod, I have an abm that gradually stacks ivy nodes but the ivy node is always in the same rotation. How do I rotate the ivy node so it is against a nearby node or at least in the same rotation as the ivy below it?
O, and hello.
Can I see the code?
minetest.register_abm({
nodenames = {"garden:ivygrow"},
interval = 10,
chance = 4,
action = function(pos, node, active_object_count, active_object_count_wider)
local x = pos.x
local y = pos.y
local z = pos.z
local pos_y = {x=x,y=y+1,z=z}
local pos = {x=x,y=y,z=z}
if minetest.get_node(pos_y).name == "air" then
minetest.set_node(pos_y, {name="garden:ivygrow"})
minetest.set_node(pos, {name="garden:ivy"})
end
end
})
48inches wrote:Can I see the code?
Here's the abm for the ivy.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 = {"garden:ivygrow"},
interval = 10,
chance = 4,
action = function(pos, node, active_object_count, active_object_count_wider)
local x = pos.x
local y = pos.y
local z = pos.z
local pos_y = {x=x,y=y+1,z=z}
local pos = {x=x,y=y,z=z}
if minetest.get_node(pos_y).name == "air" then
minetest.set_node(pos_y, {name="garden:ivygrow"})
minetest.set_node(pos, {name="garden:ivy"})
end
end
})
If you need my attempt at rotating the node, I don't have it I deleted it in frustration. I will post it when I rewrite it.
I am a noob at this so thanks.
minetest.register_abm({
nodenames = {"garden:ivygrow"},
interval = 1,
chance = 1,
action = function(pos, node)
local x = pos.x
local y = pos.y
local z = pos.z
local pos_y = {x=x,y=y+1,z=z}
local node = minetest.get_node(pos)
if minetest.get_node(pos_y).name == "air" then
minetest.set_node(pos_y, {name = "garden:ivygrow", param2=node.param2})
minetest.set_node(pos, {name = "garden:ivy", param2=node.param2})
end
end
})
try this: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 = {"garden:ivygrow"},
interval = 1,
chance = 1,
action = function(pos, node)
local x = pos.x
local y = pos.y
local z = pos.z
local pos_y = {x=x,y=y+1,z=z}
local node = minetest.get_node(pos)
if minetest.get_node(pos_y).name == "air" then
minetest.set_node(pos_y, {name = "garden:ivygrow", param2=node.param2})
minetest.set_node(pos, {name = "garden:ivy", param2=node.param2})
end
end
})
you have to keep the param2 (rotation) of the nodes.
48inches wrote:Can I see the code?
Here's the abm for the ivy.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 = {"garden:ivygrow"},
interval = 10,
chance = 4,
action = function(pos, node, active_object_count, active_object_count_wider)
local x = pos.x
local y = pos.y
local z = pos.z
local pos_y = {x=x,y=y+1,z=z}
local pos = {x=x,y=y,z=z}
if minetest.get_node(pos_y).name == "air" then
minetest.set_node(pos_y, {name="garden:ivygrow"})
minetest.set_node(pos, {name="garden:ivy"})
end
end
})
If you need my attempt at rotating the node, I don't have it I deleted it in frustration. I will post it when I rewrite it.
I am a noob at this so thanks.
minetest.register_abm({
nodenames = {"garden:ivygrow"},
interval = 10,
chance = 4,
action = function(pos, node)
pos.y = pos.y+1
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, node)
pos.y = pos.y-1
node.name = "garden:ivy"
minetest.set_node(pos, node)
end
end
})
self.object:settexturemod('^[brighten')
ryvnf wrote:Hello, I am currently learning the modding API by hacking other peoples mods. I was hacking the Nuke mod written by sfan5 when I came across a strange line that I cannot find much information about.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
self.object:settexturemod('^[brighten')
I know that it makes the texture of the entity brighter but I cannot really figure out how it does that. Can you please explain what it does or point me to some documentation about it? I have been searching for documentation on the web and on this forum but I was not able to find any.
Thank you for your time and attention! :)
Don wrote:ryvnf wrote:Hello, I am currently learning the modding API by hacking other peoples mods. I was hacking the Nuke mod written by sfan5 when I came across a strange line that I cannot find much information about.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
self.object:settexturemod('^[brighten')
I know that it makes the texture of the entity brighter but I cannot really figure out how it does that. Can you please explain what it does or point me to some documentation about it? I have been searching for documentation on the web and on this forum but I was not able to find any.
Thank you for your time and attention! :)
http://dev.minetest.net/texture
Nathan.S wrote:I think this is possible, but I could be wrong.
I want to have a cooking recipe, for oysters and mussels, that when cooked yields meat and shells. I thought I'd seen this done before, but can't remember what mod was doing it, it was giving other objects back, a bucket I think.
Any help would be appreciated.
Users browsing this forum: No registered users and 38 guests