Implement autodeletion of players on logout

This commit is contained in:
2024-03-04 16:33:23 -05:00
parent c2a94b5332
commit 044bb89edf
4 changed files with 84 additions and 11 deletions

View File

@@ -76,6 +76,39 @@ public:
//
PrintBuffer print_buffer_;
// Can-Be-Controlled flag.
//
// This flag indicates whether the tangible can be controlled
// by a client. Clients will not be allowed to attach to tangibles
// who don't have this flag. If this flag is true, the
// tangible cannot be deleted using a mere 'tangible.delete', instead,
// you have to use 'tangible.deleteplayer'.
//
bool can_be_controlled_;
// Is Controlled Flag.
//
// This flag is set to true when a client is controlling this player.
// It gets set back to false when the client logs out or attaches
// to a different player. This can only be set in master models.
//
bool is_controlled_;
// Force disconnect flag.
//
// This flag is used to force the client to log out ASAP. This flag
// can only be set in master models.
//
bool force_disconnect_;
// Delete on Logout Flag.
//
// This flag can be set on a controlled player. When the player
// disconnects, their character will be deleted. This flag can only
// be set if the is_controlled_ flag is true.
//
bool delete_on_disconnect_;
// constructor.
//
Tangible(World *w, int64_t id);
@@ -184,10 +217,20 @@ public:
// This is used to create a temporary actor which is used during
// the login process.
//
// If initialize is true, then the function 'login.initialize'
// will be executed.
// If this is a master model, The function 'login.initialize'
// called. Then, the following login flags are set:
// can_be_controlled, is_controlled, and delete_on_disconnect.
//
// In a client model, 'login.initialize' is not called,
// and the login flags are not used in client models.
//
int64_t create_login_actor(bool initialize);
int64_t create_login_actor();
// Log out a connected player.
//
// This is to be called after a client disconnects.
//
void disconnected(int64_t actor_id);
// Fetch all redirects and clear the redirects table.
//