move particles to gfx.particles
This commit is contained in:
parent
48add86120
commit
fdbe8ca9c6
@ -1,5 +1,5 @@
|
|||||||
function on_block_broken(id, x, y, z, playerid)
|
function on_block_broken(id, x, y, z, playerid)
|
||||||
particles.emit({x+0.5, y+0.5, z+0.5}, 64, {
|
gfx.particles.emit({x+0.5, y+0.5, z+0.5}, 64, {
|
||||||
lifetime=1.0,
|
lifetime=1.0,
|
||||||
spawn_interval=0.0001,
|
spawn_interval=0.0001,
|
||||||
explosion={4, 4, 4},
|
explosion={4, 4, 4},
|
||||||
|
|||||||
@ -599,6 +599,23 @@ namespace lua {
|
|||||||
setglobal(L, name);
|
setglobal(L, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void openlib(
|
||||||
|
lua::State* L,
|
||||||
|
const std::string& package,
|
||||||
|
const std::string& name,
|
||||||
|
const luaL_Reg* libfuncs
|
||||||
|
) {
|
||||||
|
if (!hasglobal(L, package)) {
|
||||||
|
createtable(L, 0, 1);
|
||||||
|
setglobal(L, package);
|
||||||
|
}
|
||||||
|
getglobal(L, package);
|
||||||
|
createtable(L, 0, 0);
|
||||||
|
luaL_setfuncs(L, libfuncs, 0);
|
||||||
|
setfield(L, name);
|
||||||
|
pop(L);
|
||||||
|
}
|
||||||
|
|
||||||
inline const char* require_string_field(
|
inline const char* require_string_field(
|
||||||
lua::State* L, const std::string& name, int idx=-1
|
lua::State* L, const std::string& name, int idx=-1
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ void scripting::on_frontend_init(Hud* hud, WorldRenderer* renderer) {
|
|||||||
auto L = lua::get_main_state();
|
auto L = lua::get_main_state();
|
||||||
|
|
||||||
lua::openlib(L, "hud", hudlib);
|
lua::openlib(L, "hud", hudlib);
|
||||||
lua::openlib(L, "particles", particleslib);
|
lua::openlib(L, "gfx", "particles", particleslib);
|
||||||
|
|
||||||
if (lua::getglobal(L, "__vc_create_hud_rules")) {
|
if (lua::getglobal(L, "__vc_create_hud_rules")) {
|
||||||
lua::call_nothrow(L, 0, 0);
|
lua::call_nothrow(L, 0, 0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user