move weather library out of gfx
This commit is contained in:
parent
8640730520
commit
7a86cbdd60
@ -273,7 +273,7 @@ console.add_command(
|
|||||||
return "weather preset not found"
|
return "weather preset not found"
|
||||||
end
|
end
|
||||||
local preset = json.parse(file.read(filename))
|
local preset = json.parse(file.read(filename))
|
||||||
gfx.weather.change(preset, args[2], args[1])
|
weather.change(preset, args[2], args[1])
|
||||||
return "weather set to "..filename.." preset ("..tostring(args[2]).." s)"
|
return "weather set to "..filename.." preset ("..tostring(args[2]).." s)"
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@ -282,9 +282,9 @@ console.add_command(
|
|||||||
"weather",
|
"weather",
|
||||||
"Display current weather preset name",
|
"Display current weather preset name",
|
||||||
function (args, kwargs)
|
function (args, kwargs)
|
||||||
local name = gfx.weather.get_current()
|
local name = weather.get_current()
|
||||||
if name == "" then
|
if name == "" then
|
||||||
return "unnamed " .. json.tostring(gfx.weather.get_current_data(), true)
|
return "unnamed " .. json.tostring(weather.get_current_data(), true)
|
||||||
else
|
else
|
||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
|
|||||||
@ -46,7 +46,7 @@ extern const luaL_Reg utf8lib[];
|
|||||||
extern const luaL_Reg vec2lib[]; // vecn.cpp
|
extern const luaL_Reg vec2lib[]; // vecn.cpp
|
||||||
extern const luaL_Reg vec3lib[]; // vecn.cpp
|
extern const luaL_Reg vec3lib[]; // vecn.cpp
|
||||||
extern const luaL_Reg vec4lib[]; // vecn.cpp
|
extern const luaL_Reg vec4lib[]; // vecn.cpp
|
||||||
extern const luaL_Reg weatherlib[]; // gfx.weather
|
extern const luaL_Reg weatherlib[];
|
||||||
extern const luaL_Reg worldlib[];
|
extern const luaL_Reg worldlib[];
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#include "libhud.hpp"
|
#include "api_lua.hpp"
|
||||||
#include "world/Level.hpp"
|
#include "world/Level.hpp"
|
||||||
#include "world/World.hpp"
|
#include "world/World.hpp"
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ static int l_get_current(lua::State* L) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_get_fall_intencity(lua::State* L) {
|
static int l_get_fall_intensity(lua::State* L) {
|
||||||
auto& weather = require_weather();
|
auto& weather = require_weather();
|
||||||
const auto& a = weather.a;
|
const auto& a = weather.a;
|
||||||
const auto& b = weather.b;
|
const auto& b = weather.b;
|
||||||
@ -58,10 +58,10 @@ static int l_is_transition(lua::State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const luaL_Reg weatherlib[] = {
|
const luaL_Reg weatherlib[] = {
|
||||||
{"change", wrap_hud<l_change>},
|
{"change", lua::wrap<l_change>},
|
||||||
{"get_current", wrap_hud<l_get_current>},
|
{"get_current", lua::wrap<l_get_current>},
|
||||||
{"get_current_data", wrap_hud<l_get_current_data>},
|
{"get_current_data", lua::wrap<l_get_current_data>},
|
||||||
{"get_fall_intencity", wrap_hud<l_get_fall_intencity>},
|
{"get_fall_intensity", lua::wrap<l_get_fall_intensity>},
|
||||||
{"is_transition", wrap_hud<l_is_transition>},
|
{"is_transition", lua::wrap<l_is_transition>},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -73,6 +73,7 @@ static void create_libs(State* L, StateType stateType) {
|
|||||||
openlib(L, "player", playerlib);
|
openlib(L, "player", playerlib);
|
||||||
openlib(L, "time", timelib);
|
openlib(L, "time", timelib);
|
||||||
openlib(L, "world", worldlib);
|
openlib(L, "world", worldlib);
|
||||||
|
openlib(L, "weather", weatherlib);
|
||||||
|
|
||||||
openlib(L, "entities", entitylib);
|
openlib(L, "entities", entitylib);
|
||||||
openlib(L, "cameras", cameralib);
|
openlib(L, "cameras", cameralib);
|
||||||
|
|||||||
@ -36,7 +36,6 @@ void scripting::on_frontend_init(Hud* hud, WorldRenderer* renderer) {
|
|||||||
lua::openlib(L, "gfx", "blockwraps", blockwrapslib);
|
lua::openlib(L, "gfx", "blockwraps", blockwrapslib);
|
||||||
lua::openlib(L, "gfx", "particles", particleslib);
|
lua::openlib(L, "gfx", "particles", particleslib);
|
||||||
lua::openlib(L, "gfx", "text3d", text3dlib);
|
lua::openlib(L, "gfx", "text3d", text3dlib);
|
||||||
lua::openlib(L, "gfx", "weather", weatherlib);
|
|
||||||
|
|
||||||
load_script("hud_classes.lua");
|
load_script("hud_classes.lua");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user