Post your modding questions here

Locked
User avatar
benedict424
Member
Posts: 29
Joined: Thu Oct 02, 2014 06:24
IRC: oswald
In-game: oswaldTechnic

Re: Post your modding questions here

by benedict424 » Post

philipbenr wrote:Look at magpen.lua in default. It uses minetest.register_ore function. That one works really well.
I've just seen that. Thanks.
Terra, Aqua, Ignus, Air, Ather, and Incognitus.

User avatar
Hybrid Dog
Member
Posts: 2774
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Ore Spawning

by Hybrid Dog » Post

benedict424 wrote:Question: How do I make an ore that spawns in the world?
There's a page about generating ores in minetest.
http://dev.minetest.net/minetest.register_ore

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
Hybrid Dog
Member
Posts: 2774
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: 2 drops

by Hybrid Dog » Post

benedict424 wrote:How do I get a node, or and ore, to drop multiple things?
https://github.com/minetest/minetest_ga ... s.lua#L328

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
RHR
Member
Posts: 215
Joined: Mon Jan 27, 2014 20:07
GitHub: RHRhino

light-emitting entities

by RHR » Post

Is there any way to create light-emitting entities?

User avatar
Krock
Developer
Posts: 4577
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: light-emitting entities

by Krock » Post

RHR wrote:Is there any way to create light-emitting entities?
Nope.
*looks with big eyes on this idea* (idea with attached entities to make torches emitting light while holding in the hand)
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
rubberduck
Member
Posts: 507
Joined: Thu Feb 27, 2014 19:19
IRC: rbduck
In-game: rubberduck
Location: error 404 - location not found
Contact:

Re: Post your modding questions here

by rubberduck » Post

is there a way to add a recipe for the technic grinder in my mod????, something like using type = "grinding", or do i have to add something in the technic modpack???

i found a function in the technic-modpack, but that does not work in my mod:

Code: Select all

technic.register_grinder_recipe({ input, output })
My game (not minetest): http://forum.freegamedev.net/viewtopic.php?f=22&t=6800

my mods: gold_and_gem, meseconductors

a penguin throws an apple through a window

sometimes i change my "forum location" via user control panel

User avatar
Hybrid Dog
Member
Posts: 2774
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

RHR wrote:Is there any way to create light-emitting entities?
of course, yes, but you would need to change the source code and so it only works on singleplayer mode
if you want to make light at the position of an object, just set an invisible airlike light source node there, I think the flashlight of technic does this
it may also work if you change param1 of the nodes with voxelmanip, I should test it
rubberduck wrote:is there a way to add a recipe for the technic grinder in my mod????, something like using type = "grinding", or do i have to add something in the technic modpack???

i found a function in the technic-modpack, but that does not work in my mod:

Code: Select all

technic.register_grinder_recipe({ input, output })
you need to add technic (or technic?) to depends.txt and then register the recipe:
https://github.com/minetest-technic/tec ... es.lua#L47
e.g.
technic.register_grinder_recipe({input = {"default:mese"}, output = "default:cobble"})

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
Linuxdirk
Member
Posts: 2712
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Post your modding questions here

by Linuxdirk » Post

Hey there.

Since this question didn’t get any replys but only a few upvotes on Reddit I ask it here, too :)

For a mod I’m trying to get an optional setting value from minetest.conf. If the value is not set there should be a given default value being used instead. (And I don’t want to declare, trying to set, test for nil and set another value manually every time for every variable I want to use.)

Since I didn’t found anything in the developer wiki I created the following function doing exactly what I described.

Code: Select all

local function getValid(value, default)
    v = minetest.setting_get(value)
    return (v == nil and default or v)
end
When invoked like getValid('my_value', 'foo') the function tries to get my_value from minetest.conf. If available it returns the value of my_value. If my_value is missing in minetest.conf it returns “foo” instead.

But since a built-in function is always better than a custom function: Is there a way to do the exact same without creating a function for it?

Thanks in advance,
Dirk

User avatar
Landrover110
Member
Posts: 19
Joined: Mon Jan 13, 2014 09:38
In-game: Landrover
Location: South luangwa , Zambia

Re: Post your modding questions here

by Landrover110 » Post

Hey
is it possible to put out fire in your mod like if i had particals and they touched fire they would set it out ,thanks in advance

Landrover

tfranko
Member
Posts: 13
Joined: Mon Oct 06, 2014 22:34

Re: Post your modding questions here

by tfranko » Post

How do I get the name of the player running a command? I'm registering a chat command that needs to use the name of the player that's running that command.

When I try to use player:get_player_name() it's apparently returning "a nil value".

I've seen function(player) in a bunch of forum posts and other mods, but I'm not sure how to use that.

Here's some code I'm working with:

Code: Select all

local player_name = player:get_player_name()

minetest.chat_send_player(player_name, 'hello')
So, basically, I just want to point a variable to the player name so I can use it elsewhere. Thanks.

tfranko
Member
Posts: 13
Joined: Mon Oct 06, 2014 22:34

Re: Post your modding questions here

by tfranko » Post

tfranko wrote:How do I get the name of the player running a command? I'm registering a chat command that needs to use the name of the player that's running that command.
<snip>
I figured it out. I had to do the following:

Code: Select all

function name_of_my_function(name)
    ...
    minetest.chat_send_player(name, 'hello')
end
Is there documentation somewhere about why this works?

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:

Re: Post your modding questions here

by kaeza » Post

That's probably because `player` is nil at that point in the script, and you are calling the method `get_player_name` on a nil value (in simple terms, you are trying to get the player name of nothing at all).

