Post your modding questions here

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Sun Feb 17, 2013 00:17

Topywo wrote:
Evergreen wrote:I tried changing the random, but that didn't seem to help.


I think you must lower the 100. Just try changing it in 1 or 2 for a quick result.

Edit: teleport to an unloaded chunk or create a new world.

Already did that, didn't seem to make a difference.
Last edited by Evergreen on Sun Feb 17, 2013 00:17, edited 1 time in total.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Sun Feb 17, 2013 08:15

Evergreen wrote:
Topywo wrote:
Evergreen wrote:I tried changing the random, but that didn't seem to help.


I think you must lower the 100. Just try changing it in 1 or 2 for a quick result.

Edit: teleport to an unloaded chunk or create a new world.

Already did that, didn't seem to make a difference.

You may repeat that code twice to increase chances to have at least 1 tree ;)
Well, technically it wouldn't increase, but still.
 

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

by Topywo » Sun Feb 17, 2013 09:38

Evergreen wrote:The treegen is working! Now to figure out how to make them less rare...


I didn't suggest the following before because you wrote you got the treegen working.

In your birch code I don't see the green marked part of the rubber tree code:

farmingplus/rubber.lua:

farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "farming_plus:rubber_tree_full", "farming_plus:rubber_leaves", {"default:dirt", "default:dirt_with_grass"})

As far as I understand, it tells which nodes to place where.

The function for it is in:

farming/init.lua

function farming:generate_tree(pos, trunk, leaves, underground, replacements)

I hope this might solve the problems.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Sun Feb 17, 2013 12:21

Topywo wrote:
Evergreen wrote:The treegen is working! Now to figure out how to make them less rare...


I didn't suggest the following before because you wrote you got the treegen working.

In your birch code I don't see the green marked part of the rubber tree code:

farmingplus/rubber.lua:

farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "farming_plus:rubber_tree_full", "farming_plus:rubber_leaves", {"default:dirt", "default:dirt_with_grass"})

As far as I understand, it tells which nodes to place where.

The function for it is in:

farming/init.lua

function farming:generate_tree(pos, trunk, leaves, underground, replacements)

I hope this might solve the problems.

Thanks! I'll take all the help I can get.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
jojoa1997
Member
 
Posts: 2890
Joined: Thu Dec 13, 2012 05:11

by jojoa1997 » Sun Feb 17, 2013 16:37

when people put .. in there code what does it mean?
Coding;
1X coding
3X debugging
12X tweaking to be just right
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Sun Feb 17, 2013 19:20

Now, there is a problem that I had noticed. Birch trees don't like to spawn near other trees for some reason. They also seem to like to spawn near deserts as well
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

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

by Topywo » Sun Feb 17, 2013 20:01

jojoa1997 wrote:when people put .. in there code what does it mean?


It's a concatenation

"Strings can be joined together using the concatenation operator"

http://lua-users.org/wiki/TutorialDirectory

(under strings tutorial)
 

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

by Topywo » Sun Feb 17, 2013 20:07

Evergreen wrote:Now, there is a problem that I had noticed. Birch trees don't like to spawn near other trees for some reason. They also seem to like to spawn near deserts as well


Perhaps the leaves of the other trees are blocking it. If the code is like the farming/init.lua, there'll be a check if there's a non-air node between y=1 and y=4. If so, then there will not be a tree generated.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Sun Feb 17, 2013 20:14

Topywo wrote:
Evergreen wrote:Now, there is a problem that I had noticed. Birch trees don't like to spawn near other trees for some reason. They also seem to like to spawn near deserts as well


Perhaps the leaves of the other trees are blocking it. If the code is like the farming/init.lua, there'll be a check if there's a non-air node between y=1 and y=4. If so, then there will not be a tree generated.

