world creation and generators menus moved to xml
This commit is contained in:
@@ -3,8 +3,12 @@
|
||||
#include "../scripting.h"
|
||||
#include "../../../world/Level.h"
|
||||
#include "../../../world/World.h"
|
||||
#include "../../../engine.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <filesystem>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
static int l_world_get_total_time(lua_State* L) {
|
||||
lua_pushnumber(L, scripting::level->getWorld()->totalTime);
|
||||
@@ -27,10 +31,18 @@ static int l_world_get_seed(lua_State* L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int l_world_exists(lua_State* L) {
|
||||
auto name = lua_tostring(L, 1);
|
||||
auto worldsDir = scripting::engine->getPaths()->getWorldFolder(name);
|
||||
lua_pushboolean(L, fs::is_directory(worldsDir));
|
||||
return 1;
|
||||
}
|
||||
|
||||
const luaL_Reg worldlib [] = {
|
||||
{"get_total_time", lua_wrap_errors<l_world_get_total_time>},
|
||||
{"get_day_time", lua_wrap_errors<l_world_get_day_time>},
|
||||
{"set_day_time", lua_wrap_errors<l_world_set_day_time>},
|
||||
{"get_seed", lua_wrap_errors<l_world_get_seed>},
|
||||
{"exists", lua_wrap_errors<l_world_exists>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user