Station kinds: StationKindData catalog list, HullData.Kind, placed station Kind; GenerateStationLoadout takes a kind (the kindless draw is deleted)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
00e60344ab
commit
fba7bd1b47
17 changed files with 700 additions and 24 deletions
|
|
@ -61,9 +61,10 @@ public static class Program
|
|||
case "place-names":
|
||||
Console.OutputEncoding = new System.Text.UTF8Encoding(false);
|
||||
return PlaceNamesCommand.Run(args.Skip(1).ToArray());
|
||||
case "station-kinds": return StationKindsCatalog.Run(StationKindsCatalog.OpenCatalog(args.Contains("apply")), args.Contains("apply"), Console.Out);
|
||||
case "doctrine-catalog": return DoctrineCatalog.Run(AetherDb.Open(catalogWritable: args.Contains("apply")).Cache, args.Contains("apply"), Console.Out);
|
||||
default:
|
||||
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective <fraction>] [--end <multiplier>], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply], smoke-hull [apply], smoke-rounds [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], launch-suppressor [apply], pirates-faction [apply], verse-grammar [apply], generic-designs [apply], sensor-stat-set [apply], inspection-scanner [apply], minor-power-factions [apply], place-names [apply], product-lines weapons|minor-powers|gear|tiers [apply], doctrine-catalog [apply], assembly-from-maker [apply]");
|
||||
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective <fraction>] [--end <multiplier>], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply], smoke-hull [apply], smoke-rounds [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], launch-suppressor [apply], pirates-faction [apply], verse-grammar [apply], generic-designs [apply], sensor-stat-set [apply], inspection-scanner [apply], minor-power-factions [apply], place-names [apply], product-lines weapons|minor-powers|gear|tiers [apply], doctrine-catalog [apply], assembly-from-maker [apply], station-kinds [apply]");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -824,7 +825,7 @@ public static class Program
|
|||
{
|
||||
HullType.Ship => generator.GenerateShipLoadout(candidate => candidate == hull),
|
||||
HullType.Turret => generator.GenerateTurretLoadout(),
|
||||
_ => generator.GenerateStationLoadout()
|
||||
_ => generator.GenerateStationLoadout(hull.Kind)
|
||||
};
|
||||
outcome = pack == null ? "NO LOADOUT (nothing suitable found)" : "ok";
|
||||
if (pack == null) failures++;
|
||||
|
|
|
|||
82
tools/AetherDb/StationKindsCatalog.cs
Normal file
82
tools/AetherDb/StationKindsCatalog.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using GameCult.Caching;
|
||||
using GameCult.Caching.MessagePack;
|
||||
|
||||
// Authors the catalog's one list of station kinds (aetheria-living-world, cut station-kind-datum) and gives Zenith, the
|
||||
// one station hull in the repo, its ruled kind (ruling zenith-is-a-trade-hub: provisional, one edit here to change).
|
||||
// The 17 kinds are the station-round bench's economic roles; descriptions are its produces/consumes column. A kind that
|
||||
// already has a record is kept as it is and Zenith keeps a kind it already has, so a rerun that finds nothing to author
|
||||
// writes nothing. Dry run unless apply.
|
||||
public static class StationKindsCatalog
|
||||
{
|
||||
public const string ZenithKind = "trade-hub";
|
||||
|
||||
private static readonly (string id, string name, string description)[] Table =
|
||||
{
|
||||
("mining", "Mining Station", "Extracts ore (Rock, New Metals, Gold, Uranium, Potassium) from bodies and belts; consumes tools and food."),
|
||||
("volatiles", "Volatiles Station", "Skims Hydrogen, Methane and Water from gas giants and ice; consumes tools."),
|
||||
("agriculture", "Agriculture Station", "Grows Organics (Algae, Fungi, Bacteria, Animal Products) from Water and Potassium; feeds residential."),
|
||||
("processing", "Processing Station", "Refines ore and volatiles into Metals, Alloys and Compounds."),
|
||||
("fabrication", "Fabrication Station", "Turns Alloys and Compounds into Manufacturing compounds, Assemblies, gear, Ammo and consumer goods."),
|
||||
("shipyard", "Shipyard", "Assembles hulls from Assemblies and Alloys."),
|
||||
("depot", "Depot", "Stores and dispatches stock; loads haulers and tenders."),
|
||||
("trade-hub", "Trade Hub", "Exchanges every bloc's goods between haulers and takes a cut; produces nothing."),
|
||||
("residential", "Residential Station", "A bloom: consumes food, water, Wearables, Consumables and Luxuries; supplies crews."),
|
||||
("habitat-support", "Habitat Support Station", "Air, water recycling, life support and medicine for nearby habitats; consumes Bacteria, Water, Compounds."),
|
||||
("urban", "Urban Station", "Dense city and services: market, media, repair; consumes luxuries and food."),
|
||||
("administrative", "Administrative Station", "Issues quotas, contracts and security; consumes luxuries."),
|
||||
("power", "Power Station", "Makes reactor fuel, reservoirs and capacitors from Uranium and Hydrogen."),
|
||||
("research", "Research Station", "Certification, compute, prototypes; consumes Assemblies."),
|
||||
("salvage", "Salvage Station", "Breaks wrecks into Metals and second-hand gear."),
|
||||
("black-market", "Black Market", "Buys anything, fences stolen cargo."),
|
||||
("waystation", "Waystation", "Fuel, repair and medicine along a corridor."),
|
||||
};
|
||||
|
||||
// The catalog opened without AetheriaStores.Open's checks: the catalog this command first runs on holds a station hull with no
|
||||
// kind, which StationKinds.Validate refuses, and this command is what gives it one.
|
||||
public static CultCache OpenCatalog(bool apply)
|
||||
{
|
||||
var cache = new CultCache();
|
||||
cache.AddBackingStore(new SingleFileMessagePackBackingStore(Path.Combine(AetherDb.FindRoot(), "GameData", "Aetheria.cc"), !apply), AetheriaStores.CatalogTypes);
|
||||
return cache;
|
||||
}
|
||||
|
||||
public static int Run(CultCache cache, bool apply, TextWriter output)
|
||||
{
|
||||
var held = cache.GetAll<StationKindData>().Select(kind => cache.RefOf(kind).Key.Value).ToHashSet(StringComparer.Ordinal);
|
||||
var missing = Table.Where(row => !held.Contains(StationKindData.KeyOf(row.id).Value)).ToArray();
|
||||
foreach (var row in Table)
|
||||
output.WriteLine($"{row.id,-16} {(missing.Any(m => m.id == row.id) ? "authors" : "kept")}");
|
||||
|
||||
var zenith = cache.GetAll<HullData>().Where(h => h.HullType == HullType.Station && h.Name == "Zenith").SingleOrDefault();
|
||||
var setZenith = zenith != null && !zenith.Kind.IsSet();
|
||||
output.WriteLine(zenith == null ? "Zenith: no such hull, kind not set"
|
||||
: setZenith ? $"Zenith: kind {ZenithKind}" : "Zenith: already has a kind, kept");
|
||||
|
||||
if (!apply)
|
||||
{
|
||||
output.WriteLine("\nDry run. Pass \"apply\" to author them.");
|
||||
return 0;
|
||||
}
|
||||
if (missing.Length == 0 && !setZenith)
|
||||
{
|
||||
output.WriteLine("Nothing to author.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cache.Commit(batch =>
|
||||
{
|
||||
foreach (var (id, name, description) in missing)
|
||||
batch.Upsert(typeof(StationKindData), new StationKindData { Name = name, Description = description }, StationKindData.KeyOf(id));
|
||||
if (setZenith)
|
||||
{
|
||||
zenith.Kind = new CultRecordRef<StationKindData>(StationKindData.KeyOf(ZenithKind));
|
||||
batch.Upsert(typeof(HullData), zenith, cache.RefOf(zenith).Key);
|
||||
}
|
||||
});
|
||||
output.WriteLine($"\nAuthored {missing.Length} station kinds{(setZenith ? " and Zenith's kind" : "")} in Aetheria.cc");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue