mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Add L-system trees as decorations (#14355)
This commit is contained in:
parent
f07e1026ac
commit
60810c2d37
10 changed files with 125 additions and 46 deletions
|
@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "mapgen/mg_schematic.h"
|
||||
#include "mapgen/mapgen_v5.h"
|
||||
#include "mapgen/mapgen_v7.h"
|
||||
#include "mapgen/treegen.h"
|
||||
#include "filesys.h"
|
||||
#include "settings.h"
|
||||
#include "log.h"
|
||||
|
@ -110,6 +111,7 @@ bool read_schematic_def(lua_State *L, int index,
|
|||
|
||||
bool read_deco_simple(lua_State *L, DecoSimple *deco);
|
||||
bool read_deco_schematic(lua_State *L, SchematicManager *schemmgr, DecoSchematic *deco);
|
||||
bool read_deco_lsystem(lua_State *L, const NodeDefManager *ndef, DecoLSystem *deco);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1226,6 +1228,7 @@ int ModApiMapgen::l_register_decoration(lua_State *L)
|
|||
success = read_deco_schematic(L, schemmgr, (DecoSchematic *)deco);
|
||||
break;
|
||||
case DECO_LSYSTEM:
|
||||
success = read_deco_lsystem(L, ndef, (DecoLSystem *)deco);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1308,6 +1311,17 @@ bool read_deco_schematic(lua_State *L, SchematicManager *schemmgr, DecoSchematic
|
|||
return schem != NULL;
|
||||
}
|
||||
|
||||
bool read_deco_lsystem(lua_State *L, const NodeDefManager *ndef, DecoLSystem *deco)
|
||||
{
|
||||
deco->tree_def = std::make_shared<treegen::TreeDef>();
|
||||
|
||||
lua_getfield(L, 1, "treedef");
|
||||
bool has_def = read_tree_def(L, -1, ndef, *(deco->tree_def));
|
||||
lua_pop(L, 1);
|
||||
|
||||
return has_def;
|
||||
}
|
||||
|
||||
|
||||
// register_ore({lots of stuff})
|
||||
int ModApiMapgen::l_register_ore(lua_State *L)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue