Add daemon-owned dockyard station variant

This commit is contained in:
Meta Vens 2026-07-19 15:59:35 +01:00
commit 0b5284f5af
10 changed files with 438 additions and 15 deletions

View file

@ -8,6 +8,8 @@ namespace GameCult.Aetheria.State.Verse
{
public static class AetheriaRuntimeAssets
{
public const string PresentationHullItemTagPrefix = "presentation-hull-item:";
public static string ResolveEntityPrefabAssetRef(
AetheriaRuntimeEntitySnapshotCommit entity,
AetheriaRuntimeCatalogSnapshot? catalog = null)
@ -15,7 +17,7 @@ namespace GameCult.Aetheria.State.Verse
if (entity == null) return "";
var hull = catalog?.FindItem(entity.HullItemKey ?? "");
if (hull != null && !string.IsNullOrWhiteSpace(hull.HullPrefab))
return HullPrefabAssetKey(hull.ItemKey);
return HullPrefabAssetKey(ResolvePresentationHull(hull, catalog!).ItemKey);
var kind = (entity.Kind ?? "").Trim().ToLowerInvariant();
if (kind.Contains("station")) return "prefab.entity.station";
if (kind.Contains("projectile")) return "prefab.entity.projectile";
@ -79,6 +81,9 @@ namespace GameCult.Aetheria.State.Verse
if (!string.IsNullOrWhiteSpace(item.HullPrefab))
{
var presentationHull = ResolvePresentationHull(item, catalog!);
if (!string.Equals(presentationHull.ItemKey, item.ItemKey, StringComparison.Ordinal))
continue;
Add(entries, MapPrefab(
HullPrefabAssetKey(item.ItemKey),
string.IsNullOrWhiteSpace(item.Name) ? item.ItemKey : item.Name,
@ -110,6 +115,28 @@ namespace GameCult.Aetheria.State.Verse
};
}
private static AetheriaRuntimeCatalogItem ResolvePresentationHull(
AetheriaRuntimeCatalogItem hull,
AetheriaRuntimeCatalogSnapshot catalog)
{
var aliases = (hull.Tags ?? Array.Empty<string>())
.Where(tag => tag != null && tag.StartsWith(PresentationHullItemTagPrefix, StringComparison.Ordinal))
.Select(tag => tag.Substring(PresentationHullItemTagPrefix.Length).Trim())
.Where(itemKey => itemKey.Length > 0)
.Distinct(StringComparer.Ordinal)
.ToArray();
if (aliases.Length == 0)
return hull;
if (aliases.Length != 1)
throw new InvalidOperationException($"Hull '{hull.ItemKey}' advertises multiple presentation hulls.");
var presentationHull = catalog.FindItem(aliases[0]);
if (presentationHull == null || string.IsNullOrWhiteSpace(presentationHull.HullPrefab))
throw new InvalidOperationException(
$"Hull '{hull.ItemKey}' presentation hull '{aliases[0]}' is missing or has no provider prefab.");
return presentationHull;
}
public static AetheriaRuntimeAssetRef ResolveEntityIcon(AetheriaRuntimeViewportObject? obj)
{
if (obj?.Controlled == true)

View file

@ -1766,6 +1766,27 @@ namespace GameCult.Aetheria.State.Verse
return true;
}
if (string.Equals(
Environment.GetEnvironmentVariable("AETHERIA_TRACE_EVE_SNAPSHOTS"),
"1",
StringComparison.Ordinal))
{
var candidates = entities
.Where(candidate => candidate != null && candidate.EntityIndex != actorIndex)
.Select(candidate =>
{
var dx = candidate.PositionX - actor.PositionX;
var dz = candidate.PositionZ - actor.PositionZ;
var bays = candidate.DockingBays ?? Array.Empty<AetheriaRuntimeLoadoutItemSlotCommit>();
var assignments = candidate.DockingBayAssignments ?? Array.Empty<int>();
return $"{candidate.EntityIndex}:distance={Math.Sqrt((dx * dx) + (dz * dz)):0.###}," +
$"bays={bays.Count},assignments=[{string.Join(",", assignments)}]";
});
Console.WriteLine(
$"Dock-nearest rejected actor={actorEntityKey} maxDistance={maxDistance:0.###} " +
$"candidates=[{string.Join(";", candidates)}]");
}
return false;
}
@ -1864,6 +1885,10 @@ namespace GameCult.Aetheria.State.Verse
.ToArray();
assignments[bayIndex] = actorIndex;
target.DockingBayAssignments = assignments.ToArray();
actor.VelocityX = 0;
actor.VelocityY = 0;
actor.HelmStrafe = 0;
actor.HelmForward = 0;
DisarmWeapons(actor);
return true;
}