mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 16:55:27 +00:00
The source no longer destroys the player's own ghost: losing it hid the character, and the target's construction brought it back with the login effect (LWOGhostComponent::OnGhostReceiveDestruction, 0x00c99410, LWOBaseRenderComponent::OnEnterScope, 0x00be2150). The target constructs the player to its own client without a position and with world transition state 3. The client sends PlayerLoaded itself after that construction, so the server only runs it when none came within 5 s, and PlayerReady (camera pitch reset) is not sent. A seamless arrival is only expected for 30 s, so a later login gets LOAD_STATIC_ZONE. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
83 lines
3.8 KiB
C++
83 lines
3.8 KiB
C++
#ifndef __WORLDMIGRATION__H__
|
|
#define __WORLDMIGRATION__H__
|
|
|
|
#include <functional>
|
|
|
|
#include "master/InstanceMigration.h"
|
|
#include "master/LiveUpdate.h"
|
|
#include "RakNetTypes.h"
|
|
#include "dCommonVars.h"
|
|
|
|
class Entity;
|
|
|
|
/**
|
|
* A world server's side of instance migrations (InstanceMigration.h, docs/SeamlessTransfer.md).
|
|
*
|
|
* As the source: warns everyone with the client's own "Mythran Maintenance Alert", then moves players a few at a
|
|
* time. Each is saved (position included), locked (their packets are ignored and they aren't saved again when they
|
|
* disconnect, so nothing they do after the save can be lost or duplicated), and sent TRANSFER_TO_WORLD with the
|
|
* Mythran shift flag. As the target: puts back what was carried over (the pet that was out) once they have loaded.
|
|
* GMs start migrations with /replaceinstance and /mergeinstance.
|
|
*/
|
|
namespace WorldMigration {
|
|
// What a disconnect runs (save and remove the user); used to drop players whose client never left
|
|
void SetCleanupHandler(std::function<void(const SystemAddress&)> handler);
|
|
|
|
// MIGRATE_PLAYERS from master (a target port of 0 cancels the running migration)
|
|
void HandleOrder(const MigratePlayersOrder& order);
|
|
|
|
// MIGRATE_PLAYER_STATE from master: a player on their way here
|
|
void StoreCarriedState(const CarriedPlayerState& state);
|
|
|
|
// MIGRATE_PREPARE from master (live update of a property): wait for builders, save the property and freeze it
|
|
void HandlePrepare(const MigratePrepare& prepare);
|
|
|
|
// The player entity of someone moved here was just made: put them where they stood (properties don't save it)
|
|
void ApplyCarriedPosition(Entity* player);
|
|
|
|
// Every world frame
|
|
void Update(float deltaTime);
|
|
|
|
// The player was sent away: ignore their packets, and don't save them again when they disconnect
|
|
bool IsLeaving(const SystemAddress& sysAddr);
|
|
|
|
// Their connection closed; forget them
|
|
void OnDisconnected(const SystemAddress& sysAddr);
|
|
|
|
// A player finished loading here (PLAYER_LOADED)
|
|
void OnPlayerLoaded(Entity* player);
|
|
|
|
// Experimental seamless migration: this character is on its way and its client kept the zone loaded, so it must
|
|
// not be sent LOAD_STATIC_ZONE (that tears the scene down); load it at once instead
|
|
bool ArrivesSeamlessly(LWOOBJID characterId);
|
|
|
|
// While `keep` is set, constructions of a seamlessly arriving player leave out what would reset its client's own
|
|
// player: the position (the client stands where it is) and the world transition (no fade from white). Set only
|
|
// around the construction that goes to the player's own client; does nothing for other players.
|
|
void KeepClientPlayer(Entity* player, bool keep);
|
|
|
|
// Its player entity was created and constructed: the client sends PlayerLoaded itself; a fallback runs it if not
|
|
void OnSeamlessArrival(Entity* player);
|
|
|
|
// MIGRATE_STATUS from master: tell the GM who asked, if they are here
|
|
void HandleStatus(const MigrationStatus& status);
|
|
|
|
// Ask master to move everyone in this instance; the seam a dashboard or other tool can use too, by sending
|
|
// INSTANCE_MIGRATE to master
|
|
void RequestMigration(Entity* requester, InstanceMigration::eKind kind, uint32_t targetInstance, uint16_t warnSeconds, bool seamless);
|
|
|
|
// /replaceinstance [warn seconds] [seamless]
|
|
void ReplaceInstanceCommand(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
|
|
|
// /mergeinstance [target instance, 0 for the best fit] [warn seconds] [seamless]
|
|
void MergeInstanceCommand(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
|
|
|
// /liveupdate [start [warn seconds] | cancel | status]: a live update of the whole server (docs/LiveUpdate.md)
|
|
void LiveUpdateCommand(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
|
|
|
// LIVE_UPDATE_STATUS from master: tell the GM who asked, if they are here
|
|
void HandleLiveUpdateStatus(const LiveUpdateStatus& status);
|
|
}
|
|
|
|
#endif //!__WORLDMIGRATION__H__
|