feat: worlds starting up on the dashboard; the prestarted worlds are a setting

The dashboard shows worlds master has launched but that aren't connected
yet (Starting) and those shutting down, on the main page's world list
and in /api/worlds (state: starting|stopping), without a shutdown
button. Master's server list now carries each world's state (appended
after the UGC fields, one byte per world) and master pushes the list to
the dashboard whenever a world is launched, becomes ready, is told to
shut down or goes away, instead of the dashboard only seeing it on its
30 second poll. Starting worlds are kept apart from the running ones,
so counts, events and shutdown requests still only see running worlds.

prestart_worlds (masterconfig.ini, zone ids) lists the worlds master
starts when prestart_servers is on, instead of the hardcoded character
select (0) and Venture Explorer (1000), which stay the default when it
is missing or empty. It is on the Settings page as a zone list (restart
only), shown when prestart_servers is on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-27 19:19:19 -05:00
parent 37459e0019
commit dce2037d9d
13 changed files with 129 additions and 25 deletions

View File

@@ -1,4 +1,6 @@
#pragma once
#include <functional>
#include <algorithm>
#include "SpareBackoff.h"
#include <map>
@@ -138,6 +140,9 @@ public:
const std::vector<InstancePtr>& GetInstances() const;
void AddInstance(InstancePtr& instance);
// Called on the main thread whenever a world is launched, becomes ready or is removed (for the dashboard's list)
void SetOnInstancesChanged(std::function<void()> callback) { m_OnInstancesChanged = std::move(callback); }
void RemoveInstance(const InstancePtr& instance);
void ReadyInstance(const InstancePtr& instance);
@@ -187,4 +192,5 @@ private:
int GetSoftCap(LWOMAPID mapID);
int GetHardCap(LWOMAPID mapID);
const InstancePtr& CreateInstance(LWOMAPID mapID, LWOCLONEID cloneID);
std::function<void()> m_OnInstancesChanged;
};