Post your modding questions here

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

by Krock » Post

shaheerziya wrote:how to make a mod?
Complicated or easy way?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Pitriss
Member
Posts: 254
Joined: Mon Aug 05, 2013 17:09
GitHub: Pitriss
IRC: pitriss
In-game: pitriss
Location: Czech republic, Bohumin

by Pitriss » Post

Krock wrote:
shaheerziya wrote:how to make a mod?
Complicated or easy way?
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

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

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

by Krock » Post

Pitriss 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

:D
+1
Thought the same :)
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Topywo
Member
Posts: 1721
Joined: Fri May 18, 2012 20:27

by Topywo » Post

shaheerziya wrote:how to make a mod?
Actually there are 2 easy ways too:

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

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

by PilzAdam » Post

Pitriss wrote:
Krock wrote:
shaheerziya wrote:how to make a mod?
Complicated or easy way?
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

:D
The complicated way is: learn lua, read https://github.com/minetest/minetest/bl ... ua_api.txt, get an idea, write mod, profit

User avatar
Ferdi Napoli
Member
Posts: 14
Joined: Thu Jan 02, 2014 12:12

by Ferdi Napoli » Post

Can someone put the download of the third person mod?
Sorry for the language,i'm italian

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

by Krock » Post

Ferdi Napoli wrote:Can someone put the download of the third person mod?
Sorry for the language,i'm italian
It's not a mod.
viewtopic.php?id=5397
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

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

by prestidigitator » Post

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

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

prestidigitator wrote:
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.
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.
No: use minetest.swap_node(pos, new_node), it preserves metadata

User avatar
philipbenr
Member
Posts: 1783
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

by philipbenr » Post

Nore wrote:
prestidigitator wrote:
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.
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.
No: use minetest.swap_node(pos, new_node), it preserves metadata
Oh, Thank you so much. It will save me a lot of time.

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

by Krock » Post

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>

User avatar
Topywo
Member
Posts: 1721
Joined: Fri May 18, 2012 20:27

by Topywo » Post

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.

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

by Krock » Post

Hybrid Dog wrote:

Code: Select all

minetest.register_craft({
    type = 'cooking',
    recipe = "default:leaves",
    output = "default:coal_lump 1/6",
})
I don't think it would work.
It works, just not the correct way. Still loosing 1 and getting 1.

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>

User avatar
LionsDen
Member
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Post

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.

User avatar
Gambit
Member
Posts: 453
Joined: Sat Oct 29, 2011 19:31
Location: United States

by Gambit » Post

How would I go about making the stiff physics for webs. I want the player to be able to move slowly while touching it?
Current Projects: MineToon | PixelBOX
Gambit's Checkmate Server - 43.65.296.232 - port: 30001

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

by ch98 » Post

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.

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

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.
You could use libpng via FFI (LuaJit), or a wrapper library.
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

User avatar
LionsDen
Member
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Post

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.

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

by ch98 » Post

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.

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

by pandaro » Post

Question about lua tables:

I want to create a table that is a copy of another table.
Example:
local a ={1}
local b=a
now I want to change ONLY the table "b"
b[1]=b[1]+1
but:
print(dump(a))
print(dump(b))
returns
a={[1] = 2}
b={[1] = 2}
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?


sorry for the stupidity
sorry for bad english
Linux debian 7 wheezy 64
kde

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

by prestidigitator » Post

pandaro wrote:Question about lua tables:

I want to create a table that is a copy of another table.
Example:

Code: Select all

local a ={1}
local b=a
now I want to change ONLY the table "b"

Code: Select all

b[1]=b[1]+1
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).

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
Your code would then have to look like:

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.

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

by pandaro » Post

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
Thank you very much, I was not aware of this behavior. Although it is logical thinking.
sorry for bad english
Linux debian 7 wheezy 64
kde

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

by Krock » Post

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

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

by Casimir » Post

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?

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},
})

Krock wrote:How can I override an ABM of the game?
I don't know a way you could. It would be possible when the ABM would call a function. e.g.:

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
})
That would require the default game to be changed. But I think it is better to do so anyway.
Last edited by Casimir on Sat Jan 11, 2014 22:04, edited 1 time in total.

User avatar
Enke
Member
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke
Location: The internet

by Enke » Post

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

Locked

Who is online

Users browsing this forum: No registered users and 1 guest