Implement the core of the login system

This commit is contained in:
2021-03-30 18:35:08 -04:00
parent 795a45c950
commit aa7de03c57
4 changed files with 113 additions and 32 deletions

View File

@@ -68,12 +68,13 @@ public:
//
int64_t id() { return plane_item_.id(); }
void be_a_player();
// void be_a_player();
void update_plane_item();
};
class World {
public:
// A lua intepreter with snapshot function.
//
LuaSnap lua_snap_;
@@ -99,8 +100,16 @@ public:
// Serialized snapshot of world model.
StreamBuffer snapshot_;
// Redirects.
//
using Redirects = std::map<int64_t, int64_t>;
Redirects redirects_;
void run_scheduled_threads(int64_t clk);
static void store_global_pointer(lua_State *L, World *w);
// Check if main thread has nothing on the stack
bool stack_is_clear() const { return lua_gettop(state()) == 0; }
public:
// Constructor.
//
@@ -125,7 +134,7 @@ public:
//
// Get the lua interpreter associated with this world model.
//
lua_State *state() { return lua_snap_.state(); }
lua_State *state() const { return lua_snap_.state(); }
// get_near
//
@@ -157,6 +166,18 @@ public:
//
void tangible_delete(lua_State *L, int64_t id);
// Create a login actor.
//
// Creates a tangible of class 'login' and returns its ID.
// This is used to create a temporary actor which is used during
// the login process.
//
int64_t create_login_actor();
// Fetch all redirects and clear the redirects table.
//
Redirects fetch_redirects();
// Probe the 'interface' function of the specified sprite.
//
void update_gui(int64_t actor_id, int64_t place_id, Gui *gui);