mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-14 07:47:13 +00:00
A world server answers the client's level editor: it remembers per connection whether the editor is on (and never sends such a client a zone load), takes and gives up the zone's lock, says whether files may be sent, takes them, sends the zone's files, and reloads the zone. Who may is the same as for the dashboard's zone file API: the account's editor level against zone_publish_gm_level, the zone's editors or an admin, and the lock's holder to send files. Files are unpacked, checked, written and packed on a worker thread, and every request is in the audit log. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
45 lines
1.9 KiB
C++
45 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#include "RakNetTypes.h"
|
|
|
|
/**
|
|
* The game client's level editor, on a world server (docs/ZonePublish.md): the client says when its editor is on,
|
|
* locks the zone, sends the zone's files, asks for them and asks for a reload. Everything goes through what the
|
|
* dashboard's zone file API uses: the same checks (ZonePublish), override folder (ZoneOverrideStore), locks and
|
|
* editors (ZoneEditLock, IZoneEditing), audit log entries and world reload. Only how the files travel is different
|
|
* (ZoneFilePack).
|
|
*
|
|
* Packets are read and answered on the main thread. Unpacking, checking, writing and packing files run on one worker
|
|
* thread, which touches no connection, database or setting and hands its result back to the main thread (Update).
|
|
*/
|
|
namespace ZoneEditor {
|
|
// The client's editor was started or ended (it sends nothing else about it)
|
|
void SetEditing(const SystemAddress& sysAddr, bool editing);
|
|
bool IsEditing(const SystemAddress& sysAddr);
|
|
|
|
/**
|
|
* Whether a client may be told to load a zone. Never while its editor is on: the client drops its connection
|
|
* when it is told to load a zone then.
|
|
*/
|
|
bool MaySendZoneLoad(const SystemAddress& sysAddr);
|
|
|
|
// The connection is gone: nothing is kept about it
|
|
void Forget(const SystemAddress& sysAddr);
|
|
|
|
// The editor's requests (fileType and levelFileId as the client sent them)
|
|
void HandleLock(const SystemAddress& sysAddr, bool lock);
|
|
void HandlePushRequest(const SystemAddress& sysAddr, uint8_t fileType, int32_t levelFileId);
|
|
void HandlePush(const SystemAddress& sysAddr, uint8_t fileType, int32_t levelFileId, std::string packedFiles);
|
|
void HandlePull(const SystemAddress& sysAddr, uint8_t fileType, int32_t levelFileId);
|
|
void HandleReload(const SystemAddress& sysAddr);
|
|
|
|
// Every frame: finish what the worker did
|
|
void Update();
|
|
|
|
// Stops the worker (files being written are finished first)
|
|
void Shutdown();
|
|
}
|