Change the creation/deletion of tangibles so that the tangible database is never really deleted.

This commit is contained in:
2023-03-16 23:31:29 -04:00
parent 86a27ef2d4
commit a8c780563f
9 changed files with 152 additions and 90 deletions

View File

@@ -222,9 +222,8 @@ int LuaTypeTagValue(lua_State *L) { return 0; }
#define LUA_TT_GLOBALENV 18
#define LUA_TT_TANGIBLE 19
#define LUA_TT_TANGIBLEMETA 20
#define LUA_TT_DEADTANGIBLE 21
#define LUA_TT_GLOBALDB 22
#define LUA_TT_CLASS 23
#define LUA_TT_GLOBALDB 21
#define LUA_TT_CLASS 22
// World types enum.
@@ -458,8 +457,16 @@ public:
void makeclass(LuaSlot tab, LuaSlot name) const;
void makeclass(LuaSlot tab, std::string_view name) const;
// Get the ID of a tangible. It's a little weird to put this in
// this module.
// Create a tangible, or look up an existing tangible.
// This doesn't do the entire process of tangible creation. It
// just creates an empty table, marks it as a tangible, creates
// the metatable, stores the tangible ID, and stores it in the tangible table.
void maketan(LuaSlot tab, int64_t id) const;
// Return true if a tangible is empty (deleted or not yet created).
bool tanblank(LuaSlot tab) const;
// Get the ID of a tangible.
int64_t tanid(LuaSlot tab) const;
// Return true if the value is a sortable key (string, number, or boolean).