If you register a chat command, the function you register as callback will get passed the name of the player directly, so use that.

Example:

Code: Select all

minetest.register_chatcommand("foo", {
  description = "bar",
  params = "",
  func = function(name, params)
    minetest.chat_send_player(name, "Hello, "..name.."!")
  end,
})
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

tfranko
Member
Posts: 13
Joined: Mon Oct 06, 2014 22:34

Re: Post your modding questions here

by tfranko » Post

kaeza wrote:That's probably because `player` is nil at that point in the script, and you are calling the method `get_player_name` on a nil value (in simple terms, you are trying to get the player name of nothing at all).

<snip>
I ended up doing what you're suggesting. I added my code here if you're curious. However, I still don't understand how to use get_player_name(). :) I'll figure it out soon enough.

User avatar
Achilles
Member
Posts: 247
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles
Location: Excuse Me???? -_-

Re: Post your modding questions here

by Achilles » Post

When an admin requests a server shutdown on a server, how long will the server shutdown for? or How do you get it back up?

Sorry I've never tried this before and I don't want to mess it up...

User avatar
Krock
Developer
Posts: 4577
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Post your modding questions here

by Krock » Post

Achilles wrote:When an admin requests a server shutdown on a server, how long will the server shutdown for? or How do you get it back up?

Sorry I've never tried this before and I don't want to mess it up...
It will be down as long nothing restarts the minetest server.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Landrover110
Member
Posts: 19
Joined: Mon Jan 13, 2014 09:38
In-game: Landrover
Location: South luangwa , Zambia

Re: Post your modding questions here

by Landrover110 » Post

To shutdown , backup and restart normaly takes 5 mins but it depends

User avatar
Achilles
Member
Posts: 247
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles
Location: Excuse Me???? -_-

Re: Post your modding questions here

by Achilles » Post

Krock wrote:
Achilles wrote:When an admin requests a server shutdown on a server, how long will the server shutdown for? or How do you get it back up?

Sorry I've never tried this before and I don't want to mess it up...
It will be down as long nothing restarts the minetest server.
Oh, how do you restart the server?

Xenon
New member
Posts: 7
Joined: Mon Oct 13, 2014 17:55

Re: Post your modding questions here

by Xenon » Post

Is there a way to register multiblock structures?
Also, is there a way to add different dimensions?
If so, I would love to know!

Esteban
Member
Posts: 873
Joined: Sun Sep 08, 2013 13:26
GitHub: Esteban-
IRC: Esteban
In-game: Esteban
Location: Somewhere in the Caribbean...

Re: Post your modding questions here

by Esteban » Post

Xenon wrote:Is there a way to register multiblock structures?
Also, is there a way to add different dimensions?
If so, I would love to know!
Do you mean like buildings? If so, this might be helpful: [Mod] Generative architecture [0.1.7] [projects]

Xenon
New member
Posts: 7
Joined: Mon Oct 13, 2014 17:55

Re: Post your modding questions here

by Xenon » Post

Esteban wrote:
Xenon wrote:Is there a way to register multiblock structures?
Also, is there a way to add different dimensions?
If so, I would love to know!
Do you mean like buildings? If so, this might be helpful: [Mod] Generative architecture [0.1.7] [projects]
No, I meant if the player builds something in a certain way, the mod know that it is something else.

User avatar
Hybrid Dog
Member
Posts: 2774
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

Xenon wrote:Is there a way to register multiblock structures?
Also, is there a way to add different dimensions?
If so, I would love to know!
Of course, there are lots of ways to register structures with more blocks, you just need to find out the definition for these structures and then put it into lua and test it.
And you can add more dimensions if you want but you would need to edit the source code of minetest. It works with a mod too but it would cause too much lag.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

Xenon
New member
Posts: 7
Joined: Mon Oct 13, 2014 17:55

Re: Post your modding questions here

by Xenon » Post

Hybrid Dog wrote:
Xenon wrote:Is there a way to register multiblock structures?
Also, is there a way to add different dimensions?
If so, I would love to know!
Of course, there are lots of ways to register structures with more blocks, you just need to find out the definition for these structures and then put it into lua and test it.
And you can add more dimensions if you want but you would need to edit the source code of minetest. It works with a mod too but it would cause too much lag.
What do you mean definition?

Xenon
New member
Posts: 7
Joined: Mon Oct 13, 2014 17:55

Re: Post your modding questions here

by Xenon » Post

Also, would it be possible to have a box with text appear at the top of the screen when you look at something?

User avatar
Hybrid Dog
Member
Posts: 2774
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

Xenon wrote:
Hybrid Dog wrote:
Xenon wrote:Is there a way to register multiblock structures?
Also, is there a way to add different dimensions?
If so, I would love to know!
Of course, there are lots of ways to register structures with more blocks, you just need to find out the definition for these structures and then put it into lua and test it.
And you can add more dimensions if you want but you would need to edit the source code of minetest. It works with a mod too but it would cause too much lag.
What do you mean definition?
By definition I mainly mean the way of building the house.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
benedict424
Member
Posts: 29
Joined: Thu Oct 02, 2014 06:24
IRC: oswald
In-game: oswaldTechnic

Re: Post your modding questions here

by benedict424 » Post

I have created a mod, but I can't right a post to release it. Is it because I'm a new member or am I missing something else?
Terra, Aqua, Ignus, Air, Ather, and Incognitus.

Locked

Who is online

Users browsing this forum: No registered users and 1 guest