Welp, here's the code again. There is a check for a non air node somewhere in this code.
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 generate_birch_tree = function(pos, trunk, leaves, underground, replacements)
    node = {name = ""}
    for dy=1,4 do
        pos.y = pos.y+dy
        if minetest.env:get_node(pos).name ~= "air" then
            return
        end
        pos.y = pos.y-dy
    end
    node.name = "birch:tree"
    for dy=0,4 do
        pos.y = pos.y+dy
        minetest.env:set_node(pos, node)
        pos.y = pos.y-dy
    end
   
    node.name = "birch:leaves"
    pos.y = pos.y+3
    for dx=-2,2 do
        for dz=-2,2 do
            for dy=0,3 do
                pos.x = pos.x+dx
                pos.y = pos.y+dy
                pos.z = pos.z+dz
               
                if dx == 0 and dz == 0 and dy==3 then
                    if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
                        minetest.env:set_node(pos, node)
                    end
                elseif dx == 0 and dz == 0 and dy==4 then
                    if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
                        minetest.env:set_node(pos, node)
                    end
                elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
                    if minetest.env:get_node(pos).name == "air" then
                        minetest.env:set_node(pos, node)
                    end
                else
                    if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
                        if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
                            minetest.env:set_node(pos, node)
                        end
                    end
                end
               
                pos.x = pos.x-dx
                pos.y = pos.y-dy
                pos.z = pos.z-dz
            end
        end
    end
end
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Sun Feb 17, 2013 20:18

Do I need to get rid of just this part of the code?
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 dy=1,4 do
        pos.y = pos.y+dy
        if minetest.env:get_node(pos).name ~= "air" then
            return
        end
        pos.y = pos.y-dy
    end

Because if the block that it checks is air, it will continue, but if it isn't it won't generate a tree.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

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

by Topywo » Sun Feb 17, 2013 20:45

Evergreen wrote:Do I need to get rid of just this part of the code?

Because if the block that it checks is air, it will continue, but if it isn't it won't generate a tree.


No, better not remove it. Otherwise the tree will grow through everything.

I tried the rubber tree out on a world with moretrees on it (with the random set at 1,1). There were rubber trees between the other trees. However I noticed too them preferring the desert. Probably because since a while there's a lot more mixture of desert sand and dirt with grass.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Mon Feb 18, 2013 12:37

Topywo wrote:
Evergreen wrote:Do I need to get rid of just this part of the code?

Because if the block that it checks is air, it will continue, but if it isn't it won't generate a tree.


No, better not remove it. Otherwise the tree will grow through everything.

I tried the rubber tree out on a world with moretrees on it (with the random set at 1,1). There were rubber trees between the other trees. However I noticed too them preferring the desert. Probably because since a while there's a lot more mixture of desert sand and dirt with grass.

Why do they seem to like the desert so much?
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Mon Feb 18, 2013 13:10

I did remove that piece of code, and it seemed to help.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Mon Feb 18, 2013 14:53

PilzAdam wrote:
pandaro wrote:type:
self:getpos()

Nope, its:
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
self.object:getpos()

First thing is what I did. Thank you.
 

User avatar
VanessaE
Member
 
Posts: 3894
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaEzekowitz

by VanessaE » Mon Feb 18, 2013 15:04

Trees grow in biomes, and it probably just happens that the settings I chose for rubber trees cause them to grow near deserts. :-)

Take a look in moretrees/tree_biomes.lua and see if maybe the biome settings need tweaked.
You might like some of my stuff:
Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
Tips (BTC): 13LdcdUFcNCFAm7HfvAXh5GHTjCnnQj6KE
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Mon Feb 18, 2013 17:16

VanessaE wrote:Trees grow in biomes, and it probably just happens that the settings I chose for rubber trees cause them to grow near deserts. :-)

Take a look in moretrees/tree_biomes.lua and see if maybe the biome settings need tweaked.

I used the code for rubber trees from PilzAdam's farming mod. Not the moretrees mod.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
VanessaE
Member
 
Posts: 3894
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaEzekowitz

by VanessaE » Mon Feb 18, 2013 17:52

Ah, gotchya.
You might like some of my stuff:
Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
Tips (BTC): 13LdcdUFcNCFAm7HfvAXh5GHTjCnnQj6KE
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Mon Feb 18, 2013 19:20

How exactly would one use minetest.env:find_nodes_in_area()?
I have this on an ABM for sand (testing), but it always prints {}, nothing else.
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
    print(dump(minetest.env:find_nodes_in_area({x=pos.x+1, y=pos.y, z=pos.z+1}, {x=pos.x-1, y=0, z=pos.z-1}, {"default:dirt"})))

