Complicated or easy way?shaheerziya wrote:how to make a mod?
Post your modding questions here
- Krock
- Developer
- Posts: 4589
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
- Pitriss
- Member
- Posts: 254
- Joined: Mon Aug 05, 2013 17:09
- GitHub: Pitriss
- IRC: pitriss
- In-game: pitriss
- Location: Czech republic, Bohumin
Complicated: learn lua, read http://dev.minetest.net/Intro, get an idea, write mod, profitKrock wrote:Complicated or easy way?shaheerziya wrote:how to make a mod?
Easy way: learn lua, read http://dev.minetest.net/Intro, get an idea, write mod, profit

I reject your reality and substitute my own. (A. Savage, Mythbusters)
I'm not modding and/or playing minetest anymore. All my mods were released under WTFPL. You can fix/modify them yourself. Don't ask me for support. Thanks.
I'm not modding and/or playing minetest anymore. All my mods were released under WTFPL. You can fix/modify them yourself. Don't ask me for support. Thanks.
- Krock
- Developer
- Posts: 4589
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
+1Pitriss wrote:Complicated: learn lua, read http://dev.minetest.net/Intro, get an idea, write mod, profit
Easy way: learn lua, read http://dev.minetest.net/Intro, get an idea, write mod, profit
Thought the same

Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
Actually there are 2 easy ways too:shaheerziya wrote:how to make a mod?
- Copy and paste other mods. Then change them. Don't forget to give their makers credit.
- Read the decowood tutorial (scroll down after clicking the link):
http://dev.minetest.net/Intro
Also debug.txt is your best friend trying out mods you make.
Edit: This intro link is without a ","
Last edited by Topywo on Fri Jan 03, 2014 11:28, edited 1 time in total.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
The complicated way is: learn lua, read https://github.com/minetest/minetest/bl ... ua_api.txt, get an idea, write mod, profitPitriss wrote:Complicated: learn lua, read http://dev.minetest.net/Intro, get an idea, write mod, profitKrock wrote:Complicated or easy way?shaheerziya wrote:how to make a mod?
Easy way: learn lua, read http://dev.minetest.net/Intro, get an idea, write mod, profit
- Ferdi Napoli
- Member
- Posts: 14
- Joined: Thu Jan 02, 2014 12:12
- Krock
- Developer
- Posts: 4589
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
It's not a mod.Ferdi Napoli wrote:Can someone put the download of the third person mod?
Sorry for the language,i'm italian
viewtopic.php?id=5397
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
- prestidigitator
- Member
- Posts: 640
- Joined: Thu Feb 21, 2013 23:54
I believe you'll need to call minetest.set_node() to change the 'param2' attribute while preserving 'name' and 'param1'. You may also need to preserve the metadata if it is important using minetest.get_meta():to_table() and minetest.get_meta():from_table() before and after set_node(), respectively. I believe metadata is reset when the node is changed, but I can't remember for sure. You might want to test it.philipbenr wrote:That's not quite what I meant. I know how to do so, but I need to be able to set the facing position inside the callback after_place_node.
No: use minetest.swap_node(pos, new_node), it preserves metadataprestidigitator wrote:I believe you'll need to call minetest.set_node() to change the 'param2' attribute while preserving 'name' and 'param1'. You may also need to preserve the metadata if it is important using minetest.get_meta():to_table() and minetest.get_meta():from_table() before and after set_node(), respectively. I believe metadata is reset when the node is changed, but I can't remember for sure. You might want to test it.philipbenr wrote:That's not quite what I meant. I know how to do so, but I need to be able to set the facing position inside the callback after_place_node.
- philipbenr
- Member
- Posts: 1783
- Joined: Fri Jun 14, 2013 01:56
- GitHub: philipbenr
- IRC: philipbenr
- In-game: robinspi
- Location: United States
Oh, Thank you so much. It will save me a lot of time.Nore wrote:No: use minetest.swap_node(pos, new_node), it preserves metadataprestidigitator wrote:I believe you'll need to call minetest.set_node() to change the 'param2' attribute while preserving 'name' and 'param1'. You may also need to preserve the metadata if it is important using minetest.get_meta():to_table() and minetest.get_meta():from_table() before and after set_node(), respectively. I believe metadata is reset when the node is changed, but I can't remember for sure. You might want to test it.philipbenr wrote:That's not quite what I meant. I know how to do so, but I need to be able to set the facing position inside the callback after_place_node.
- Krock
- Developer
- Posts: 4589
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
How can I make this working? (example node names)
Code: Select all
minetest.register_craft({
type = 'cooking',
recipe = "default:leaves 6",
output = "default:coal_lump",
})
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
Krock wrote:How can I make this working? (example node names)Code: Select all
minetest.register_craft({ type = 'cooking', recipe = "default:leaves 6", output = "default:coal_lump", })
Code: Select all
minetest.register_craft({
type = 'cooking',
output = "default:coal_lump",
recipe = "default:leaves 6",
})
Maybe.
- Krock
- Developer
- Posts: 4589
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
It works, just not the correct way. Still loosing 1 and getting 1.Hybrid Dog wrote:I don't think it would work.Code: Select all
minetest.register_craft({ type = 'cooking', recipe = "default:leaves", output = "default:coal_lump 1/6", })
Is there another way to make this working?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
Maybe you could create a craft item that you would then need to craft into a coal_lump and would require 6 of them to do so. You would use the crafting grid to do so and maybe call them coal chunks or something.
I don't know for sure, but I think the furnace is only capable of turning one singular item into one other item.
I don't know for sure, but I think the furnace is only capable of turning one singular item into one other item.
Is there any way to read pixels of png file in rgb using lua? I want to try to make image to map mod that uses images to make elevation and water.
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:
You could use libpng via FFI (LuaJit), or a wrapper library.ch98 wrote:Is there any way to read pixels of png file in rgb using lua? I want to try to make image to map mod that uses images to make elevation and water.
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
The Image Loader mod
viewtopic.php?id=6751
loads bitmap images into the game. You could look at that and see what it does and then you just need to find some lua code that allows you to read in a png file. Once you can read it and understand how to get at the pixel information it shouldn't be too hard to convert it to height maps and such. Hope this helps you out.
viewtopic.php?id=6751
loads bitmap images into the game. You could look at that and see what it does and then you just need to find some lua code that allows you to read in a png file. Once you can read it and understand how to get at the pixel information it shouldn't be too hard to convert it to height maps and such. Hope this helps you out.
ok. i will try that.
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.
Question about lua tables:
I want to create a table that is a copy of another table.
Example:
sorry for the stupidity
I want to create a table that is a copy of another table.
Example:
now I want to change ONLY the table "b"local a ={1}
local b=a
but:b[1]=b[1]+1
returnsprint(dump(a))
print(dump(b))
the problem is that if I change the table "b" then you also change the table "a". I want the table "a" remains unchanged. how?a={[1] = 2}
b={[1] = 2}
sorry for the stupidity
sorry for bad english
Linux debian 7 wheezy 64
kde
Linux debian 7 wheezy 64
kde
- prestidigitator
- Member
- Posts: 640
- Joined: Thu Feb 21, 2013 23:54
All variables refer to tables in Lua by reference, not by value. Lua's standard API also does not have any simple way to copy/clone tables. To implement a cloning method, you have to decide whether you want to also copy a table/object's metatable (sort of like a "class" in Lua). Also, since Lua tables can contain references to other tables, you have to decide whether you want to perform a shallow or a deep copy (a whole separate and independent tree of table objects).pandaro wrote:Question about lua tables:
I want to create a table that is a copy of another table.
Example:now I want to change ONLY the table "b"Code: Select all
local a ={1} local b=a
Code: Select all
b[1]=b[1]+1
Assuming all you want is a shallow copy, resulting in a simple table (with no metatable set) that simply has all the same keys and values as the original, try:
Code: Select all
function shallow_copy_table(t)
local new_table = {};
for k, v in pairs(t) do
new_table[k] = v;
end
return new_table;
end
Code: Select all
local a = { 1 };
local b = shallow_copy_table(a);
b[1] = b[1]+1;
Last edited by prestidigitator on Fri Jan 10, 2014 09:00, edited 1 time in total.
Thank you very much, I was not aware of this behavior. Although it is logical thinking.prestidigitator wrote:All variables refer to tables in Lua by reference, not by value. Lua's standard API also does not have any simple way to copy/clone tables. To implement a cloning method, you have to decide whether you want to also copy a table/object's metatable (sort of like a "class" in Lua). Also, since Lua tables can contain references to other tables, you have to decide whether you want to perform a shallow or a deep copy (a whole separate and independent tree of table objects
sorry for bad english
Linux debian 7 wheezy 64
kde
Linux debian 7 wheezy 64
kde
- Krock
- Developer
- Posts: 4589
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
How can I override an ABM of the game?
I try to allow burning stacks into another stack, like burning 2 tree trunks and getting 1 coal lump.
Help!
EDIT: this, because I won't add a new node, instead override the old furnace function..
I try to allow burning stacks into another stack, like burning 2 tree trunks and getting 1 coal lump.
Help!
EDIT: this, because I won't add a new node, instead override the old furnace function..
Last edited by Krock on Sat Jan 11, 2014 11:31, edited 1 time in total.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
- Casimir
- Member
- Posts: 1189
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
I tried to draw a drowning bar in the hud just like the one that is done engine side. The problem is, the hud resizes in steps relative to the window size. The bar then appears in the wrong position when resizing the window. How can I get the hight in Lua? Is there a way to surpass the problem?
That would require the default game to be changed. But I think it is better to do so anyway.
Code: Select all
player_bubbles[name] = player:hud_add({
hud_elem_type = "statbar",
text = "bubble.png",
number = 20,
dir = 0,
position = {x=0.5,y=1.0},
offset = {x=0, y=-58},
})
I don't know a way you could. It would be possible when the ABM would call a function. e.g.:Krock wrote:How can I override an ABM of the game?
Code: Select all
mod = {}
function mod.abm(pos, node)
-- actual function
end
minetest.register_abm({
nodenames = {"mod:node"},
interval =5,
chance = 5,
action = function(pos, node)
mod.abm(pos, node)
end
})
Last edited by Casimir on Sat Jan 11, 2014 22:04, edited 1 time in total.
- Enke
- Member
- Posts: 469
- Joined: Fri Nov 15, 2013 02:56
- GitHub: NANOsoldierEnke
- IRC: Enke
- In-game: Enke
- Location: The internet
What is a soft dependancy, and how do I make one?
Lush8
ExtraVars for Red Eclipse
<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate
ExtraVars for Red Eclipse
<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate
Who is online
Users browsing this forum: No registered users and 1 guest