diff options
author | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-12 18:16:06 -0400 |
---|---|---|
committer | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-12 18:16:06 -0400 |
commit | 2564533a4860a8452abc27ba05115ca11ed4a787 (patch) | |
tree | 67c5dfb2e892f0d492d977b8a5fa42321f2fa4a5 /src/world.cpp | |
parent | 8f0db67c5fdbc1e7b8759f44b45ad64caf336cb5 (diff) |
Ability to pass world data into Lua
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/world.cpp b/src/world.cpp index 63769a9..9e289ea 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -26,11 +26,34 @@ World::World(sol::object ref) { if (ref.get_type() == sol::type::table) { - + sol::table tab = ref; + if (tab["Seed"] == sol::type::number) { + seed = tab["Seed"]; + } + if (tab["Layers"] == sol::type::number) { + layers = tab["Layers"]; + } + if (tab["Generate"] == sol::type::function) { + generate = tab["Generate"]; + } } else { // TODO better logging std::cerr << "World paramaters must be stored in a table" << std::endl; } + generate(this); +} + +void World::setData(unsigned int x, + unsigned int y, + unsigned int z, + unsigned int d) +{ + (void)x; + (void)y; + (void)z; + (void)d; + + // TODO actually do stuff here } |