add shel
This commit is contained in:
@@ -307,6 +307,7 @@ public sealed class CatalogLoader
|
||||
var bodyAttributes = new Dictionary<string, BodyAttributeDef>(StringComparer.Ordinal);
|
||||
var needs = new Dictionary<string, NeedDef>(StringComparer.Ordinal);
|
||||
var nameSets = new Dictionary<string, NameSetDef>(StringComparer.Ordinal);
|
||||
var subjects = new Dictionary<string, SubjectDef>(StringComparer.Ordinal);
|
||||
|
||||
foreach (var (key, json) in resolved)
|
||||
{
|
||||
@@ -351,6 +352,9 @@ public sealed class CatalogLoader
|
||||
case DefKind.NameSet:
|
||||
nameSets[key.Name] = Jsonc.Deserialize<NameSetDef>(json);
|
||||
break;
|
||||
case DefKind.Subject:
|
||||
subjects[key.Name] = Jsonc.Deserialize<SubjectDef>(json);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,6 +373,7 @@ public sealed class CatalogLoader
|
||||
bodyAttributes,
|
||||
needs,
|
||||
nameSets,
|
||||
subjects,
|
||||
ru,
|
||||
en);
|
||||
}
|
||||
@@ -421,6 +426,33 @@ public sealed class CatalogLoader
|
||||
throw new ContentLoadException($"RoomDef '{room.DefName}' references unknown WorkDef '{work}'.");
|
||||
}
|
||||
}
|
||||
|
||||
if (room.Homeroom)
|
||||
{
|
||||
if (room.Slots.Count > 0)
|
||||
{
|
||||
throw new ContentLoadException($"RoomDef '{room.DefName}' is a homeroom and cannot declare named slots.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(room.SeatThing) || !catalog.Things.TryGetValue(room.SeatThing, out var seat) || seat.Abstract)
|
||||
{
|
||||
throw new ContentLoadException($"RoomDef '{room.DefName}' seatThing is missing or unknown.");
|
||||
}
|
||||
|
||||
if (seat.PupilSlots <= 0)
|
||||
{
|
||||
throw new ContentLoadException($"RoomDef '{room.DefName}' seatThing '{room.SeatThing}' must have pupilSlots.");
|
||||
}
|
||||
|
||||
if (room.DefaultSeats < 1 || room.DefaultSeats > byte.MaxValue)
|
||||
{
|
||||
throw new ContentLoadException($"RoomDef '{room.DefName}' defaultSeats must be 1–{byte.MaxValue}.");
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(room.SeatThing) || room.DefaultSeats != 0)
|
||||
{
|
||||
throw new ContentLoadException($"RoomDef '{room.DefName}' is not a homeroom and cannot set seatThing or defaultSeats.");
|
||||
}
|
||||
}
|
||||
|
||||
PeopleDefValidator.Validate(catalog);
|
||||
|
||||
Reference in New Issue
Block a user