Add MapClassification.Generated.

Generated maps are created at runtime using a
mod-defined trait. They are embedded directly
into replays and save games as they exist in
memory only, and disappear after the game exits.
This commit is contained in:
Paul Chote
2025-04-17 18:54:38 +01:00
committed by Gustas Kažukauskas
parent 6be947bbf0
commit 979483b63c
15 changed files with 226 additions and 6 deletions

View File

@@ -667,6 +667,21 @@ namespace OpenRA.Mods.Common.Server
var m = server.ModData.MapCache[s];
if (m.Status == MapStatus.Available || m.Status == MapStatus.DownloadAvailable)
SelectMap(m);
else if (m.Class == MapClassification.Generated)
{
if (m.Status == MapStatus.Generating)
{
// Wait up to 5 seconds for the map to be generated
var stopwatch = Stopwatch.StartNew();
while (m.Status == MapStatus.Generating && stopwatch.ElapsedMilliseconds < 5000)
Thread.Sleep(100);
}
if (m.Status == MapStatus.Available)
SelectMap(m);
else
QueryFailed();
}
else if (server.Settings.QueryMapRepository)
{
server.SendFluentMessageTo(conn, SearchingMap);