Post your modding questions here

Locked
User avatar
Chinchow
Member
Posts: 684
Joined: Tue Sep 18, 2012 21:37

Re: Post your modding questions here

by Chinchow » Post

There is probably a very simple answer to this, but how would one create a flat area of certain dimensions. For example: Say you have a hill, but you want something to generate there via a mod. However when you generate your structure there are nodes from the hill inside. Therefore a flat area needs to be set.

User avatar
srifqi
Member
Posts: 570
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi
Location: Indonesia

Re: Post your modding questions here

by srifqi » Post

prestidigitator wrote:Where did you start the server?

Singleplayer
prestidigitator wrote:Can you see any error output in the console there, or in the log file?
No. Just a normal output
chinchow wrote:There is probably a very simple answer to this, but how would one create a flat area
of certain dimensions. For example: Say you have a hill, but you want something to
generate there via a mod. However when you generate your structure there are nodes
from the hill inside. Therefore a flat area needs to be set.
That's why i want it works in singlenode mapgen
Saya dari Indonesia! · Terjemahkan Minetest! · my mods · My nickname in IPA: /es.rif.qi/

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

Re: Post your modding questions here

by Krock » Post

Chinchow wrote:flat area
viewtopic.php?p=145653#p145653
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Chinchow
Member
Posts: 684
Joined: Tue Sep 18, 2012 21:37

Re: Post your modding questions here

by Chinchow » Post

Krock wrote:
Chinchow wrote:flat area
viewtopic.php?p=145653#p145653
I apologize it seems I did not specify. I want a normal world with hills and the like, and I want a contained area to be flattened.

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

Re: Post your modding questions here

by Krock » Post

Chinchow wrote:
Krock wrote:
Chinchow wrote:flat area
viewtopic.php?p=145653#p145653
I apologize it seems I did not specify. I want a normal world with hills and the like, and I want a contained area to be flattened.
Contains streets, hills, flatlands. viewtopic.php?f=9&t=9296
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

Re: Post your modding questions here

by LionsDen » Post

Check out paramat's terrain flattener mod.

viewtopic.php?f=11&t=7701

This may be a lot more like you want.

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

Re: Post your modding questions here

by philipbenr » Post

dev.minetest.net wrote:> drop — alternatively drop = { max_items = ..., items = { ... } }
How to use the multiple drop function? I am trying to get a node to drop more than one thing when it is dug.

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

Re: Post your modding questions here

by Krock » Post

philipbenr wrote:
dev.minetest.net wrote:> drop — alternatively drop = { max_items = ..., items = { ... } }
How to use the multiple drop function? I am trying to get a node to drop more than one thing when it is dug.
Something similar to

Code: Select all

drop = {
	max_items = 2,
	items = {
		{items = {"mod:item"}, rarity = 10 },
		{items = {"mod:item"}, rarity = 2 },
	}
},
Chance to get the item is 1 / rarity
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

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

Re: Post your modding questions here

by philipbenr » Post

Ohhhh. Thanks Krock! ;)

Edit1: So, one is will drop and 10 really rare.

Edit2: More info (forgot to post this ;) I'm making a sub-game, and I want the birch tree (separate mod in the game) to drop a birch tree unit always and paper unit sometimes.

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

Re: Post your modding questions here

by philipbenr » Post

Question #2:
Is there a way to make sure that texture packs are not enabled in game.conf (when making a game...) I want to have the textures be default and stay that way (There is a good reason too). Or at least disabled at first entry.

Edit:
And for question #3:
What is the simplest way to define a tree and have it spawn in the world? I want to have a simple birch tree, close to the default elm or whatever. Anyhow, I saw that there is the L system, but I was hoping there would be a better way to do it now in 0.4.10

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

Re: Post your modding questions here

by Casimir » Post

#2 I don't think so. You can not prevent the clients from doing what they want.
#3 Look at minetest_game's default/trees.lua and functions.lua

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

Re: Post your modding questions here

by philipbenr » Post

#2: That's what I was afraid of... Oh well. Cant be helped. Also, when I look in minetest.conf, I see the line:
"mainmenu_last_selected_TP = 1" and the line "texture_path = ____" So I was wondering if those made any difference.
#3: I already looked in trees.lua so I suppose it would be in functions.lua...

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

As said by Casimir, you can't force the client to do what you want, but you can recommend people to use the default textures. If it looks bad with other texture packs, it's the user's fault, not yours.
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
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

Re: Post your modding questions here

by philipbenr » Post

@kaeza: question, but do you know of you can change the facedir of a node on a spawning tree?

I want to have ivy growing on trees that is climbable. It would look horrible with random ladderlike nodes facing only one direction...

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

Re: Post your modding questions here

by RHR » Post

#2: Just rename all textures in the texture folder and in the source code e.g. default_stone.png --> philipbenr_stone.png

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

Re: Post your modding questions here

by philipbenr » Post

RHR wrote:#2: Just rename all textures in the texture folder and in the source code e.g. default_stone.png --> philipbenr_stone.png
Very very original thinking. XD Might even use. (probably a no; either that or release the textures as a separate TP.)

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Post your modding questions here

