add gfx.weather library & add weather.set command
This commit is contained in:
@@ -46,6 +46,7 @@ extern const luaL_Reg utf8lib[];
|
||||
extern const luaL_Reg vec2lib[]; // vecn.cpp
|
||||
extern const luaL_Reg vec3lib[]; // vecn.cpp
|
||||
extern const luaL_Reg vec4lib[]; // vecn.cpp
|
||||
extern const luaL_Reg weatherlib[]; // gfx.weather
|
||||
extern const luaL_Reg worldlib[];
|
||||
|
||||
// Components
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "libhud.hpp"
|
||||
|
||||
using namespace scripting;
|
||||
|
||||
static int l_change(lua::State* L) {
|
||||
WeatherPreset weather {};
|
||||
weather.deserialize(lua::tovalue(L, 1));
|
||||
float time = lua::tonumber(L, 2);
|
||||
renderer->weather.change(std::move(weather), time);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg weatherlib[] = {
|
||||
{"change", wrap_hud<l_change>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
@@ -36,6 +36,7 @@ void scripting::on_frontend_init(Hud* hud, WorldRenderer* renderer) {
|
||||
lua::openlib(L, "gfx", "blockwraps", blockwrapslib);
|
||||
lua::openlib(L, "gfx", "particles", particleslib);
|
||||
lua::openlib(L, "gfx", "text3d", text3dlib);
|
||||
lua::openlib(L, "gfx", "weather", weatherlib);
|
||||
|
||||
load_script("hud_classes.lua");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user