mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
add gfx.weather library & add weather.set command
This commit is contained in:
parent
02d8d8d6bf
commit
4d5b450145
8 changed files with 44 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
16
src/logic/scripting/lua/libs/libweather.cpp
Normal file
16
src/logic/scripting/lua/libs/libweather.cpp
Normal file
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue