Post your modding questions here
-
- Member
- Posts: 647
- Joined: Thu Feb 21, 2013 23:54
For the most part minetest.register_tool behaves just like minetest.register_node. The differences need to be documented in the wiki, but until then you can look at the lua_api.txt file that comes with the game (and maybe poke around in the builtin/*.lua code a bit too).Evergreen wrote:Can someone fully explain the API for minetest.register_tool? The wiki article isn't complete.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
doc/lua-api.txt is generally the best reference you can find. Its short, precise and complete, since everything is documented there if a new feature is added.
However, some people have trouble in understanding it. Thats where the wiki with the examples is useful. But you should always first look into lua-api.txt
However, some people have trouble in understanding it. Thats where the wiki with the examples is useful. But you should always first look into lua-api.txt
help!! keep getting this error...
but can't find the problem.
Code: Select all
23:30:09: ERROR[main]: ServerError: LuaError: error: ...orwin/.minetest/mods/minetest/geigercounter/init.lua:10: bad argument #1 to 'find_node_near' (userdata expected, got table)
Code: Select all
minetest.register_node("geigercounter:geiger_counter", {
description = "Geiger Counter",
inventory_image = "geigercounter_geigercounter.png",
tiles = {"geigercounter_sides.png"},
wield_image = "geigercounter_geigercounter.png",
drawtype = normal,
groups = {oddly_breakable_by_hand=2},
on_use = function(itemstack, user, pointed_thing)
local pos = user:getpos()
if not minetest.env:find_node_near(pos, 5, "default:nyancat_rainbow") == nil or not minetest.env.find_node_near(pos, 5, "default:nyancat") == nil then
minetest.sound_play("10", {
pos = pos,
max_hear_distance = 10,
gain = 10.0,
})
minetest.chat_send_player("user", "Minetest radiation level 10")
elseif not minetest.env:find_node_near(pos, 10, "default:nyancat_rainbow") == nil or not minetest.env.find_node_near(pos, 10, "default:nyancat") == nil then
minetest.sound_play("9", {
pos = pos,
max_hear_distance = 10,
gain = 10.0,
})
minetest.chat_send_player("user", "Minetest radiation level 9")
elseif not minetest.env:find_node_near(pos, 20, "default:nyancat_rainbow") == nil or not minetest.env.find_node_near(pos, 20, "default:nyancat") == nil then
minetest.sound_play("8", {
pos = pos,
max_hear_distance = 10,
gain = 10.0,
})
minetest.chat_send_player("user", "Minetest radiation level 8")
elseif not minetest.env:find_node_near(pos, 30, "default:nyancat_rainbow") == nil or not minetest.env.find_node_near(pos, 30, "default:nyancat") == nil then
minetest.sound_play("7", {
pos = pos,
max_hear_distance = 10,
gain = 10.0,
})
minetest.chat_send_player("user", "Minetest radiation level 7")
elseif not minetest.env:find_node_near(pos, 40, "default:nyancat_rainbow") == nil or not minetest.env.find_node_near(pos, 40, "default:nyancat") == nil then
minetest.sound_play("6", {
pos = pos,
max_hear_distance = 10,
gain = 10.0,
})
minetest.chat_send_player("user", "Minetest radiation level 6")
elseif not minetest.env:find_node_near(pos, 50, "default:nyancat_rainbow") == nil or not minetest.env.find_node_near(pos, 50, "default:nyancat") == nil or not minetest.env.find_node_near(pos, 5, "default:mese") == nil then
minetest.sound_play("5", {
pos = pos,
max_hear_distance = 10,
gain = 10.0,
})
Last edited by ch98 on Wed Apr 24, 2013 06:36, edited 1 time in total.
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.
- kaeza
- Moderator
- Posts: 2162
- Joined: Thu Oct 18, 2012 05:00
- GitHub: kaeza
- IRC: kaeza diemartin blaaaaargh
- In-game: kaeza
- Location: Montevideo, Uruguay
- Contact:
change:
to:
(note the colon ':' instead of the period '.')
Edit: It happens in line 10 and a bit below.
Code: Select all
minetest.env.find_node_near
Code: Select all
minetest.env:find_node_near
Edit: It happens in line 10 and a bit below.
Last edited by kaeza on Wed Apr 24, 2013 07:23, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!
Check out my stuff! | Donations greatly appreciated! PayPal
Check out my stuff! | Donations greatly appreciated! PayPal
ok. thanks. I only looked at first one so I missed it.kaeza wrote:change:to:Code: Select all
minetest.env.find_node_near
(note the colon ':' instead of the period '.')Code: Select all
minetest.env:find_node_near
Edit: It happens in line 10 and a bit below.
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
https://github.com/minetest/minetest/bl ... .txt#L1549pandaro wrote:Is there a way to automatically rotate an object placed on the ground? In the same way in which a wheel block dropped from the inventory, without using function "on_step".
builtin/item_entity.lua:54
Code: Select all
prop.automatic_rotate = math.pi * 0.25
- Likwid H-Craft
- Member
- Posts: 1113
- Joined: Sun Jan 06, 2013 14:20
- Location: Lost in Crypt
Hey Adam is there a way, to make the Survival Mode Inventory size different like creative mode how it in a the mod area? since I can't find The survival inventory anywhere and I liked change it just for one game mode, since I liked you only can hold 8 things.
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)
http://likwidtest.hj.cx/ (Not Done)
- 12Me21
- Member
- Posts: 873
- Joined: Tue Mar 05, 2013 00:36
- GitHub: 12Me21
- Location: (Ignore all of my posts before 2018)
you can't but you can use nodeboxes to make torches 3D, like the ones in 3d furniturePavel_S wrote:How to replace default torch by model in .x format?
edit, you can add this to the code, don't replace the code for the torches that is already there.
Code: Select all
minetest.register_node(':default:torch', {
description =("Torch"),
drawtype = "nodebox",
tiles = {
{name="default_torch_on_floor_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
selection_box = {
type = "fixed",
fixed = { -1/16, -0.5, -1/16, 1/16, 5/32, 1/16 }
},
node_box = {
type = "fixed",
fixed = { -1/16, -0.5, -1/16, 1/16, 5/32, 1/16 }
},
sunlight_propagates = true,
paramtype = "light",
})
Last edited by 12Me21 on Fri Apr 26, 2013 15:36, edited 1 time in total.
Shoutouts to Simpleflips
- Likwid H-Craft
- Member
- Posts: 1113
- Joined: Sun Jan 06, 2013 14:20
- Location: Lost in Crypt
^Yes if you mean like this.
Just water or just stone or whatever.
Just water or just stone or whatever.
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)
http://likwidtest.hj.cx/ (Not Done)
- Likwid H-Craft
- Member
- Posts: 1113
- Joined: Sun Jan 06, 2013 14:20
- Location: Lost in Crypt
Oh hmm, I think to do at you will need set it 0, 1, 0 Idk if that how get it work since I don't play around the code for ores, size unless I adding new ones.
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)
http://likwidtest.hj.cx/ (Not Done)
- Casimir
- Member
- Posts: 1206
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
Look at the spawn of Minetest-Black.12Me21 wrote:no I mean like only generating one mese block in the entire map
- Casimir
- Member
- Posts: 1206
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
How to check if a node has "on_rightclick"?
Is not working. I guess because the function returns nothing.
Code: Select all
local node = minetest.env:get_node(pointed_thing.under)
if node.on_rightclick ~= nil then
-- something
end
Last edited by Casimir on Mon Apr 29, 2013 19:16, edited 1 time in total.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Casimir wrote:How to check if a node has "on_rightclick"?Is not working. I guess because the function returns nothing.Code: Select all
local node = minetest.env:get_node(pointed_thing.under) if node.on_rightclick ~= nil then -- something end
Code: Select all
if minetest.registered_nodes[node.name].rightclick then
Last edited by PilzAdam on Mon Apr 29, 2013 20:46, edited 1 time in total.
- Casimir
- Member
- Posts: 1206
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
- Likwid H-Craft
- Member
- Posts: 1113
- Joined: Sun Jan 06, 2013 14:20
- Location: Lost in Crypt
Ok I am making somewhat a useful Mod but I don't know if possible do some stuff.
1.Is it possible make a item glow when holding it, like give off light?
2.How do change the light it give off something else? E.g. Blue Green...
Ok it a Official I tell you my mod I am making a Glow Stick It texture and most of it finish but the craft and such...
1.Is it possible make a item glow when holding it, like give off light?
2.How do change the light it give off something else? E.g. Blue Green...
Ok it a Official I tell you my mod I am making a Glow Stick It texture and most of it finish but the craft and such...
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)
http://likwidtest.hj.cx/ (Not Done)
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Neither of your questions is possible.Likwid H-Craft wrote:Ok I am making somewhat a useful Mod but I don't know if possible do some stuff.
1.Is it possible make a item glow when holding it, like give off light?
2.How do change the light it give off something else? E.g. Blue Green...
Ok it a Official I tell you my mod I am making a Glow Stick It texture and most of it finish but the craft and such...
Who is online
Users browsing this forum: No registered users and 6 guests