local modName = minetest.get_current_modname()
print(modName)
minetest.register_on_generated( function( minp, maxp, seed)
local modName = minetest.get_current_modname()
print(modName)
end)
minetest.after(0, function()
local t = minetest.registered_on_generateds
for i = 1, #t do
local func = t[i]
t[i] = function(...)
print(minetest.get_current_modname())
return func(...)
end
end
end)
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
minetest.register_node(name,def)
end)
Feelings like I want RTFM minetest source code )Hybrid Dog wrote:Note that the nodedefs use metatable, so to get the real content, you may need to use rawget(t, i).
For example it's particular saw results maked when I need it, instead as in [moreblocks] mod where as I see miniblocks is predefined in *.objtaikedz wrote:What game play mechanic are you trying to achieve?
minetest.registered_nodes["mymod:dynamicnode"].createdyet = true
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)
minetest.register_tool("matblox:air_rod", {
description = "Air Rosin",
inventory_image = "matblox_air_rod.png",
on_use = function(pos, node, clicker)
--local x = 0
--local y = 0
--local z = 0
local final = 10
local target = node
for a=0,final,1 do
for b=0,final,1 do
for c=0,final,1 do
local newnode = minetest.get_node(pos)
if target.name == newnode.name then
minetest.set_node({x = pos.x+a, y = pos.y+b, z = pos.z+c}, {name = "core.CONTENT_AIR "})
end
end
end
end
end
})
PlanetKiller wrote:name = "core.CONTENT_AIR"
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)
on_use = function(itemstack, user, pointed_thing)
print(pointed_thing.name)
end
azekill_DIABLO wrote:"" this what it should be.
rubenwardy wrote:azekill_DIABLO wrote:"" this what it should be.
Nope, "air"
("" is the name of the hand)
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)
minetest.register_node("node:name", {})
minetest.after(0, minetest.register_node, "node:name", {})
PlanetKiller wrote:Thanks, but
2016-09-26 10:50:22: ERROR[Main]: ServerError: Lua: Runtime error from mod 'matblox' in callback item_OnUse(): C++ exception
it didn't solve the problem.
It seems that on_use is not getting the node, and I can't seem to get the node from the position. Tried printing their names, but no luck. Tried on_dig and on_punch without any luck either.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
on_use = function(itemstack, user, pointed_thing)
print(pointed_thing.name)
end
This outputs nil, but I'm pointing at a node.
Icalasari wrote:How exactly would I have minetest.get_node work to ensure a node needs space to spread, or only does a certain action if a certain node is above it? I tried looking into it when looking at the tutorial guide for modding but it doesn't seem to explain anything beyond, "Just use minetest.get_node to stop the destruction"
I guess a specific way to figure it out (as I still want to puzzle out the execution I want to try later on) is, with the alien grass example, how would I used get_node to make it only spread if the blocks it spreads to have air above them?
if minetest.get_node({x = pos.x, y = pos.y+1, z = pos.z}).name == "air" then
minetest.set_node({x = pos.x, y = pos.y+1, z = pos.z}, {name = "alien:grass"})
ManElevation wrote:how do you make a mod topic
PlanetKiller 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
if minetest.get_node({x = pos.x, y = pos.y+1, z = pos.z}).name == "air" then
minetest.set_node({x = pos.x, y = pos.y+1, z = pos.z}, {name = "alien:grass"})
ulla wrote:Hi all and thanks advance , i make my new mod named summer i have put :
big umrella open and closed ,deckshair, lobster, big ballon ,air mattress etc...
now i need a little help for add simple function sit or lay on_rightclick ,
but but I found nothing on internet,
i have see beds but can only sleep, and boat are mixed with driver function , i have registered a node and i want the player can lay on the node with right click pls Help
sorry for my bad english
Users browsing this forum: No registered users and 2 guests