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

Derive NodeMetaRef from MetaDataRef

This commit is contained in:
rubenwardy 2017-01-31 16:43:45 +00:00
parent 13f94ecad5
commit c2e7b1f579
9 changed files with 407 additions and 232 deletions

View file

@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define L_NODEMETA_H_
#include "lua_api/l_base.h"
#include "lua_api/l_metadata.h"
#include "irrlichttypes_bloated.h"
class ServerEnvironment;
@ -29,7 +30,7 @@ class NodeMetadata;
NodeMetaRef
*/
class NodeMetaRef : public ModApiBase {
class NodeMetaRef : public MetaDataRef {
private:
v3s16 m_p;
ServerEnvironment *m_env;
@ -52,42 +53,22 @@ private:
* @param auto_create when true, try to create metadata information for the node if it has none.
* @return pointer to a @c NodeMetadata object or @c NULL in case of error.
*/
virtual NodeMetadata* getmeta(bool auto_create);
virtual Metadata* getmeta(bool auto_create);
virtual void clearMeta();
static void reportMetadataChange(NodeMetaRef *ref);
virtual void reportMetadataChange();
virtual void handleToTable(lua_State *L, Metadata *_meta);
virtual bool handleFromTable(lua_State *L, int table, Metadata *_meta);
// Exported functions
// garbage collector
static int gc_object(lua_State *L);
// get_string(self, name)
static int l_get_string(lua_State *L);
// set_string(self, name, var)
static int l_set_string(lua_State *L);
// get_int(self, name)
static int l_get_int(lua_State *L);
// set_int(self, name, var)
static int l_set_int(lua_State *L);
// get_float(self, name)
static int l_get_float(lua_State *L);
// set_float(self, name, var)
static int l_set_float(lua_State *L);
// get_inventory(self)
static int l_get_inventory(lua_State *L);
// to_table(self)
static int l_to_table(lua_State *L);
// from_table(self, table)
static int l_from_table(lua_State *L);
public:
NodeMetaRef(v3s16 p, ServerEnvironment *env);