Skip to content

XCIM Data not properly loaded in Cell/ICellGetter #597

@JunaMeinhold

Description

@JunaMeinhold

Hello,
I tried gathering all Landscape records for a certain mod and then the winning records to merge them later and encountered multiple issues:

  • IModContext<ICellGetter>.ImageSpace always null.
  • IModContext<ICellGetter>.ModKey of the winning Record the is “Northern Roads.esp”, but expected is “Northern Roads - Lux patch.esp” (See image).
  • Lux.esp is not showing up in the LoadOrder, despite being present in the RawLoadOrder
  • A huge deviation between RawLoadOrder and LoadOrder in count (raw 726 vs 170)

Test bench: (Simplified version of Program.cs)

public static void RunPatch(IPatcherState<ISkyrimMod, ISkyrimModGetter> state)
{
    state.LinkCache.Warmup<Landscape>();
    state.LinkCache.Warmup<Worldspace>();

    foreach (var winningRecord in state.LinkCache.AllIdentifiers<Landscape>())
    {
        var winner = state.LinkCache.ResolveSimpleContext<ILandscapeGetter>(winningRecord.FormKey);

        ICellGetter? winnerCellGetter = (ICellGetter?)winner.Parent?.Record;
        if (winnerCellGetter == null)
            continue;
        IWorldspaceSubBlockGetter? subBlockGetter = (IWorldspaceSubBlockGetter?)winner.Parent?.Parent?.Record;
        if (subBlockGetter == null)
            continue;
        IWorldspaceBlockGetter? blockGetter = (IWorldspaceBlockGetter?)winner.Parent?.Parent?.Parent?.Record;
        if (blockGetter == null)
            continue;
        IWorldspaceGetter? worldspaceGetter = (IWorldspaceGetter?)winner.Parent?.Parent?.Parent?.Parent?.Record;
        if (worldspaceGetter == null)
            continue;

        worldspaceGetter = state.LinkCache.ResolveSimpleContext<IWorldspaceGetter>(worldspaceGetter.FormKey).Record ?? throw new InvalidOperationException($"IWorldspaceGetter is null {worldspaceGetter.FormKey}");

        if (worldspaceGetter.Name!.String == "Blackreach")
        {
            if (blockGetter.BlockNumberX == 0 && blockGetter.BlockNumberX == 0)
            {
                if (subBlockGetter.BlockNumberX == 0 && subBlockGetter.BlockNumberX == 0)
                {
                    Console.WriteLine(winnerCellGetter.ImageSpace); // always null
                    Console.WriteLine(winner.ModKey); // "Northern Roads.esp" but should be "Northern Roads - Lux patch.esp"
                }
            }
        }
    }
}

Image

Source code:
https://github.com/JunaMeinhold/NorthernRoadsPatcher

What the patcher does:
It tries to forward Landscape data from Northern Roads (and any patch with the name in it) to prevent Terrain holes when other mods overwrite it.

Load Order/Mods details:
Mods installed: 939
Plugins: Active 160, Light: 563
My Load Order: https://github.com/JunaMeinhold/NorthernRoadsPatcher/blob/testbench/NorthernRoadsPatcher/loadorder.txt
If you need the full mod list just ask and i make a collection on nexus.

Best regards
Juna

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions