Post your modding questions here

User avatar
rubberduck
Member
 
Posts: 487
Joined: Thu Feb 27, 2014 19:19
IRC: rbduck
In-game: rubberduck

Re: Post your modding questions here

by rubberduck » Sat Oct 04, 2014 12:46

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:
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
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
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sat Oct 04, 2014 16:25

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:
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
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: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Mon Oct 06, 2014 03:49

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.

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
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
 

Landrover110
Member
 
Posts: 19
Joined: Mon Jan 13, 2014 09:38
In-game: Landrover

Re: Post your modding questions here

by Landrover110 » Tue Oct 07, 2014 09:05

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: 12
Joined: Mon Oct 06, 2014 22:34

Re: Post your modding questions here

by tfranko » Thu Oct 09, 2014 16:24

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:
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
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: 12
Joined: Mon Oct 06, 2014 22:34

Re: Post your modding questions here

by tfranko » Thu Oct 09, 2014 17:31

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:

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
function name_of_my_function(name)
    ...
    minetest.chat_send_player(name, 'hello')
end


Is there documentation somewhere about why this works?
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Thu Oct 09, 2014 18:56

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:

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_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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

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

Re: Post your modding questions here

by tfranko » Fri Oct 10, 2014 03:07

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: 246
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles

Re: Post your modding questions here

by Achilles » Fri Oct 10, 2014 20:32

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
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Post your modding questions here

by Krock » Fri Oct 10, 2014 20:39

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.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

Landrover110
Member
 
Posts: 19
Joined: Mon Jan 13, 2014 09:38
In-game: Landrover

Re: Post your modding questions here

by Landrover110 » Sat Oct 11, 2014 08:13

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

User avatar
Achilles
Member
 
Posts: 246
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles

Re: Post your modding questions here

by Achilles » Sat Oct 11, 2014 11:20

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 » Mon Oct 13, 2014 18:13

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

User avatar
Esteban
Member
 
Posts: 872
Joined: Sun Sep 08, 2013 13:26
GitHub: Esteban-
IRC: Esteban
In-game: Esteban

Re: Post your modding questions here

by Esteban » Mon Oct 13, 2014 20:53

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 » Mon Oct 13, 2014 22:06

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.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Tue Oct 14, 2014 15:37

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 » Tue Oct 14, 2014 18:36

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 » Wed Oct 15, 2014 03:38

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

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Wed Oct 15, 2014 13:22

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.
 

benedict424
Member
 
Posts: 28
Joined: Thu Oct 02, 2014 06:24
IRC: ozwald
In-game: arimeikata

Re: Post your modding questions here

by benedict424 » Thu Oct 16, 2014 01:00

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?
Who said that there are only four elements? I have Terra, Aqua, Ignus, Air, Ather, and Incognitus.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Post your modding questions here

by TenPlus1 » Thu Oct 16, 2014 07:37

Try posting your mod in WIP Mods section...
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Thu Oct 16, 2014 19:10

Post in WIP Mods, and then it can be moved.
 

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

Re: Post your modding questions here

by Xenon » Fri Oct 17, 2014 02:54

How would you make GUIs show up when you click with a tool?
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: Post your modding questions here

by Sokomine » Fri Oct 17, 2014 15:51

Xenon wrote:How would you make GUIs show up when you click with a tool?

on_use/on_place in the item/tool's definition for the clicking event, and minetest.show_formspec(playername, formname, formspec) in order to manually show a formspec independent of the block beeing clicked on. You may take a look at my replacer and/or inspection tool in my replacer mod.
A list of my mods can be found here.
 

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

Re: Post your modding questions here

by RHR » Sat Oct 18, 2014 08:58

visual_scale scales nodes towards the center of the node. This creates 'flying' nodes if visual scale is less than 1. Is there a way to put the scaled node down to the ground?

