Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default and flowers: only run on-generated functions in mgv6. Remove indev code #339

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
4 participants
@paramat
Copy link
Member

commented Nov 5, 2014

I just discovered that default and flowers mods are running slow and unnecessary on-generation functions in mgv5, mgv7 and singlenode mapgens, these are making unwanted flora appear in mgv5 and mgv7 when default nodes are added using the biome API.
Mgv5, mgv7 and future mapgens will be using the biome API.
Nyancat generation is moved to a separate on-generated function to continue in all mapgens.
I also found some indev mapgen code to delete.

if mgname == "v6" then
minetest.register_on_generated(function(minp, maxp, seed)
default.mgv6ongen(minp, maxp, seed)
end)

This comment has been minimized.

Copy link
@ShadowNinja

ShadowNinja Nov 6, 2014

Member

You can pass default.mgv6ongen directly to register_on_generated instead of proxying it.

Also, I'd name it mgv6_ongen...

end

minetest.register_on_generated(function(minp, maxp, seed)
default.generate_nyancats(seed, minp, maxp)

This comment has been minimized.

Copy link
@ShadowNinja

ShadowNinja Nov 6, 2014

Member

Same as above, but you'll have to change generate_nyancats' argument order, or make default.generate_nyancats a proxy to a function with the other order if compatibility is a concern.

@@ -506,8 +400,70 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end
end
end

minetest.register_on_mapgen_init(function(MapgenParams)

This comment has been minimized.

Copy link
@ShadowNinja

ShadowNinja Nov 6, 2014

Member

Variable names shouldn't be in UpperCammelCase. This should be mapgen_params or mgparams.

@ShadowNinja

This comment has been minimized.

Copy link
Member

commented Nov 6, 2014

Seems good other than a few nitpicks.

@paramat

This comment has been minimized.

Copy link
Member Author

commented Nov 8, 2014

Thanks, i tried

minetest.register_on_generated(
            default.mgv6_ongen(minp, maxp, seed)
)

But it didn't work, not sure how to pass mgv6_ongen directly to register_on_generated.

The upper camelcase is kwolekr's work =)

@ShadowNinja

This comment has been minimized.

Copy link
Member

commented Nov 8, 2014

@paramat: It's just minetest.register_on_generated(default.mgv6_ongen) You pass a function to register_on_generated which it calls with the minp, maxp, and seed arguments. What you're doing is calling default.mgv6_ongen(minp, maxp, seed), where minp, maxp, and seed are probably nil. If the function even finishes running without crashing it will return nil, and register_on_generated will try to call nil to generate chunks.

@paramat paramat force-pushed the paramat:mgv6ongen branch from d19fff7 to 52b6013 Nov 9, 2014

@paramat paramat force-pushed the paramat:mgv6ongen branch from 52b6013 to c0d2b5d Nov 9, 2014

@paramat

This comment has been minimized.

Copy link
Member Author

commented Nov 9, 2014

Okay done, tested, rebased and squashed into 1 commit, thanks for the code advice.

@rubenwardy

This comment has been minimized.

Copy link
Member

commented Nov 15, 2014

👍 This needs to be added.

@paramat

This comment has been minimized.

Copy link
Member Author

commented Nov 15, 2014

@sfan5

This comment has been minimized.

Copy link
Member

commented Nov 16, 2014

@sfan5 sfan5 closed this Nov 16, 2014

@paramat paramat deleted the paramat:mgv6ongen branch Nov 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.