Superflat World

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

Superflat World

by jordan4ibanez » Tue Oct 02, 2012 23:47

Here is a code i've been working on today to give superflat worlds with maximum speed
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
super_flat = true

if super_flat == true then
    minetest.register_alias("mapgen_air", "air")
    minetest.register_alias("mapgen_stone", "air")
    minetest.register_alias("mapgen_tree", "air")
    minetest.register_alias("mapgen_leaves", "air")
    minetest.register_alias("mapgen_apple", "air")
    minetest.register_alias("mapgen_water_source", "air")
    minetest.register_alias("mapgen_dirt", "air")
    minetest.register_alias("mapgen_sand", "air")
    minetest.register_alias("mapgen_gravel", "air")
    minetest.register_alias("mapgen_clay", "air")
    minetest.register_alias("mapgen_lava_source", "air")
    minetest.register_alias("mapgen_cobble", "air")
    minetest.register_alias("mapgen_mossycobble", "air")
    minetest.register_alias("mapgen_dirt_with_grass", "air")
    minetest.register_alias("mapgen_junglegrass", "air")
    minetest.register_alias("mapgen_stone_with_coal", "air")
    minetest.register_alias("mapgen_stone_with_iron", "air")
    minetest.register_alias("mapgen_mese", "air")
    minetest.register_alias("mapgen_desert_sand", "air")
    minetest.register_alias("mapgen_desert_stone", "air")
    minetest.register_alias("mapgen_papyrus", "air")
    minetest.register_alias("mapgen_cactus", "air")
    minetest.register_alias("mapgen_torch", "air")
    minetest.register_alias("mapgen_nyancat", "air")
    minetest.register_alias("mapgen_nyancat_rainbow", "air")
    --GENERATE THE SUPERFLAT WORLD
    minetest.register_on_generated(function(minp, maxp)
        if minp.y < 0 and maxp.y > 0 then
            orig = minp
            orig_x = minp.x
            pos = minp
            for i = 1,6400 do
                minetest.env:add_node(pos, {name="default:stone"})
                minetest.env:add_node({x=pos.x,y=pos.y+1,z=pos.z}, {name="default:dirt_with_grass"})
                pos.x = pos.x + 1
                if pos.x == orig_x + 80 then
                    pos.z = pos.z + 1
                    pos.x = orig_x
                end
            end
        end
    end)
end
If you can think it, you can make it.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Wed Oct 03, 2012 00:21

I recommend using this to check the setting in minetest.conf:
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.setting_getbool("mapgen_super_flat")


Also, this will cause issues with ABMs that are builtin to the C++. For example, trees won't grow from saplings, and dirt wont turn to dirt_with_grass.

I used the flatland mod to extend my no_mapgen mod to do something similar. I don't know if yours is faster tho:
https://github.com/cornernote/minetest-no_mapgen/blob/master/no_mapgen/init.lua
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Wed Oct 03, 2012 00:50

cornernote wrote:I recommend using this to check the setting in minetest.conf:
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.setting_getbool("mapgen_super_flat")


Also, this will cause issues with ABMs that are builtin to the C++. For example, trees won't grow from saplings, and dirt wont turn to dirt_with_grass.

I used the flatland mod to extend my no_mapgen mod to do something similar. I don't know if yours is faster tho:
https://github.com/cornernote/minetest-no_mapgen/blob/master/no_mapgen/init.lua

This does not cause any problems with any of that, and yes it does turn into grass
If you can think it, you can make it.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Wed Oct 03, 2012 01:02

ok, thats interesting. i assumed a lot of things wouldnt happen when i did this on skyblock. i might have to go back and review the ABMs I added. some are probably not needed.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Wed Oct 03, 2012 01:07

perhaps I am mistaken (i dont know c++ that well), but this is the function that turns a sapling into a tree:
https://github.com/celeron55/minetest/blob/master/src/mapgen.cpp#L123

The ABM is defined here:
https://github.com/celeron55/minetest/blob/master/src/content_abm.cpp#L121

It seems to rely on mapgen_* aliases.
Last edited by cornernote on Wed Oct 03, 2012 01:10, edited 1 time in total.
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Wed Oct 03, 2012 01:18

cornernote wrote:perhaps I am mistaken (i dont know c++ that well), but this is the function that turns a sapling into a tree:
https://github.com/celeron55/minetest/blob/master/src/mapgen.cpp#L123

The ABM is defined here:
https://github.com/celeron55/minetest/blob/master/src/content_abm.cpp#L121

It seems to rely on mapgen_* aliases.

hmm the saplings do not work, i'll have to see about that
If you can think it, you can make it.
 

breinzter11
Member
 
Posts: 39
Joined: Sat Sep 08, 2012 10:43

by breinzter11 » Fri Oct 12, 2012 06:26

where is the flat world ?
How To use it ?
 

breinzter11
Member
 
Posts: 39
Joined: Sat Sep 08, 2012 10:43

by breinzter11 » Fri Oct 12, 2012 06:44

Now i got the flat world
this is cool !
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 64 guests

cron