Commit the Arsenal Depot's packager manifest, with Fa.1; gen_manifest refuses a station
tools/blender/manifests/arsenal-depot holds package.json and hull.scad; a test holds the kind, rows and hull.scad equal to the shipped package. gen_manifest.py exits with a message on a station. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6f850a4b2a
commit
13504341c0
5 changed files with 124 additions and 0 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using CultMath;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Xunit;
|
||||
|
||||
// Station facilities on typed mounts (aetheria-living-world, cut recipe-facilities; ruling station-facilities-on-typed-mounts): over
|
||||
|
|
@ -16,6 +18,24 @@ public sealed class StationFacilityRoomTests
|
|||
Assert.Empty(StationKinds.FacilityRoomFaults(cache));
|
||||
}
|
||||
|
||||
// A repackage from the committed manifest reproduces the shipped depot: the manifest's kind, rows (Fa.1 included) and hull.scad are the
|
||||
// package's own. The packager is creation input only, so this keeps the two from drifting apart.
|
||||
[Fact]
|
||||
public void TheCommittedDepotManifestIsTheShippedDepot()
|
||||
{
|
||||
var root = AetherDb.FindRoot();
|
||||
var manifest = JObject.Parse(File.ReadAllText(Path.Combine(root, "tools", "blender", "manifests", "arsenal-depot", "package.json")));
|
||||
Assert.Equal(File.ReadAllBytes(Path.Combine(root, "GameData", "Mods", "aetheria.arsenal-depot", "hull.scad")),
|
||||
File.ReadAllBytes(Path.Combine(root, "tools", "blender", "manifests", "arsenal-depot", "hull.scad")));
|
||||
using var cache = RestoredHullsTests.OpenCatalog();
|
||||
var depot = Assert.Single(cache.GetAll<HullData>(), hull => hull.Name == (string) manifest["name"]);
|
||||
Assert.Equal("station-kind:" + (string) manifest["kind"], depot.Kind.Key.Value);
|
||||
var shipped = depot.Hardpoints.Select(row => $"{row.Transform}|{row.Type}|{row.Position.x},{row.Position.y}|{ShipAuthoringPush.Footprint(row.Shape)}|{(int) row.Rotation}|{row.Armor}|{row.FiringArc}").OrderBy(x => x);
|
||||
var written = manifest["rows"].Select(row => $"{(string) row["id"]}|{(string) row["kind"]}|{(int) row["cell"][0]},{(int) row["cell"][1]}|{(string) row["footprint"]}|{(int) row["rotation"]}|{(float) row["armor"]}|{(float) row["arc"]}").OrderBy(x => x);
|
||||
Assert.Equal(shipped, written);
|
||||
Assert.Contains(depot.Hardpoints, row => row.Type == HardpointType.Facility);
|
||||
}
|
||||
|
||||
// Positive control: Zenith's Facility rows taken away (in memory, on a read-only catalog), the census names the hull, a kind it
|
||||
// serves and that kind's facility.
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ def main():
|
|||
f = sc.read(args.ship_cc, packages)
|
||||
_, rows, _ = sc.read_layout(args.ship_cc, packages)
|
||||
body = f.hull.body
|
||||
if sc.read_hull_type(args.ship_cc, packages) == "Station":
|
||||
sys.exit("gen_manifest reads a ship: a station has no top speed and its kind is not in the hull record. "
|
||||
"Station manifests are written by hand (see manifests/arsenal-depot, package_hull.md).")
|
||||
limit = [p for u, p in body[11] if u == 11][0][1]
|
||||
assert limit[0] == limit[1], "the manifest holds one top speed"
|
||||
product = [msgpack.unpackb(e.payload, raw=False) for e in f.store.pull_all() if e.type == sc.PRODUCT_SCHEMA][0]
|
||||
|
|
|
|||
78
tools/blender/manifests/arsenal-depot/hull.scad
Normal file
78
tools/blender/manifests/arsenal-depot/hull.scad
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// Zhestokost Arsenal Depot, a station: the hull bench's cast-iron Dutch oven with its lid on (AetheriaLore, Brainstorming/Ship
|
||||
// Prompt Bench.md, Stations and Station Modules). One squat charcoal pot, a heavy iron-grey stepped lid with a round knob
|
||||
// for its control tower, two thick lugs on opposite flanks that are the docking piers, four broad magazine bands round the
|
||||
// pot wall with oxide hatches. Built only from the Zhestokost kit and lowpoly primitives.
|
||||
// part = lang | brief | anchors | lines | primary | secondary | accent | recess | marking | rad:<id>
|
||||
// Frame: Ship Root, metres, nose -Y, starboard -X, up +Z. The piers stand on the X axis; the rest of the outline is round.
|
||||
include <zhestokost.scad>
|
||||
part = "primary";
|
||||
|
||||
HULL_FACTION = "zhestokost";
|
||||
HULL_DONOR = "";
|
||||
HULL_ROLE = "depot";
|
||||
HULL_LENGTH = [20, 26];
|
||||
HULL_TRIANGLES = [800, 9000];
|
||||
HULL_READS = ["the hull is a cast-iron Dutch oven with its lid on: one squat thick charcoal pot, a heavy stepped iron lid, a round knob on top",
|
||||
"the knob is the control tower, ringed by narrow observation slits",
|
||||
"two thick lugs on opposite flanks are the docking piers, each ending in one square-set docking collar with guide lugs",
|
||||
"four broad magazine bands ring the pot wall, oxide-red square hatches set in them",
|
||||
"two radiator troughs on the lid, either side of the knob; no thrusters and no guns, a depot does not move or fight"];
|
||||
if (part == "brief") echo(brief = [HULL_FACTION, HULL_DONOR, HULL_ROLE, HULL_LENGTH, HULL_TRIANGLES, HULL_READS]);
|
||||
|
||||
POT_R = 11.7; // pot wall circumradius; its top-view raster must stay a disc of about 12 cells
|
||||
POT_H = 7.2;
|
||||
BAND_R = 11.85; // bands stand 0.15 m proud: the widest the top view gets (23.7 m, 12 cells)
|
||||
BANDS = [[0.5, 2.0], [2.3, 3.8], [4.1, 5.6], [5.9, 7.1]];
|
||||
LID = [[POT_H - 0.2, 11.85], [8.7, 10.0], [10.4, 8.0]]; // [z, radius]: lip, first step, deck
|
||||
DECK_Z = 10.4;
|
||||
TOWER_R = 2.4;
|
||||
TOWER_TOP = 13.2;
|
||||
LUG_X = [9.4, 13.1]; // piers: x from the pot into the flank; the collars end at 13.95 m
|
||||
LUG_Y = 4.0;
|
||||
LUG_H = 5.2;
|
||||
HATCH_AT = [50, 130, 230, 310]; // azimuths, deg: clear of the piers on the X axis and of the y extremes
|
||||
RAD_Y = 4.9; RAD_W = 5.2; RAD_L = 2.4;
|
||||
RADS = [["Ra.N1", -1, 1], ["Ra.N2", -1, -1], ["Ra.S1", 1, 1], ["Ra.S2", 1, -1]]; // [id, trough y sign, trough side]
|
||||
|
||||
// A round mass from z0 to z1, r0 at the base and r1 at the top.
|
||||
module cone(z0, z1, r0, r1, fn=24) translate([0, 0, z0]) cylinder(r1=r0, r2=r1, h=z1 - z0, $fn=fn);
|
||||
|
||||
// pot (charcoal) with its bottom chamfer
|
||||
zh_z("secondary") {
|
||||
cone(0, 0.6, POT_R - 0.9, POT_R);
|
||||
cone(0.6, POT_H, POT_R, POT_R);
|
||||
}
|
||||
// four magazine bands, proud of the pot
|
||||
for (b = BANDS) zh_z("secondary") cone(b[0], b[1], BAND_R, BAND_R);
|
||||
// lid: a lip, then two steps up to a flat deck (iron grey)
|
||||
zh_z("primary") {
|
||||
cone(LID[0][0], 7.7, LID[0][1], LID[0][1]);
|
||||
cone(7.7, LID[1][0], LID[0][1], LID[1][1]);
|
||||
cone(LID[1][0], LID[2][0] + 0.05, LID[1][1], LID[2][1]);
|
||||
// knob: the control tower
|
||||
cone(DECK_Z - 0.05, TOWER_TOP, TOWER_R + 0.5, TOWER_R, 12);
|
||||
}
|
||||
zh_z("secondary") cone(TOWER_TOP - 0.05, TOWER_TOP + 0.45, TOWER_R + 0.35, TOWER_R + 0.35, 12);
|
||||
// observation slits ring the tower: black recesses sunk in its wall
|
||||
zh_z("recess") for (k = [0:11]) rotate([0, 0, k*30 + 15]) translate([TOWER_R - 0.05, 0, 12.2]) cube([0.28, 0.5, 0.45], center=true);
|
||||
// the piers: a thick lug on each flank, one docking collar on each outer face
|
||||
for (s = [-1, 1]) {
|
||||
zh_z("secondary") translate([s*(LUG_X[0] + LUG_X[1])/2, 0, LUG_H/2]) cbox([LUG_X[1] - LUG_X[0], LUG_Y, LUG_H], 0.3);
|
||||
lp_at(t=[s*LUG_X[1], 0, LUG_H/2], r=[0, 90*s, 0]) zh_collar(1.5, 0.55);
|
||||
lp_at(t=[s*(LUG_X[0] + LUG_X[1])/2, 0, LUG_H], r=[0, 0, 90]) zh_stripes(2.4, 1.4, 3);
|
||||
}
|
||||
// magazine hatches on each band, at four azimuths; cream serials on the bands between them
|
||||
for (b = BANDS, a = HATCH_AT)
|
||||
lp_at(t=[BAND_R*cos(a), BAND_R*sin(a), (b[0] + b[1])/2], r=[90, 0, a + 90]) zh_hatch(1.9, 1.0, dogs=false);
|
||||
for (a = [80, 100, 260, 280])
|
||||
lp_at(t=[BAND_R*cos(a), BAND_R*sin(a), 3.05], r=[90, 0, a + 90]) zh_serial(0.5, 3);
|
||||
// two radiator troughs on the deck, either side of the knob
|
||||
for (y = [-RAD_Y, RAD_Y]) lp_at(t=[0, y, DECK_Z]) zh_rad_trough(RAD_W, RAD_L, 0.45);
|
||||
// silhouette lines: the pot's cast belt and the lid deck edge
|
||||
lp_line("outline", [for (a = [0:15:345]) [BAND_R*cos(a), BAND_R*sin(a), POT_H]], true);
|
||||
lp_line("step", [for (a = [0:15:345]) [LID[2][1]*cos(a), LID[2][1]*sin(a), DECK_Z]], true);
|
||||
|
||||
// ---- anchor meshes: each radiator is one half of a trough ----
|
||||
for (r = RADS) if (part == str("rad:", r[0])) lp_at(t=[0, r[1]*RAD_Y, DECK_Z]) zh_rad_vanes(RAD_W, RAD_L, r[2], 4, 1.0);
|
||||
if (part == "anchors") for (r = RADS)
|
||||
echo(anchor=[r[0], "radiator-mesh", [0, r[1]*RAD_Y, DECK_Z] + zh_rad_centre(RAD_W, r[2], 1.0), 0, ""]);
|
||||
22
tools/blender/manifests/arsenal-depot/package.json
Normal file
22
tools/blender/manifests/arsenal-depot/package.json
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"id": "aetheria.arsenal-depot",
|
||||
"name": "Arsenal Depot",
|
||||
"like": "Zenith",
|
||||
"kind": "depot",
|
||||
"length": 12,
|
||||
"extent": [28.0, 23.7, 13.6],
|
||||
"hull": "hull.scad",
|
||||
"maker": "Zhestokost",
|
||||
"description": "A Zhestokost ammunition depot built like a lidded cast-iron Dutch oven: one squat charcoal pot under a heavy iron lid, a round control-tower knob, two thick lugs that are the docking piers and four magazine bands with oxide hatches.",
|
||||
"offered": true,
|
||||
"price": 100000,
|
||||
"stats": {"mass": 50000, "durability": 5000, "armor": 100, "drag": 0},
|
||||
"rows": [
|
||||
{"id": "Reactor", "kind": "Reactor", "cell": [5, 8], "footprint": "####/####/####/####", "rotation": 0, "armor": 0, "arc": 0},
|
||||
{"id": "Ra.N1", "kind": "Radiator", "cell": [2, 2], "footprint": "#/#/#/#", "rotation": 1, "armor": 0, "arc": 0},
|
||||
{"id": "Ra.N2", "kind": "Radiator", "cell": [2, 6], "footprint": "#/#/#/#", "rotation": 1, "armor": 0, "arc": 0},
|
||||
{"id": "Ra.S1", "kind": "Radiator", "cell": [11, 2], "footprint": "#/#/#/#", "rotation": 3, "armor": 0, "arc": 0},
|
||||
{"id": "Ra.S2", "kind": "Radiator", "cell": [11, 6], "footprint": "#/#/#/#", "rotation": 3, "armor": 0, "arc": 0},
|
||||
{"id": "Fa.1", "kind": "Facility", "cell": [4, 2], "footprint": "##/##", "rotation": 0, "armor": 0, "arc": 0}
|
||||
]
|
||||
}
|
||||
|
|
@ -54,6 +54,7 @@ The committed example is `tests/fixtures/hulls/zh-ammo-tender/package.json`; its
|
|||
|
||||
- `build_aetherdb.ps1` publishes `tools/AetherDb` into `<game>/ModTools`: it needs CultLib and CultMath worktrees at the revisions
|
||||
`Directory.Build.props` names and passes `ErrorOnDuplicatePublishOutputFiles=false` (the NETSDK1152 workaround).
|
||||
- `manifests/arsenal-depot/` is the committed manifest of the Arsenal Depot (its `hull.scad` is a copy of the package's; a test holds both equal to the shipped package, `Fa.1` included): a station's manifest is written by hand, and `gen_manifest.py` refuses a station with a message.
|
||||
- `gen_manifest.py <ship.cc> <hull.scad> <out.json> --like ... --extent X Y Z --maker ...` turns an existing package into a manifest.
|
||||
- `compare.py <committed ship.cc> <derived ship.cc>` prints `COMPARE_EQUAL` when shape, rows, stats, price and product match.
|
||||
- `job.ps1` runs the regression on a workstation with Blender and OpenSCAD: the fixture manifest; the committed
|
||||
|
|
|
|||
Loading…
Reference in a new issue