namespace Age.Engine.Model;
public sealed class Script
{
public string Name { get; init; } = "";
/// Raw packed SYS4/AAI resource id used as this script's native ReadTextDB key.
public uint PackedId { get; init; }
public required ScriptHeader Header { get; init; }
public required IReadOnlyList Instructions { get; init; }
public required IReadOnlyDictionary IndexByOffset { get; init; }
public required IReadOnlyDictionary Strings { get; init; }
/// Unmodified SYS4 body dwords, retained for inline data operands such as opcode 0x64.
public IReadOnlyList BodyDwords { get; init; } = Array.Empty();
/// T1 entries: code DWORD offsets of op-0x71 message boundaries.
public IReadOnlyList ReadMessageOffsets { get; init; } = Array.Empty();
/// T2 entries: code DWORD offsets of resumable call-script sites.
public IReadOnlyList ScriptCallOffsets { get; init; } = Array.Empty();
/// T3 entries: code DWORD offsets used to reconstruct the intra-script call stack.
public IReadOnlyList LocalCallOffsets { get; init; } = Array.Empty();
public string GetString(int offset) => Strings.TryGetValue(offset, out var s) ? s : "";
}