1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

GenElementManager: Pass opaque handles to Lua and rename to ObjDefManager

Add core.clear_registered_schematics() and refactor schematics somewhat
This commit is contained in:
kwolekr 2015-03-30 23:40:35 -04:00
parent 6a48844eba
commit ed10005d38
16 changed files with 363 additions and 203 deletions

View file

@ -42,7 +42,7 @@ class NodeResolver;
#define MTSCHEM_PROB_ALWAYS 0xFF
class Schematic : public GenElement, public NodeResolver {
class Schematic : public ObjDef, public NodeResolver {
public:
std::vector<content_t> c_nodes;
@ -62,7 +62,7 @@ public:
Rotation rot, bool force_placement, INodeDefManager *ndef);
bool loadSchematicFromFile(const char *filename, INodeDefManager *ndef,
std::map<std::string, std::string> &replace_names);
StringMap *replace_names);
void saveSchematicToFile(const char *filename, INodeDefManager *ndef);
bool getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2);
@ -73,14 +73,16 @@ public:
std::vector<std::pair<s16, u8> > *splist);
};
class SchematicManager : public GenElementManager {
class SchematicManager : public ObjDefManager {
public:
static const char *ELEMENT_TITLE;
static const size_t ELEMENT_LIMIT = 0x10000;
SchematicManager(IGameDef *gamedef);
~SchematicManager() {}
const char *getObjectTitle() const
{
return "schematic";
}
Schematic *create(int type)
{
return new Schematic;