Post your modding questions here

Locked
User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

minetest.register_entity()

User avatar
prestidigitator
Member
Posts: 640
Joined: Thu Feb 21, 2013 23:54

by prestidigitator » Post

Evergreen wrote:Can someone fully explain the API for minetest.register_tool? The wiki article isn't complete.
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).

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

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

ch98
Member
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Post

help!! keep getting this error...

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)
but can't find the problem.

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.

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

change:

Code: Select all

minetest.env.find_node_near
to:

Code: Select all

minetest.env:find_node_near
(note the colon ':' instead of the period '.')

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

ch98
Member
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Post

kaeza wrote:change:

Code: Select all

minetest.env.find_node_near
to:

Code: Select all

minetest.env:find_node_near
(note the colon ':' instead of the period '.')

Edit: It happens in line 10 and a bit below.
ok. thanks. I only looked at first one so I missed it.
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.

User avatar
Franz
New member
Posts: 3
Joined: Tue Apr 23, 2013 11:43

by Franz » Post

Can anyone make a treeassist mod?
describtion: when you chop down a woodblock from a tree it will kill the complete tree and you get his items.

is it possible? :D

User avatar
Franz
New member
Posts: 3
Joined: Tue Apr 23, 2013 11:43

by Franz » Post

k. lemme check it out!

User avatar
Pavel_S
Member
Posts: 131
Joined: Sat Apr 06, 2013 11:43

by Pavel_S » Post

How to replace default torch by model in .x format?

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

Pavel_S wrote:How to replace default torch by model in .x format?
There is currently no drawtype for nodes to use a mesh. RealBadAngel is working on it.

User avatar
pandaro
Member
Posts: 323
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro
Location: behind

by pandaro » Post

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".
sorry for bad english
Linux debian 7 wheezy 64
kde

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

pandaro 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".
https://github.com/minetest/minetest/bl ... .txt#L1549
builtin/item_entity.lua:54

Code: Select all

prop.automatic_rotate = math.pi * 0.25

User avatar
pandaro
Member
Posts: 323
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro
Location: behind

by pandaro » Post

thanks Adam, I wrote only:

automatic_rotate = true,

now it work!
sorry for bad english
Linux debian 7 wheezy 64
kde

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

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)

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

by 12Me21 » Post

12Me21 wrote:Is it possible to only have one of a certain type of node generate in the entire map?
Shoutouts to Simpleflips

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

by 12Me21 » Post

Pavel_S wrote:How to replace default torch by model in .x format?
you can't but you can use nodeboxes to make torches 3D, like the ones in 3d furniture

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

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

^Yes if you mean like this.

Just water or just stone or whatever.
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

by 12Me21 » Post

Likwid H-Craft wrote:^Yes if you mean like this.

Just water or just stone or whatever.
no I mean like only generating one mese block in the entire map
Shoutouts to Simpleflips

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

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)

User avatar
Casimir
Member
Posts: 1189
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

12Me21 wrote:no I mean like only generating one mese block in the entire map
Look at the spawn of Minetest-Black.

User avatar
Casimir
Member
Posts: 1189
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

How to check if a node has "on_rightclick"?

Code: Select all

local node = minetest.env:get_node(pointed_thing.under)
if node.on_rightclick ~= nil then
    -- something
end
Is not working. I guess because the function returns nothing.
Last edited by Casimir on Mon Apr 29, 2013 19:16, edited 1 time in total.

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

Casimir wrote:How to check if a node has "on_rightclick"?

Code: Select all

local node = minetest.env:get_node(pointed_thing.under)
if node.on_rightclick ~= nil then
    -- something
end
Is not working. I guess because the function returns nothing.

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.

User avatar
Casimir
Member
Posts: 1189
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

Thank you. Works perfect.

User avatar
Likwid H-Craft
Member
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Post

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...
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

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...
Neither of your questions is possible.

Locked

Who is online

Users browsing this forum: No registered users and 2 guests