Heres the setup:
DDD
DSD
DDD
 

User avatar
pandaro
Member
 
Posts: 266
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro

by pandaro » Mon Feb 18, 2013 19:31

print(dump(minetest.env:find_nodes_in_area({x=pos.x+1, y=pos.y, z=pos.z+1}, {x=pos.x-1, y=0, z=pos.z-1}, {"default:dirt"})))


sobstitute


print(dump(minetest.env:find_nodes_in_area({x=self.x-1, y=0, z=self.z-1},{x=self.x+1, y=self.y, z=self.z+1}, {"default:dirt"})))

invert the 2 table of coordinate
sorry for bad english
Linux debian 7 wheezy 64
kde
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Mon Feb 18, 2013 19:57

pandaro wrote:
print(dump(minetest.env:find_nodes_in_area({x=pos.x+1, y=pos.y, z=pos.z+1}, {x=pos.x-1, y=0, z=pos.z-1}, {"default:dirt"})))


sobstitute


print(dump(minetest.env:find_nodes_in_area({x=self.x-1, y=0, z=self.z-1},{x=self.x+1, y=self.y, z=self.z+1}, {"default:dirt"})))

invert the 2 table of coordinate

Ty, but thanks to VanessaE, I figured it out :3
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Tue Feb 19, 2013 21:06

DP

Another question:

How does one force a chunk to be generated, and add blocks to that chunk without having the player in them?

I'm trying to make a skyportal mod (kinda like aether) but if the chunk I add the second portal to is not loaded/generated, the second portal is not built and causes the player to FAAAAAAAAALLL.

I have really messy and unoptomised code of this, just started and trying to get the basics down.
http://pastebin.com/bhGXbgTt
 

Blocks
New member
 
Posts: 2
Joined: Fri Feb 22, 2013 12:48

by Blocks » Fri Feb 22, 2013 13:42

Oh do I make a ore show up, in the map?
 

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

by Topywo » Fri Feb 22, 2013 20:32

Blocks wrote:Oh do I make a ore show up, in the map?


Take a look at the games/minetest_game/mods/default/mapgen.lua

or for example Calinous moreores mod.
 

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

by prestidigitator » Fri Feb 22, 2013 21:18

Usually it should suffice to wait until the chunk is loaded. You could even keep some kind of hash of positions for portals and check it when each chunk is loaded. However, if you REALLY need to load the chunks ahead of time, see this discussion on block loading.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Mon Feb 25, 2013 00:48

My windows is no more working, so I use Linux Mint at the moment. One simple question: The window where all the serverstuff is shown, how do I get it?
 

User avatar
VanessaE
Member
 
Posts: 3894
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaEzekowitz

by VanessaE » Mon Feb 25, 2013 02:04

Run your minetest instance from a terminal e.g. gnome-terminal, xterm, whatever it's called in Mint.
You might like some of my stuff:
Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
Tips (BTC): 13LdcdUFcNCFAm7HfvAXh5GHTjCnnQj6KE
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Wed Feb 27, 2013 20:25

Thank you.

A new one:
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.setting_get("new_style_leaves") == false then

end

I want to check if "fancy trees" is enabled, but it always returns false (or true, depending on the way you read it).
 

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

by PilzAdam » Wed Feb 27, 2013 20:33

Casimir wrote:Thank you.

A new one:
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.setting_get("new_style_leaves") == false then

end

I want to check if "fancy trees" is enabled, but it always returns false (or true, depending on the way you read it).

Use setting_getbool()
 

deivan
Member
 
Posts: 452
Joined: Fri Feb 15, 2013 10:16

by deivan » Thu Feb 28, 2013 23:49

Don't is possible have a little change in the API in the function "get_craft_recipe" to return all recipes don't the last one only?
 

deivan
Member
 
Posts: 452
Joined: Fri Feb 15, 2013 10:16

by deivan » Fri Mar 01, 2013 10:01

Another point, if the function will be altered or a second one added (for retro compatibility) then, maybe, is good return all recipes and the dimensions of this, well, if is a torch is a 1x2, if is a door is a 2x3. This make more easier the mod task. Thanks. :)
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 16 guests

cron