[b]EDIT: visual_scale was brocken for plantlike nodes:
https://github.com/minetest/minetest/is ... t-60142533
Last edited by RHR on Thu Oct 23, 2014 18:18, edited 1 time in total.
 

benedict424
Member
 
Posts: 28
Joined: Thu Oct 02, 2014 06:24
IRC: ozwald
In-game: arimeikata

Re: Post your modding questions here

by benedict424 » Sun Oct 19, 2014 05:36

I'm completly new at lua, so I want to know if this will search for the moreores mod and run moreores.lua if found.

Reason: I want to add support to a mod.

local modnames = minetest.get_modnames()
for i, name in ipairs(modnames) do
-if modnames == "moreores" then
--if minetest.get_modpath("moreores") then
---dofile(moreores_modpath.."/moreores.lua")
--end
-end
end
Who said that there are only four elements? I have Terra, Aqua, Ignus, Air, Ather, and Incognitus.
 

gamergardencat
Member
 
Posts: 55
Joined: Wed Oct 01, 2014 11:58

Re: Post your modding questions here

by gamergardencat » Sun Oct 19, 2014 05:49

maybe try something like
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
for key,value in myTable do --pseudocode
    value = "foobar"
end

on modnames. I am curious if there might be a better way.
superman slices a giant apple into 3 and hands it to guest220
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Sun Oct 19, 2014 08:32

benedict424 wrote:I'm completly new at lua, so I want to know if this will search for the moreores mod and run moreores.lua if found.

Reason: I want to add support to a mod.

local modnames = minetest.get_modnames()
for i, name in ipairs(modnames) do
-if modnames == "moreores" then
--if minetest.get_modpath("moreores") then
---dofile(moreores_modpath.."/moreores.lua")
--end
-end
end

You don't need that. You must specify "moreores" if it is a hard dependency or "moreores?" if it is an optional dependency in `depends.txt`.

If it is optional, then you only need to check if the mod was actually found:
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_modpath("moreores") then
  -- Do something requiring moreores here.
  -- Don't worry. Moreores is already loaded at this point,
  -- if you specified it as described above.
end


You don't need the `if` if `moreores` is a hard dependency. In that case, do whatever you need to do that requires `moreores` right away.
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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

pixelface
New member
 
Posts: 9
Joined: Fri Oct 17, 2014 08:23

Re: Post your modding questions here

by pixelface » Sun Oct 19, 2014 13:54

Hello,
I'm looing for a way to check if there is water on top or next to a node.
At the moment my corals seem grow on land as well as inside water.

The pink coral grass is not showing up at all, it seems.

Thanks for your help in advance. :)

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:dirt"},
   neighbors = {"group:water"},
   interval = 45,
   chance = 100,
   action = function(pos)
      pos.y=pos.y+1
      minetest.add_node(pos, {name="korallen:pinkcoral"})
   end,
})

minetest.register_abm({
   nodenames = {"default:dirt"},
   neighbors = {"group:water"},
   interval = 60, -- interval per secnd
   chance = 300, -- propability 1= always
   action = function(pos)
      pos.y=pos.y+1
      minetest.add_node(pos, {name="korallen:bluecoral"})
   end,
})

minetest.register_craftitem("korallen:pink_coral_grass",{
   description = "pink colored coral top",
   inventory_image = "koralle_top_pink.png",
   wield_image = "koralle_top_pink.png"
   --on_drop = function(itemstack, dropper, pos)
   --itemstack:take_item()
   --return itemstack
   })

minetest.register_abm({
   nodenames = {"korallen:pinkcoral"},
   neighbors = {"group:water"},
   interval = 45,
   chance = 50,
   action = function(pos)
      pos.y=pos.y+1
      minetest.add_node(pos, {name="korallen:pink_coral_grass"})
   end,
})

 

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

Re: Post your modding questions here

by Xenon » Tue Oct 21, 2014 00:04

How do you register a new type of recipe?
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 8 guests

cron