by paramat » Post

I've been meaning to ask a question for perhaps a year, i'm in the habit of adding 'modname = {}' to a mod's init.lua file, but i still don't know why this is done, which is why i title that with the comment 'Stuff' in my code. What is the purpose and (when) is it essential?

yaman
Member
Posts: 56
Joined: Wed Sep 04, 2013 21:22

Re: Post your modding questions here

by yaman » Post

Topic - How do you get the player's position, or better, the position of the block they are standing on?
Reason - I am making a gold touch mod: it makes blocks the player walks on into gold blocks
More Info - I really want to get into coding mods and I want to succeed in making this one so I can get my self esteem up.

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

Re: Post your modding questions here

by Krock » Post

yaman wrote:Topic - How do you get the player's position, or better, the position of the block they are standing on?
Reason - I am making a gold touch mod: it makes blocks the player walks on into gold blocks
More Info - I really want to get into coding mods and I want to succeed in making this one so I can get my self esteem up.
minetest.get_node(vector.round(player:getpos())
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: 1206
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Post your modding questions here

by Casimir » Post

@paramat
(Please anyone correct me if I'm wrong on this.)
Normally you don't need this. Only it you want that definitions made by your mod can be used by other mods too.

Code: Select all

yourmod = {} -- global variable
local modname = "yourmod" -- local variable
local function first_func(pos, player)
	-- this is a local function
end

function yourmod.second_func(pos, player)
		-- this is a global function
end
From within your mod you can call both functions by there name. From an other mod you can only call yourmod.second_func because it is part of the table "yourmod" which is a global variable.

edit: see webdesigners post
Last edited by Casimir on Sun Jul 13, 2014 19:04, edited 1 time in total.

User avatar
webdesigner97
Member
Posts: 1328
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97
Location: Cologne, Germany
Contact:

Re: Post your modding questions here

by webdesigner97 » Post

Casimir wrote:@paramat
(Please anyone correct me if I'm wrong on this.)
Normally you don't need this. Only it you want that definitions made by your mod can be used by other mods too.

Code: Select all

yourmod = {} -- global variable
local modname = "yourmod" -- local variable
function first_func(pos, player)
	-- this is a local function
end

function yourmod.second_func(pos, player)
		-- this is a global function
end
From within your mod you can call both functions by there name. From an other mod you can only call yourmod.second_func because it is part of the table "yourmod" which is a global variable.
first_func() is also global, make it local by putting "local" before "function". In theory, you don't need to put your mod's functions in a table, but to make sure that they are unique and don't get overriden accidently by other mods, many modders do put their function in tables.

yaman
Member
Posts: 56
Joined: Wed Sep 04, 2013 21:22

Re: Post your modding questions here

by yaman » Post

2 Questions

Topic - How do you replace a single node if I have its position stored in a variable?
Reason - Creating goldtouch mod

Topic - How could i make a chat command make a loop to do a function over and over
Reason - to make the ground under you keep turning into gold


*Edit* - Solved
Last edited by yaman on Mon Jul 14, 2014 18:57, edited 1 time in total.

User avatar
srifqi
Member
Posts: 570
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi
Location: Indonesia

Re: Post your modding questions here

by srifqi » Post

How to create my own map gen?
I see there's many mapgen mod that use singlenode mapgen.
Minetest Dev Wiki wrote:singlenode:Intended to be used by mods that perform total mapgen takeovers.
Saya dari Indonesia! · Terjemahkan Minetest! · my mods · My nickname in IPA: /es.rif.qi/

drkwv
Member
Posts: 102
Joined: Thu Jun 28, 2012 13:48
GitHub: aa6

Re: Gracefully replace node upon digging?

by drkwv » Post

prestidigitator wrote:you might need to us on_dig() instead.
I have copied on_dig from builtin/item.lua and set it for my needs, but lag is still there (pushed this code to github). I have found out that even with an empty function passed to on_dig, minetest client is removing node then setting it back instead of simply doing nothing. Is there anything else I can do to get rid of the lag?

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Post

paramat wrote:I've been meaning to ask a question for perhaps a year, i'm in the habit of adding 'modname = {}' to a mod's init.lua file, but i still don't know why this is done, which is why i title that with the comment 'Stuff' in my code. What is the purpose and (when) is it essential?
As others have said, a table with the name of your mod creates a convenient namespace to place your API. Any functions or variables you want to be "publicly" accessible (part of an outside API usable by other mods and during debugging) should go there. This is the de facto standard for mod APIs.

EVERY top-level variable or function you use in your mod which does NOT go in that table should be local! Otherwise it pollutes the global namespace, which is a Bad Thing. Note that in Lua the syntax:

Code: Select all

function mytable.myfunc(...) ... end
is guaranteed by the language to be exactly equivalent to:

Code: Select all

mytable.myfunc = function(...) ... end
so if you do not create "mytable" in the first place you'll get an error because you are trying to set a value in a non-existent table (the global variable "mytable" effectively has the value nil). See Lua Function Definitions.

Locked

Who is online

Users browsing this forum: No registered users and 4 guests