Sump/Hub/HubEffigy.cs

Static builder that turns a named keepsake object into a primitive-geometry effigy for the hub scene. Matches the object name against a keyword table to pick one of about fifty build routines (walkman, crucifix, egg carton, trophy and so on), each assembling boxes, discs, rings and balls through a HubBuilder, with a wrapped-box keepsake as the fallback.

using System;

/// <summary>
/// Big primitive renditions of the human objects the misfits cling to. A shrine is built round
/// one at full size; market stalls display small ones.
///
/// Every effigy is built in a space about 60 inches across with its base on z = 0 and its face to
/// +X. The object's name is matched by keyword to one of the kinds below; anything unknown gets
/// the "keepsake" (a small wrapped box on a block), so new objects in the tables still work.
/// </summary>
public static class HubEffigy
{
	static readonly Color Cream = new( 0.9f, 0.87f, 0.78f );
	static readonly Color White = new( 0.92f, 0.92f, 0.9f );
	static readonly Color Black = new( 0.06f, 0.06f, 0.07f );
	static readonly Color Steel = new( 0.56f, 0.58f, 0.61f );
	static readonly Color Brass = new( 0.74f, 0.56f, 0.2f );
	static readonly Color Red = new( 0.75f, 0.1f, 0.08f );
	static readonly Color Yellow = new( 0.95f, 0.78f, 0.12f );
	static readonly Color Green = new( 0.16f, 0.45f, 0.2f );
	static readonly Color Blue = new( 0.2f, 0.33f, 0.6f );
	static readonly Color Sky = new( 0.5f, 0.75f, 0.95f );
	static readonly Color Pink = new( 0.95f, 0.55f, 0.7f );
	static readonly Color Skin = new( 0.85f, 0.65f, 0.5f );
	static readonly Color Card = new( 0.5f, 0.38f, 0.24f );
	static readonly Color Wood = new( 0.36f, 0.24f, 0.13f );

	// Keyword to kind, first match wins, so the more particular words come first.
	static readonly (string Kind, string[] Words)[] Kinds =
	{
		( "walkman", new[] { "walkman" } ),
		( "cassette", new[] { "cassette" } ),
		( "radio", new[] { "transistor radio", "answering machine" } ),
		( "cross", new[] { "crucifix" } ),
		( "happymeal", new[] { "mcdonald" } ),
		( "cap", new[] { " cap" } ),
		( "shell", new[] { "shotgun shell" } ),
		( "eggs", new[] { "egg carton" } ),
		( "glove", new[] { "glove" } ),
		( "book", new[] { "catalogue", "phone book" } ),
		( "ringlight", new[] { "ring light" } ),
		( "moon", new[] { "night light" } ),
		( "collar", new[] { "collar" } ),
		( "bracelet", new[] { "bracelet" } ),
		( "keys", new[] { "keyring" } ),
		( "watch", new[] { "wristwatch" } ),
		( "tambourine", new[] { "tambourine" } ),
		( "yoyo", new[] { "yo-yo" } ),
		( "bulb", new[] { "bulb" } ),
		( "bottle", new[] { "bottle" } ),
		( "clipboard", new[] { "clipboard" } ),
		( "lollipop", new[] { "lollipop" } ),
		( "mug", new[] { "mug" } ),
		( "teacup", new[] { "teacup" } ),
		( "thermos", new[] { "thermos" } ),
		( "tin", new[] { "tin of" } ),
		( "stethoscope", new[] { "stethoscope" } ),
		( "fan", new[] { "desk fan" } ),
		( "stickergun", new[] { "sticker gun" } ),
		( "plate", new[] { "collection plate" } ),
		( "paddle", new[] { "paddle" } ),
		( "candle", new[] { "candle" } ),
		( "globe", new[] { "snow globe" } ),
		( "stick", new[] { "selfie stick" } ),
		( "remote", new[] { "remote" } ),
		( "phone", new[] { "phone" } ),
		( "tamagotchi", new[] { "tamagotchi" } ),
		( "shirt", new[] { "t-shirt" } ),
		( "pen", new[] { "marker pen", "crayon" } ),
		( "shoebox", new[] { "shoebox" } ),
		( "umbrella", new[] { "umbrella" } ),
		( "cube", new[] { "rubik" } ),
		( "tree", new[] { "air freshener" } ),
		( "trophy", new[] { "trophy" } ),
		( "gnome", new[] { "gnome" } ),
		( "harmonica", new[] { "harmonica" } ),
		( "level", new[] { "spirit level" } ),
		( "viewmaster", new[] { "view-master" } ),
		( "mat", new[] { "mouse mat" } ),
		( "photo", new[] { "photo" } ),
		( "paper", new[] { "receipt", "card", "pass", "ticket", "licence", "badge" } ),
		( "jigsaw", new[] { "jigsaw" } ),
		( "bubblewrap", new[] { "bubble wrap" } ),
	};

	/// <summary>Which rendition an object gets ("walkman", "cross", ... or "keepsake").</summary>
	public static string KindOf( string thing )
	{
		var name = " " + (thing ?? "").ToLowerInvariant();
		foreach ( var (kind, words) in Kinds )
			foreach ( var word in words )
				if ( name.Contains( word ) ) return kind;
		return "keepsake";
	}

	/// <summary>True for renditions made of few enough pieces to put several on a market stall.</summary>
	public static bool IsSimple( string thing ) => KindOf( thing ) is not ("cube" or "eggs" or "umbrella" or "bubblewrap" or "remote");

	/// <summary>Builds the rendition of an object. The two colours are its owner's, used for trim.</summary>
	public static void Build( HubBuilder b, string thing, Color primary, Color secondary, int seed )
	{
		var name = (thing ?? "").ToLowerInvariant();
		switch ( KindOf( thing ) )
		{
			case "walkman": Walkman( b ); break;
			case "cassette": Cassette( b ); break;
			case "radio": Radio( b, name.Contains( "answering" ) ); break;
			case "cross": Cross( b ); break;
			case "happymeal": HappyMeal( b, primary, secondary ); break;
			case "cap": Cap( b ); break;
			case "shell": Shell( b ); break;
			case "eggs": Eggs( b ); break;
			case "glove": Glove( b, name.Contains( "rubber" ) ); break;
			case "book": Book( b, name.Contains( "phone" ) ? Yellow : Green ); break;
			case "ringlight": RingLight( b ); break;
			case "moon": Moon( b ); break;
			case "collar": Collar( b ); break;
			case "bracelet": Bracelet( b, name.Contains( "hospital" ), primary, secondary ); break;
			case "keys": Keys( b ); break;
			case "watch": Watch( b ); break;
			case "tambourine": Tambourine( b ); break;
			case "yoyo": YoYo( b ); break;
			case "bulb": Bulb( b ); break;
			case "bottle": Bottle( b, name.Contains( "milk" ) ); break;
			case "clipboard": Clipboard( b ); break;
			case "lollipop": Lollipop( b ); break;
			case "mug": Mug( b ); break;
			case "teacup": Teacup( b ); break;
			case "thermos": Thermos( b ); break;
			case "tin": Tin( b ); break;
			case "stethoscope": Stethoscope( b ); break;
			case "fan": Fan( b ); break;
			case "stickergun": StickerGun( b ); break;
			case "plate": Plate( b ); break;
			case "paddle": Paddle( b ); break;
			case "candle": Candle( b ); break;
			case "globe": Globe( b ); break;
			case "stick": SelfieStick( b ); break;
			case "remote": Remote( b ); break;
			case "phone": Phone( b ); break;
			case "tamagotchi": Tamagotchi( b, primary ); break;
			case "shirt": Shirt( b, primary ); break;
			case "pen": Pen( b, name.Contains( "crayon" ) ); break;
			case "shoebox": Shoebox( b, primary ); break;
			case "umbrella": Umbrella( b, primary ); break;
			case "cube": Cube( b, seed ); break;
			case "tree": Tree( b ); break;
			case "trophy": Trophy( b ); break;
			case "gnome": Gnome( b ); break;
			case "harmonica": Harmonica( b ); break;
			case "level": Level( b ); break;
			case "viewmaster": ViewMaster( b ); break;
			case "mat": Mat( b ); break;
			case "photo": Photo( b, primary ); break;
			case "paper": PaperThing( b, name, primary, secondary ); break;
			case "jigsaw": Jigsaw( b ); break;
			case "bubblewrap": BubbleWrap( b ); break;
			default: Keepsake( b, primary, secondary, seed ); break;
		}
	}

	static Vector3 V( float x, float y, float z ) => new( x, y, z );

	// ---- Things that play ---------------------------------------------------------------------------

	/// <summary>A box with two reels behind a window and a headphone arc over the top.</summary>
	static void Walkman( HubBuilder b )
	{
		b.Box( "Body", V( 0, 0, 17 ), V( 12, 46, 32 ), Blue );
		b.Box( "Window", V( 6.2f, 0, 20 ), V( 1, 30, 13 ), Black );
		b.Disc( "Reel", V( 7, -8, 20 ), 4.5f, 1f, White );
		b.Disc( "Reel", V( 7, 8, 20 ), 4.5f, 1f, White );
		b.Box( "Label", V( 6.2f, 0, 7 ), V( 1, 36, 6 ), Yellow );
		for ( int i = 0; i < 5; i++ )
			b.Box( "Button", V( 0, -14 + i * 7, 34 ), V( 7, 5, 3 ), i == 0 ? Red : Steel );
		b.Ring( "Headband", V( 0, 0, 34 ), 27f, 2.5f, Black, 0f, 180f, 8 );
		b.Ball( "Ear Pad", V( 0, -27, 32 ), V( 5, 4, 7 ), new Color( 0.9f, 0.45f, 0.1f ) );
		b.Ball( "Ear Pad", V( 0, 27, 32 ), V( 5, 4, 7 ), new Color( 0.9f, 0.45f, 0.1f ) );
	}

	static void Cassette( HubBuilder b )
	{
		b.Box( "Shell", V( 0, 0, 18 ), V( 5, 52, 34 ), Black );
		b.Box( "Label", V( 2.8f, 0, 23 ), V( 1, 44, 16 ), Cream );
		b.Box( "Writing", V( 3.4f, -4, 27 ), V( 0.6f, 26, 2 ), Red );
		b.Disc( "Reel", V( 3.4f, -11, 20 ), 4.5f, 0.8f, White );
		b.Disc( "Reel", V( 3.4f, 11, 20 ), 4.5f, 0.8f, White );
		b.Box( "Mouth", V( 2.8f, 0, 5 ), V( 1, 30, 6 ), Steel );
	}

	static void Radio( HubBuilder b, bool answering )
	{
		var body = answering ? Cream : new Color( 0.55f, 0.36f, 0.2f );
		b.Box( "Body", V( 0, 0, 16 ), V( 16, 48, 30 ), body );
		b.Box( "Grille", V( 8.2f, -10, 16 ), V( 1, 22, 20 ), Black );
		for ( int i = 0; i < 3; i++ )
			b.Box( "Grille Line", V( 8.8f, -10, 10 + i * 6 ), V( 0.6f, 20, 1.2f ), Steel );
		b.Disc( "Dial", V( 8.6f, 14, 20 ), 6f, 0.8f, Cream );
		b.Box( "Needle", V( 9.3f, 14, 21 ), V( 0.6f, 1, 5 ), Red );

		if ( answering )
		{
			// One saved message: the light that has been blinking since 1991.
			b.Ball( "Message Light", V( 8.6f, 14, 8 ), 2.2f, Red );
			b.Box( "Tape Door", V( 0, 0, 31.5f ), V( 10, 24, 1 ), Black );
		}
		else
		{
			b.Rod( "Aerial", V( -4, 20, 31 ), V( -10, 34, 64 ), 1.6f, Steel );
			b.Ring( "Handle", V( 0, 0, 31 ), 16f, 2f, Black, 20f, 160f, 6 );
		}
	}

	// ---- Holy and sold ------------------------------------------------------------------------------

	/// <summary>The glow-in-the-dark crucifix: a pale green cross on a block.</summary>
	static void Cross( HubBuilder b )
	{
		var glow = new Color( 0.7f, 0.98f, 0.62f );
		b.Box( "Foot", V( 0, 0, 3 ), V( 18, 18, 6 ), HubKit.Shade( glow, 0.6f ) );
		b.Box( "Upright", V( 0, 0, 35 ), V( 7, 7, 60 ), glow );
		b.Box( "Arm", V( 0, 0, 47 ), V( 7, 38, 7 ), glow );
		b.Box( "Plaque", V( 3.8f, 0, 59 ), V( 1, 9, 4 ), White );
	}

	static void StickerGun( HubBuilder b )
	{
		b.Box( "Body", V( 0, 0, 28 ), V( 9, 36, 13 ), Red );
		b.Rod( "Grip", V( 0, 8, 24 ), V( 0, 14, 3 ), 8f, HubKit.Shade( Red, 0.7f ) );
		b.Rod( "Trigger", V( 0, 2, 22 ), V( 0, 6, 9 ), 4f, Black );
		b.Disc( "Label Roll", V( 0, -8, 40 ), 8f, 4f, White );
		b.Box( "Nose", V( 0, -21, 25 ), V( 8, 8, 8 ), Steel );
		b.Box( "Sticker", V( 0, -27, 22 ), V( 1, 6, 5 ), Yellow );
	}

	static void Plate( HubBuilder b )
	{
		b.Disc( "Plate", V( 0, 0, 5 ), 26f, 4f, Brass, true );
		b.Disc( "Felt", V( 0, 0, 7.5f ), 19f, 2.5f, HubKit.Shade( Red, 0.7f ), true );
		b.Disc( "Coin", V( 5, -6, 10 ), 3.5f, 0.8f, Steel, true );
		b.Disc( "Coin", V( -6, 4, 10 ), 3f, 0.8f, Brass, true );
		b.Disc( "Coin", V( 3, 8, 10 ), 2.6f, 0.8f, Steel, true );
		b.Box( "Button", V( -3, -8, 10 ), V( 3, 3, 1 ), Black );
	}

	static void Paddle( HubBuilder b )
	{
		b.Rod( "Handle", V( 0, 0, 0 ), V( 0, 0, 28 ), 4.5f, Wood );
		b.Disc( "Paddle", V( 0, 0, 43 ), 17f, 2f, Cream );
		// Number 44.
		foreach ( float y in new[] { -6f, 6f } )
		{
			b.Box( "Four", V( 2.3f, y + 2, 43 ), V( 0.6f, 2, 14 ), Black );
			b.Box( "Four", V( 2.3f, y - 2, 46 ), V( 0.6f, 2, 8 ), Black );
			b.Box( "Four", V( 2.3f, y, 42 ), V( 0.6f, 7, 2 ), Black );
		}
	}

	static void Candle( HubBuilder b )
	{
		b.Disc( "Wax Pool", V( 0, 0, 1 ), 9f, 1f, Cream, true );
		b.Box( "Candle", V( 0, 0, 16 ), V( 5, 5, 30 ), Pink );
		for ( int i = 0; i < 4; i++ )
			b.Box( "Stripe", V( 0, 0, 5 + i * 7 ), V( 5.4f, 5.4f, 2 ), White, false, Rotation.FromYaw( i * 20f ) );
		b.Box( "Wick", V( 0, 0, 32.5f ), V( 0.8f, 0.8f, 3 ), Black );
		b.Ball( "Flame", V( 0, 0, 37 ), V( 2.4f, 2.4f, 4.5f ), HubKit.Flame );
	}

	static void Tambourine( HubBuilder b )
	{
		b.Disc( "Skin", V( 0, 0, 27 ), 21f, 1f, Cream );
		b.Ring( "Frame", V( 0, 0, 27 ), 23f, 5f, Wood, 0f, 360f, 12 );
		// Three jingles left.
		foreach ( float angle in new[] { 30f, 150f, 250f } )
		{
			float r = angle * MathF.PI / 180f;
			b.Disc( "Jingle", V( 3.2f, MathF.Cos( r ) * 23f, 27 + MathF.Sin( r ) * 23f ), 3.5f, 0.8f, Brass );
		}
	}

	static void Globe( HubBuilder b )
	{
		b.Box( "Base", V( 0, 0, 5 ), V( 24, 24, 10 ), Black );
		b.Box( "Plaque", V( 12.3f, 0, 5 ), V( 0.6f, 12, 4 ), Brass );
		b.Ball( "Glass", V( 0, 0, 25 ), 16f, new Color( 0.74f, 0.88f, 0.96f ) );
		b.Box( "Cathedral", V( 15.4f, 0, 21 ), V( 1, 9, 10 ), HubKit.Shade( Steel, 0.6f ) );
		b.Box( "Spire", V( 15.2f, 0, 30 ), V( 1, 3, 9 ), HubKit.Shade( Steel, 0.6f ) );
		b.Ball( "Snow", V( 14.5f, -7, 30 ), 1f, White );
		b.Ball( "Snow", V( 13.5f, 8, 33 ), 1f, White );
	}

	// ---- Farm ---------------------------------------------------------------------------------------

	static void Cap( HubBuilder b )
	{
		b.Ball( "Crown", V( 0, 0, 11 ), V( 20, 20, 15 ), Green );
		b.Box( "Brim", V( 25, 0, 6 ), V( 22, 30, 2.5f ), Yellow );
		b.Box( "Patch", V( 19.3f, 0, 14 ), V( 1, 14, 9 ), Yellow );
		b.Ball( "Button", V( 0, 0, 26 ), 2.2f, Yellow );
		b.Disc( "Hole", V( 28, 5, 7.6f ), 3.2f, 0.5f, Black, true );
	}

	static void Shell( HubBuilder b )
	{
		b.Box( "Brass", V( 0, 0, 6 ), V( 17, 17, 12 ), Brass );
		b.Box( "Rim", V( 0, 0, 1.5f ), V( 19, 19, 3 ), Brass );
		b.Box( "Hull", V( 0, 0, 30 ), V( 15, 15, 36 ), Red );
		b.Box( "Crimp", V( 0, 0, 49 ), V( 11, 11, 2 ), HubKit.Shade( Red, 0.6f ) );
		b.Box( "Print", V( 7.8f, 0, 30 ), V( 0.6f, 9, 14 ), Black );
	}

	static void Eggs( HubBuilder b )
	{
		b.Box( "Tray", V( 0, 0, 5 ), V( 30, 62, 10 ), Card );
		b.Box( "Lid", V( -19, 0, 22 ), V( 3, 62, 30 ), HubKit.Shade( Card, 1.15f ), false, Rotation.FromPitch( 14f ) );
		for ( int i = 0; i < 12; i++ )
			b.Disc( "Cup", V( i < 6 ? -7 : 7, -25 + (i % 6) * 10, 10.2f ), 4f, 0.6f, HubKit.Shade( Card, 0.5f ), true );
		// The one egg it will not let break.
		b.Ball( "Egg", V( 7, 5, 14 ), V( 4.2f, 4.2f, 5.6f ), White );
	}

	static void Glove( HubBuilder b, bool rubber )
	{
		var tint = rubber ? new Color( 0.7f, 0.85f, 0.92f ) : new Color( 0.72f, 0.62f, 0.38f );
		b.Box( "Cuff", V( 0, 0, 5 ), V( 9, 20, 10 ), HubKit.Shade( tint, 0.8f ) );
		b.Box( "Palm", V( 0, 0, 21 ), V( 9, 26, 22 ), tint );
		float[] tall = { 16f, 21f, 22f, 18f };
		for ( int i = 0; i < 4; i++ )
			b.Box( "Finger", V( 0, -9.6f + i * 6.4f, 32 + tall[i] * 0.5f ), V( 7.5f, 5.4f, tall[i] ), tint );
		b.Rod( "Thumb", V( 0, 12, 18 ), V( 0, 23, 32 ), 6f, tint );
		if ( !rubber ) b.Rod( "Straw", V( 0, -4, 0 ), V( 3, -9, -1 ), 1.5f, Yellow );
	}

	static void Collar( HubBuilder b )
	{
		b.Ring( "Collar", V( 0, 0, 24 ), 20f, 4.5f, new Color( 0.4f, 0.2f, 0.1f ), 0f, 360f, 12 );
		b.Box( "Buckle", V( 0, 0, 45 ), V( 5, 9, 6 ), Steel );
		b.Disc( "Tag", V( 2.5f, 0, 5 ), 5.5f, 0.8f, Brass );
		b.Box( "Good Boy", V( 3.5f, 0, 5 ), V( 0.5f, 6, 1.5f ), Black );
	}

	static void Bulb( HubBuilder b )
	{
		b.Box( "Cap", V( 0, 0, 6 ), V( 10, 10, 12 ), Brass );
		b.Box( "Thread", V( 0, 0, 4 ), V( 11, 11, 1.5f ), HubKit.Shade( Brass, 0.6f ) );
		b.Box( "Thread", V( 0, 0, 8 ), V( 11, 11, 1.5f ), HubKit.Shade( Brass, 0.6f ) );
		b.Box( "Neck", V( 0, 0, 15 ), V( 9, 9, 8 ), new Color( 0.3f, 0.3f, 0.32f ) );
		// Burnt out: smoked glass. That is why it likes it.
		b.Ball( "Glass", V( 0, 0, 31 ), V( 14, 14, 16 ), new Color( 0.26f, 0.25f, 0.24f ) );
		b.Rod( "Filament", V( 14.2f, -4, 30 ), V( 14.2f, 4, 33 ), 0.8f, Black );
	}

	static void Bottle( HubBuilder b, bool milk )
	{
		var glass = milk ? new Color( 0.82f, 0.9f, 0.9f ) : new Color( 0.55f, 0.8f, 0.95f );
		b.Box( "Body", V( 0, 0, 17 ), V( 16, 16, 34 ), glass );
		b.Ball( "Shoulder", V( 0, 0, 35 ), V( 8.5f, 8.5f, 6 ), glass );
		b.Box( "Neck", V( 0, 0, 42 ), V( 8, 8, 10 ), glass );
		b.Box( "Top", V( 0, 0, 48 ), V( 9, 9, 3 ), milk ? Steel : Blue );
		if ( milk )
			b.Box( "Rainwater", V( 0, 0, 12 ), V( 16.6f, 16.6f, 22 ), new Color( 0.6f, 0.72f, 0.74f ) );
		else
		{
			b.Box( "Label", V( 0, 0, 19 ), V( 17, 17, 13 ), White );
			b.Disc( "Host", V( 8.8f, 0, 19 ), 4f, 0.6f, Skin );
		}
	}

	// ---- Laboratory ---------------------------------------------------------------------------------

	static void Bracelet( HubBuilder b, bool hospital, Color primary, Color secondary )
	{
		if ( hospital )
		{
			b.Ring( "Band", V( 0, 0, 20 ), 17f, 3.5f, White, 0f, 360f, 12 );
			b.Box( "Tag", V( 2, 0, 37 ), V( 2, 20, 8 ), Cream );
			b.Box( "Specimen", V( 3.2f, -2, 38 ), V( 0.5f, 12, 1.4f ), Black );
			b.Box( "Nine", V( 3.2f, 6, 35.5f ), V( 0.5f, 3, 2 ), Red );
			return;
		}

		// Half a friendship bracelet: half a ring, in two colours, frayed where it was cut.
		b.Ring( "Braid", V( 0, 0, 4 ), 22f, 3.5f, primary, 0f, 90f, 5 );
		b.Ring( "Braid", V( 0, 0, 4 ), 22f, 3.5f, secondary, 90f, 180f, 5 );
		b.Rod( "Fray", V( 0, 22, 4 ), V( 3, 25, 0 ), 1.2f, primary );
		b.Rod( "Fray", V( 0, 22, 4 ), V( -3, 26, 1 ), 1.2f, secondary );
		b.Rod( "Fray", V( 0, -22, 4 ), V( 2, -26, 0 ), 1.2f, secondary );
	}

	static void Clipboard( HubBuilder b )
	{
		var board = b.Group( "Clipboard", V( -4, 0, 0 ), Rotation.FromPitch( -14f ) );
		board.Box( "Board", V( 0, 0, 25 ), V( 3, 36, 50 ), Card );
		board.Box( "Chart", V( 1.8f, 0, 23 ), V( 1, 30, 40 ), White );
		board.Box( "Clip", V( 2.4f, 0, 46 ), V( 2, 14, 6 ), Steel );
		for ( int i = 0; i < 5; i++ )
			board.Box( "Line", V( 2.5f, i % 2 == 0 ? 0 : -3, 36 - i * 6 ), V( 0.5f, i % 2 == 0 ? 24 : 18, 1.2f ), Black );
		// "Seems calm."
		board.Box( "Note", V( 2.5f, 2, 7 ), V( 0.5f, 16, 1.6f ), Red );
	}

	static void Lollipop( HubBuilder b )
	{
		b.Rod( "Stick", V( 0, 0, 0 ), V( 0, 0, 34 ), 2.5f, White );
		b.Disc( "Sweet", V( 0, 0, 45 ), 13f, 4f, Pink );
		b.Disc( "Swirl", V( 3.2f, 0, 45 ), 8f, 1.4f, Red );
		b.Disc( "Swirl", V( 4.2f, 0, 45 ), 3.5f, 1f, White );
	}

	static void Mug( HubBuilder b )
	{
		b.Box( "Mug", V( 0, 0, 14 ), V( 24, 24, 28 ), White );
		b.Box( "Coffee", V( 0, 0, 28.3f ), V( 20, 20, 1 ), new Color( 0.22f, 0.13f, 0.07f ) );
		b.Ring( "Handle", V( 0, -13, 14 ), 8f, 3.5f, White, 90f, 270f, 6 );
		b.Box( "World's", V( 12.3f, 0, 19 ), V( 0.6f, 16, 3 ), Black );
		b.Box( "Okayest", V( 12.3f, 0, 14 ), V( 0.6f, 19, 4 ), Red );
		b.Box( "Scientist", V( 12.3f, 0, 9 ), V( 0.6f, 14, 3 ), Black );
	}

	static void Stethoscope( HubBuilder b )
	{
		b.Disc( "Chest Piece", V( 12, 0, 2 ), 8f, 2f, Steel, true );
		b.Rod( "Tube", V( 12, 0, 3 ), V( 0, 0, 30 ), 2.6f, Black );
		b.Rod( "Tube", V( 0, 0, 30 ), V( -2, -13, 46 ), 2.2f, Black );
		b.Rod( "Tube", V( 0, 0, 30 ), V( -2, 13, 46 ), 2.2f, Black );
		b.Rod( "Arm", V( -2, -13, 46 ), V( -2, -8, 60 ), 1.6f, Steel );
		b.Rod( "Arm", V( -2, 13, 46 ), V( -2, 8, 60 ), 1.6f, Steel );
		b.Ball( "Ear Tip", V( -2, -8, 61 ), 2.4f, Cream );
		b.Ball( "Ear Tip", V( -2, 8, 61 ), 2.4f, Cream );
	}

	static void Fan( HubBuilder b )
	{
		b.Box( "Base", V( 0, 0, 2 ), V( 20, 20, 4 ), Cream );
		b.Box( "Stem", V( -2, 0, 12 ), V( 4, 4, 18 ), Cream );
		b.Ball( "Motor", V( -4, 0, 32 ), V( 8, 6, 6 ), Cream );
		b.Ring( "Guard", V( 4, 0, 32 ), 19f, 1.6f, Steel, 0f, 360f, 12 );
		for ( int i = 0; i < 3; i++ )
		{
			float r = (20f + i * 120f) * MathF.PI / 180f;
			b.Rod( "Blade", V( 3, 0, 32 ), V( 3, MathF.Cos( r ) * 16f, 32 + MathF.Sin( r ) * 16f ), 6f, Sky );
		}
		// No plug.
		b.Rod( "Flex", V( -10, 0, 1 ), V( -22, 8, 1 ), 1.5f, Black );
	}

	// ---- Fame ---------------------------------------------------------------------------------------

	static void SelfieStick( HubBuilder b )
	{
		b.Rod( "Grip", V( 0, -22, 1 ), V( 0, -14, 12 ), 5f, Black );
		b.Rod( "Stick", V( 0, -14, 12 ), V( 0, 4, 38 ), 2.5f, Steel );
		// Snapped: the top half hangs.
		b.Rod( "Stick", V( 0, 4, 38 ), V( 0, 22, 28 ), 2.2f, Steel );
		b.Box( "Clamp", V( 0, 24, 26 ), V( 4, 6, 12 ), Black );
	}

	static void Remote( HubBuilder b )
	{
		var body = b.Group( "Remote", V( -4, 0, 0 ), Rotation.FromPitch( -16f ) );
		body.Box( "Body", V( 0, 0, 24 ), V( 5, 16, 48 ), Black );
		body.Ball( "Power", V( 3, 4, 44 ), 1.6f, Red );
		// The mute button, worn smooth.
		body.Box( "Mute", V( 2.8f, -4, 44 ), V( 0.8f, 4, 3 ), Cream );
		for ( int i = 0; i < 9; i++ )
			body.Box( "Button", V( 2.8f, -4.5f + (i % 3) * 4.5f, 34 - (i / 3) * 6 ), V( 0.8f, 3, 3 ), Steel );
	}

	static void Phone( HubBuilder b )
	{
		var body = b.Group( "Phone", V( -4, 0, 0 ), Rotation.FromPitch( -14f ) );
		body.Box( "Body", V( 0, 0, 24 ), V( 3, 25, 48 ), Black );
		body.Box( "Screen", V( 1.7f, 0, 25 ), V( 0.6f, 21, 40 ), new Color( 0.13f, 0.16f, 0.22f ) );
		body.Rod( "Crack", V( 2.2f, -9, 40 ), V( 2.2f, 4, 22 ), 0.6f, Steel );
		body.Rod( "Crack", V( 2.2f, 4, 22 ), V( 2.2f, 10, 30 ), 0.6f, Steel );
		body.Rod( "Crack", V( 2.2f, 4, 22 ), V( 2.2f, -2, 8 ), 0.6f, Steel );
		// No signal.
		body.Box( "No Signal", V( 2.2f, 7, 43 ), V( 0.5f, 4, 1.4f ), Red );
	}

	static void Tamagotchi( HubBuilder b, Color shell )
	{
		b.Ball( "Shell", V( 0, 0, 19 ), V( 7, 15, 18 ), shell );
		b.Box( "Screen", V( 6.2f, 0, 22 ), V( 1.5f, 13, 11 ), new Color( 0.45f, 0.52f, 0.42f ) );
		// The battery was not its fault.
		b.Box( "Dead Pixel Pet", V( 7.2f, 0, 21 ), V( 0.5f, 4, 3 ), new Color( 0.3f, 0.35f, 0.28f ) );
		for ( int i = 0; i < 3; i++ )
			b.Ball( "Button", V( 6.4f, -5 + i * 5, 10 ), 1.5f, Yellow );
		b.Ring( "Key Chain", V( 0, 0, 41 ), 4.5f, 1.2f, Steel, 0f, 360f, 8 );
	}

	static void Shirt( HubBuilder b, Color face )
	{
		b.Rod( "Hanger", V( -1, -18, 44 ), V( -1, 18, 44 ), 1.6f, Steel );
		b.Rod( "Hook", V( -1, 0, 44 ), V( -1, 0, 54 ), 1.4f, Steel );
		b.Box( "Body", V( 0, 0, 22 ), V( 3, 36, 42 ), White );
		b.Box( "Sleeve", V( 0, -23, 36 ), V( 3, 14, 12 ), White, false, Rotation.FromRoll( 25f ) );
		b.Box( "Sleeve", V( 0, 23, 36 ), V( 3, 14, 12 ), White, false, Rotation.FromRoll( -25f ) );
		// Its own face, size XL. Nobody asked.
		b.Disc( "Face", V( 2, 0, 24 ), 10f, 0.8f, face );
		b.Ball( "Eye", V( 2.8f, -4, 26 ), 1.5f, Black );
		b.Ball( "Eye", V( 2.8f, 4, 26 ), 1.5f, Black );
		b.Box( "Mouth", V( 2.8f, 0, 20 ), V( 0.5f, 6, 1.2f ), Black );
	}

	static void RingLight( HubBuilder b )
	{
		for ( int i = 0; i < 3; i++ )
		{
			float r = i * 120f * MathF.PI / 180f;
			b.Rod( "Leg", V( 0, 0, 12 ), V( MathF.Cos( r ) * 12f, MathF.Sin( r ) * 12f, 0 ), 1.6f, Black );
		}
		b.Rod( "Stand", V( 0, 0, 10 ), V( 0, 0, 24 ), 2f, Black );
		// Never switched on. Only held.
		b.Ring( "Ring", V( 0, 0, 42 ), 18f, 4.5f, new Color( 0.72f, 0.72f, 0.7f ), 0f, 360f, 12 );
		b.Rod( "Crack", V( 2.6f, 9, 55 ), V( 2.6f, 14, 58 ), 1f, Black );
	}

	static void Pen( HubBuilder b, bool crayon )
	{
		var body = crayon ? Sky : Black;
		b.Rod( "Barrel", V( 0, -8, 1 ), V( 0, 6, 42 ), 7f, body );
		b.Rod( "Wrapper", V( 0, -5, 10 ), V( 0, 2, 30 ), 7.6f, crayon ? HubKit.Shade( Sky, 1.2f ) : White );
		b.Rod( "Tip", V( 0, 6, 42 ), V( 0, 8.4f, 49 ), 3.5f, crayon ? HubKit.Shade( Sky, 0.8f ) : Steel );
		if ( !crayon ) b.Rod( "Cap", V( 6, 10, 2 ), V( 4, 20, 2 ), 7.5f, Black );
	}

	static void Mat( HubBuilder b )
	{
		// Its worst moment, kept face down: all anyone sees is the rubber back.
		b.Box( "Mat", V( 0, 0, 1.5f ), V( 44, 54, 3 ), Black, false, Rotation.FromYaw( 8f ) );
		b.Box( "Edge", V( 0, 0, 0.6f ), V( 46, 56, 1 ), HubKit.Shade( Steel, 0.5f ), false, Rotation.FromYaw( 8f ) );
		b.Box( "Corner", V( 17, 21, 3.4f ), V( 8, 8, 1 ), Pink, false, Rotation.FromYaw( 8f ) );
	}

	// ---- Childhood ----------------------------------------------------------------------------------

	/// <summary>A red box with yellow arches, open at the front, and the small figure that never got opened.</summary>
	static void HappyMeal( HubBuilder b, Color primary, Color secondary )
	{
		b.Box( "Box Floor", V( 0, 0, 1.5f ), V( 32, 42, 3 ), Red );
		b.Box( "Box Back", V( -15, 0, 19 ), V( 3, 42, 36 ), Red );
		b.Box( "Box Side", V( 0, -20, 12 ), V( 30, 3, 22 ), Red );
		b.Box( "Box Side", V( 0, 20, 12 ), V( 30, 3, 22 ), Red );
		b.Ring( "Arch", V( -13, -7, 16 ), 7f, 2.6f, Yellow, 0f, 180f, 6 );
		b.Ring( "Arch", V( -13, 7, 16 ), 7f, 2.6f, Yellow, 0f, 180f, 6 );
		b.Ring( "Handle", V( -15, 0, 37 ), 10f, 2.4f, Yellow, 0f, 180f, 6 );

		b.Box( "Toy Body", V( 4, 0, 10 ), V( 8, 10, 12 ), primary );
		b.Ball( "Toy Head", V( 4, 0, 22 ), 6.5f, secondary );
		b.Rod( "Toy Arm", V( 4, -5, 13 ), V( 6, -10, 8 ), 2.5f, primary );
		b.Rod( "Toy Arm", V( 4, 5, 13 ), V( 6, 10, 17 ), 2.5f, primary );
		b.Ball( "Toy Eye", V( 9.6f, -2.5f, 23 ), 1.2f, Black );
		b.Ball( "Toy Eye", V( 9.6f, 2.5f, 23 ), 1.2f, Black );
	}

	static void Moon( HubBuilder b )
	{
		b.Box( "Plug", V( -4, 0, 6 ), V( 10, 12, 12 ), White );
		b.Rod( "Prong", V( -9, -3, 6 ), V( -17, -3, 6 ), 1.4f, Steel );
		b.Rod( "Prong", V( -9, 3, 6 ), V( -17, 3, 6 ), 1.4f, Steel );
		b.Ring( "Moon", V( 0, 0, 32 ), 17f, 9f, new Color( 1f, 0.93f, 0.62f ), 50f, 310f, 9 );
		b.Ball( "Moon Eye", V( 4.8f, -9, 40 ), 1.6f, Black );
	}

	static void Teacup( HubBuilder b )
	{
		b.Disc( "Saucer", V( 0, 0, 2 ), 20f, 2f, HubKit.Shade( Pink, 1.05f ), true );
		b.Box( "Cup", V( 0, 0, 11 ), V( 18, 18, 14 ), Pink );
		b.Box( "Rim", V( 0, 0, 18.5f ), V( 20, 20, 1.5f ), White );
		b.Ring( "Handle", V( 0, -10, 11 ), 5f, 2.4f, Pink, 90f, 270f, 5 );
		// There was never any tea.
		b.Box( "No Tea", V( 0, 0, 17 ), V( 15, 15, 1 ), HubKit.Shade( Pink, 0.55f ) );
	}

	static void Shoebox( HubBuilder b, Color primary )
	{
		b.Box( "Box", V( 0, 0, 10 ), V( 32, 52, 20 ), Card );
		b.Box( "Bedding", V( 0, 0, 19 ), V( 28, 48, 4 ), primary );
		var lid = b.Group( "Lid", V( -6, 0, 26 ), Rotation.FromPitch( -22f ) );
		lid.Box( "Lid", V( 0, 0, 0 ), V( 34, 54, 5 ), HubKit.Shade( Card, 1.15f ) );
		for ( int i = 0; i < 5; i++ )
			lid.Disc( "Air Hole", V( i % 2 == 0 ? -6 : 6, -18 + i * 9, 2.7f ), 1.8f, 0.4f, Black, true );
	}

	static void YoYo( HubBuilder b )
	{
		b.Disc( "Half", V( -3.5f, 0, 15 ), 14f, 3f, Red );
		b.Disc( "Half", V( 3.5f, 0, 15 ), 14f, 3f, Red );
		b.Disc( "Star", V( 6.6f, 0, 15 ), 6f, 0.6f, Yellow );
		b.Rod( "String", V( 0, 0, 28 ), V( 0, 5, 44 ), 1f, Cream );
		b.Ball( "Knot", V( 0, 5, 45 ), 2.4f, Cream );
		b.Rod( "String", V( 0, 5, 46 ), V( 0, -3, 58 ), 1f, Cream );
	}

	static void Photo( HubBuilder b, Color jumper )
	{
		var frame = b.Group( "Photo", V( -4, 0, 0 ), Rotation.FromPitch( -14f ) );
		frame.Box( "Print", V( 0, 0, 24 ), V( 2, 36, 46 ), White );
		frame.Box( "Sky", V( 1.2f, 0, 26 ), V( 0.6f, 30, 36 ), Sky );
		frame.Box( "Jumper", V( 1.6f, 0, 15 ), V( 0.6f, 20, 14 ), jumper );
		frame.Disc( "Head", V( 1.8f, 0, 29 ), 8f, 0.7f, Skin );
		frame.Box( "Smile", V( 2.6f, 0, 26 ), V( 0.4f, 6, 1.2f ), White );
		// The missing tooth.
		frame.Box( "Gap", V( 2.8f, 1, 26 ), V( 0.4f, 1.4f, 1.2f ), Black );
	}

	// ---- Anybody's ----------------------------------------------------------------------------------

	static void Book( HubBuilder b, Color cover )
	{
		b.Box( "Back Cover", V( 0, 0, 1 ), V( 38, 50, 2 ), cover );
		b.Box( "Pages", V( 1.5f, 0, 6 ), V( 36, 47, 8 ), Cream );
		b.Box( "Front Cover", V( 0, 0, 11 ), V( 38, 50, 2 ), cover, false, Rotation.FromRoll( 3f ) );
		b.Box( "Title", V( 4, 0, 12.4f ), V( 8, 34, 0.8f ), Black, false, Rotation.FromRoll( 3f ) );
		b.Box( "Picture", V( -8, 0, 12.4f ), V( 12, 18, 0.8f ), Red, false, Rotation.FromRoll( 3f ) );
	}

	static void Keys( HubBuilder b )
	{
		b.Rod( "Peg", V( -4, 0, 0 ), V( -4, 0, 58 ), 3f, Wood );
		b.Rod( "Hook", V( -4, 0, 56 ), V( 2, 0, 56 ), 2f, Wood );
		b.Ring( "Ring", V( 2, 0, 46 ), 10f, 1.6f, Steel, 0f, 360f, 10 );
		// Eleven keys and no doors; five are enough to say so.
		for ( int i = 0; i < 5; i++ )
		{
			float y = -12f + i * 6f;
			b.Rod( "Key", V( 2, y * 0.3f, 37 ), V( 3, y, 16 + (i % 2) * 5 ), 1.8f, i % 2 == 0 ? Brass : Steel );
			b.Box( "Key Head", V( 2, y * 0.35f, 35 ), V( 1.5f, 5, 5 ), i % 2 == 0 ? Brass : Steel );
		}
	}

	static void Watch( HubBuilder b )
	{
		b.Ring( "Strap", V( 0, 0, 21 ), 18f, 6f, new Color( 0.3f, 0.18f, 0.1f ), 0f, 360f, 12 );
		b.Disc( "Case", V( 2, 0, 39 ), 10f, 3f, Steel );
		b.Disc( "Face", V( 4.5f, 0, 39 ), 8f, 0.8f, Cream );
		// Stopped at 4:17.
		b.Rod( "Hour Hand", V( 5.5f, 0, 39 ), V( 5.5f, -3.5f, 36 ), 1f, Black );
		b.Rod( "Minute Hand", V( 5.5f, 0, 39 ), V( 5.5f, -6, 41 ), 0.8f, Black );
	}

	static void Thermos( HubBuilder b )
	{
		b.Box( "Flask", V( 0, 0, 22 ), V( 17, 17, 44 ), Red );
		for ( int i = 0; i < 3; i++ )
			b.Box( "Tartan", V( 0, 0, 10 + i * 12 ), V( 17.6f, 17.6f, 3 ), Green );
		b.Box( "Tartan", V( 0, -4, 22 ), V( 17.8f, 1.5f, 44 ), Yellow );
		b.Box( "Tartan", V( 0, 4, 22 ), V( 17.8f, 1.5f, 44 ), Yellow );
		b.Box( "Cup", V( 0, 0, 49 ), V( 18, 18, 10 ), Cream );
		b.Ring( "Handle", V( 0, -10, 49 ), 4f, 2f, Cream, 90f, 270f, 5 );
	}

	static void Tin( HubBuilder b )
	{
		b.Box( "Tin", V( 0, 0, 15 ), V( 25, 25, 30 ), Steel );
		b.Box( "Label", V( 0, 0, 15 ), V( 26, 26, 20 ), new Color( 0.95f, 0.6f, 0.2f ) );
		b.Ball( "Peach", V( 13.2f, -3, 15 ), V( 1, 6, 6 ), new Color( 1f, 0.75f, 0.45f ) );
		b.Ball( "Peach", V( 13.6f, 4, 13 ), V( 1, 5, 5 ), new Color( 1f, 0.8f, 0.5f ) );
		b.Box( "Rim", V( 0, 0, 30.5f ), V( 26, 26, 1.5f ), HubKit.Shade( Steel, 0.8f ) );
	}

	static void Umbrella( HubBuilder b, Color primary )
	{
		b.Box( "Handle", V( 0, 0, 5 ), V( 4, 4, 10 ), Wood );
		b.Rod( "Pole", V( 0, 0, 8 ), V( 0, 0, 56 ), 2.2f, Steel );
		var dark = HubKit.Shade( primary, 0.45f );
		for ( int i = 0; i < 8; i++ )
		{
			// One rib is broken and hangs straight down.
			float droop = i == 3 ? 72f : 26f;
			var panel = b.Group( "Rib", V( 0, 0, 55 ), Rotation.FromYaw( i * 45f ) * Rotation.FromPitch( droop ) );
			panel.Box( "Panel", V( 15, 0, 0 ), V( 30, 22, 1.5f ), i % 2 == 0 ? Black : dark );
		}
		b.Ball( "Tip", V( 0, 0, 58 ), 2f, Steel );
	}

	/// <summary>Three layers caught mid-turn, solved on the side that faces you and nowhere else.</summary>
	static void Cube( HubBuilder b, int seed )
	{
		var rng = new HubRng( seed ^ 0x2B1C );
		Color[] stickers = { White, Yellow, Green, Blue, new Color( 0.95f, 0.5f, 0.1f ) };
		for ( int layer = 0; layer < 3; layer++ )
		{
			var slab = b.Group( "Layer", V( 0, 0, 6 + layer * 10.5f ), Rotation.FromYaw( layer == 2 ? 18f : 0f ) );
			slab.Box( "Core", V( 0, 0, 0 ), V( 30, 30, 10 ), Black );
			for ( int i = 0; i < 3; i++ )
			{
				slab.Box( "Sticker", V( 15.3f, -10 + i * 10, 0 ), V( 0.6f, 8.6f, 8.6f ), Red );
				slab.Box( "Sticker", V( -10 + i * 10, 15.3f, 0 ), V( 8.6f, 0.6f, 8.6f ), rng.Pick( stickers ) );
				slab.Box( "Sticker", V( -10 + i * 10, -15.3f, 0 ), V( 8.6f, 0.6f, 8.6f ), rng.Pick( stickers ) );
			}
		}
	}

	static void Tree( HubBuilder b )
	{
		b.Rod( "Post", V( -4, -20, 0 ), V( -4, -20, 64 ), 3f, Wood );
		b.Rod( "Arm", V( -4, -20, 62 ), V( 0, 0, 62 ), 2.4f, Wood );
		b.Rod( "String", V( 0, 0, 62 ), V( 0, 0, 51 ), 0.8f, Cream );
		// The only tree down here. It is doing its best.
		b.Box( "Tier", V( 0, 0, 46 ), V( 2, 12, 10 ), Green );
		b.Box( "Tier", V( 0, 0, 37 ), V( 2, 20, 10 ), Green );
		b.Box( "Tier", V( 0, 0, 28 ), V( 2, 28, 10 ), Green );
		b.Box( "Trunk", V( 0, 0, 20 ), V( 2, 6, 7 ), HubKit.Shade( Green, 0.6f ) );
	}

	static void Trophy( HubBuilder b )
	{
		b.Box( "Base", V( 0, 0, 5 ), V( 18, 18, 10 ), Black );
		b.Box( "Plaque", V( 9.3f, 0, 5 ), V( 0.6f, 11, 4 ), Brass );
		b.Box( "Stem", V( 0, 0, 16 ), V( 5, 5, 12 ), Brass );
		b.Box( "Cup", V( 0, 0, 25 ), V( 13, 13, 6 ), Brass );
		b.Box( "Cup", V( 0, 0, 33 ), V( 18, 18, 10 ), Brass );
		b.Ring( "Handle", V( 0, -9, 32 ), 7f, 2f, Brass, 90f, 270f, 5 );
		b.Ring( "Handle", V( 0, 9, 32 ), 7f, 2f, Brass, -90f, 90f, 5 );
		// Third place.
		b.Ball( "Bowling Ball", V( 0, 0, 42 ), 5f, Black );
	}

	static void Gnome( HubBuilder b )
	{
		b.Box( "Boots", V( 2, 0, 2.5f ), V( 14, 18, 5 ), Black );
		b.Ball( "Coat", V( 0, 0, 17 ), V( 11, 12, 13 ), Blue );
		b.Ball( "Head", V( 0, 0, 33 ), 8.5f, Skin );
		b.Ball( "Beard", V( 6, 0, 26 ), V( 5, 8, 10 ), White );
		b.Ball( "Nose", V( 8.5f, 0, 33 ), 2.6f, new Color( 0.9f, 0.5f, 0.45f ) );
		b.Box( "Hat", V( 0, 0, 42 ), V( 15, 15, 6 ), Red );
		b.Box( "Hat", V( 0, 0, 48 ), V( 11, 11, 6 ), Red );
		b.Box( "Hat", V( 0, 0, 54 ), V( 7, 7, 6 ), Red );
		// The chip.
		b.Box( "Hat Tip", V( 5, 9, 2 ), V( 4, 4, 5 ), Red, false, Rotation.FromRoll( 40f ) );
	}

	static void Harmonica( HubBuilder b )
	{
		b.Box( "Rest", V( 0, -16, 5 ), V( 10, 5, 10 ), Wood );
		b.Box( "Rest", V( 0, 16, 5 ), V( 10, 5, 10 ), Wood );
		b.Box( "Comb", V( 0, 0, 15 ), V( 11, 46, 6 ), new Color( 0.5f, 0.3f, 0.15f ) );
		b.Box( "Cover", V( -0.5f, 0, 19 ), V( 10, 46, 2 ), Steel );
		b.Box( "Cover", V( -0.5f, 0, 11 ), V( 10, 46, 2 ), Steel );
		for ( int i = 0; i < 8; i++ )
			b.Box( "Hole", V( 5.6f, -17.5f + i * 5, 15 ), V( 0.6f, 3, 3.4f ), Black );
	}

	static void Level( HubBuilder b )
	{
		b.Box( "Body", V( 0, 0, 12 ), V( 8, 58, 13 ), Yellow );
		b.Box( "Foot", V( 0, -22, 3 ), V( 10, 6, 6 ), Wood );
		b.Box( "Foot", V( 0, 22, 3 ), V( 10, 6, 6 ), Wood );
		b.Box( "Vial", V( 4.2f, 0, 12 ), V( 0.6f, 13, 6 ), new Color( 0.6f, 0.95f, 0.5f ) );
		// The bubble finds the middle every time.
		b.Ball( "Bubble", V( 4.8f, 0, 12.6f ), V( 0.6f, 2.6f, 2f ), White );
		b.Disc( "End Vial", V( 4.2f, -22, 12 ), 3.4f, 0.6f, new Color( 0.6f, 0.95f, 0.5f ) );
		b.Disc( "End Vial", V( 4.2f, 22, 12 ), 3.4f, 0.6f, new Color( 0.6f, 0.95f, 0.5f ) );
	}

	static void ViewMaster( HubBuilder b )
	{
		b.Box( "Stand", V( 0, 0, 4 ), V( 12, 20, 8 ), Black );
		b.Box( "Body", V( 0, 0, 20 ), V( 14, 36, 22 ), Red );
		b.Box( "Eyepiece", V( 9, -9, 20 ), V( 6, 11, 11 ), Black );
		b.Box( "Eyepiece", V( 9, 9, 20 ), V( 6, 11, 11 ), Black );
		// One reel: seven pictures of a very big hole.
		b.Disc( "Reel", V( -1, 0, 36 ), 15f, 1f, White );
		for ( int i = 0; i < 5; i++ )
		{
			float r = (18f + i * 36f) * MathF.PI / 180f;
			b.Box( "Slide", V( 0.4f, MathF.Cos( r ) * 11f, 36 + MathF.Sin( r ) * 11f ), V( 0.6f, 3, 3 ), new Color( 0.75f, 0.4f, 0.2f ) );
		}
		b.Rod( "Lever", V( 0, 18, 26 ), V( 0, 23, 14 ), 2f, Black );
	}

	/// <summary>Cards, tickets, passes, badges and receipts: a slip of paper propped up to be read.</summary>
	static void PaperThing( HubBuilder b, string name, Color primary, Color secondary )
	{
		bool receipt = name.Contains( "receipt" );
		bool ticket = name.Contains( "ticket" );
		bool badge = name.Contains( "badge" );
		bool licence = name.Contains( "licence" ) || name.Contains( "pass" ) || name.Contains( "library" );

		float wide = receipt ? 20f : 42f, tall = receipt ? 54f : ticket ? 22f : 30f;
		var paper = receipt ? White : ticket ? Yellow : licence ? new Color( 0.95f, 0.75f, 0.78f ) : badge ? White : Cream;

		b.Box( "Prop", V( -8, 0, 4 ), V( 8, 14, 8 ), Wood );
		var slip = b.Group( "Slip", V( -3, 0, 6 ), Rotation.FromPitch( -16f ) );
		slip.Box( "Paper", V( 0, 0, tall * 0.5f ), V( 1.5f, wide, tall ), paper );

		int lines = receipt ? 7 : 3;
		for ( int i = 0; i < lines; i++ )
			slip.Box( "Line", V( 1, wide * 0.1f, tall - 6 - i * (receipt ? 6f : 5f) ), V( 0.5f, wide * (i % 2 == 0 ? 0.5f : 0.38f), 1.3f ), Black );

		if ( ticket ) slip.Box( "Scratch Panel", V( 1, -8, 8 ), V( 0.5f, 18, 8 ), Steel );
		else if ( licence ) slip.Disc( "Portrait", V( 1, -wide * 0.3f, tall * 0.55f ), 6f, 0.5f, Skin );
		else if ( badge )
		{
			slip.Box( "Stripe", V( 1, 0, tall - 4 ), V( 0.5f, wide, 7 ), Red );
			slip.Box( "Clip", V( 0, 0, tall + 2 ), V( 2, 8, 5 ), Steel );
		}
		else if ( receipt ) slip.Box( "No Returns", V( 1, 0, 5 ), V( 0.5f, 14, 2.4f ), Red );
		else
		{
			// A card or a postcard: a picture, and something written in crayon.
			slip.Box( "Picture", V( 1, -wide * 0.25f, tall * 0.5f ), V( 0.5f, wide * 0.35f, tall * 0.6f ), primary );
			slip.Box( "Crayon", V( 1.2f, wide * 0.1f, 5 ), V( 0.5f, wide * 0.5f, 2.6f ), secondary, false, Rotation.FromRoll( 4f ) );
		}
	}

	static void Jigsaw( HubBuilder b )
	{
		// One piece, all sky. It belongs somewhere exactly.
		var piece = b.Group( "Piece", V( -3, 0, 2 ), Rotation.FromPitch( -14f ) );
		piece.Box( "Piece", V( 0, 0, 20 ), V( 3, 30, 30 ), Sky );
		piece.Ball( "Knob", V( 0, 0, 39 ), V( 1.5f, 6, 6 ), Sky );
		piece.Ball( "Knob", V( 0, 19, 20 ), V( 1.5f, 6, 6 ), Sky );
		piece.Ball( "Cloud", V( 1.4f, -5, 24 ), V( 0.6f, 8, 4 ), White );
		b.Box( "Prop", V( -9, 0, 4 ), V( 8, 14, 8 ), Wood );
	}

	static void BubbleWrap( HubBuilder b )
	{
		var sheet = b.Group( "Sheet", V( -3, 0, 2 ), Rotation.FromPitch( -14f ) );
		sheet.Box( "Sheet", V( 0, 0, 24 ), V( 1.5f, 38, 46 ), new Color( 0.8f, 0.88f, 0.9f ) );
		// Every bubble intact.
		for ( int i = 0; i < 12; i++ )
			sheet.Ball( "Bubble", V( 1.2f, -12 + (i % 3) * 12, 8 + (i / 3) * 11 ), V( 1.2f, 3.6f, 3.6f ), White );
		b.Box( "Prop", V( -9, 0, 4 ), V( 8, 14, 8 ), Wood );
	}

	/// <summary>The fallback for anything unknown: a small wrapped box on a block, with a tag.</summary>
	static void Keepsake( HubBuilder b, Color primary, Color secondary, int seed )
	{
		var rng = new HubRng( seed ^ 0x6EE5 );
		var size = V( rng.R( 16f, 26f ), rng.R( 22f, 34f ), rng.R( 12f, 22f ) );
		b.Box( "Block", V( 0, 0, 6 ), V( 30, 40, 12 ), rng.Pick( HubKit.Junk ) );
		b.Box( "Keepsake", V( 0, 0, 12 + size.z * 0.5f ), size, HubKit.Shade( rng.Pick( HubKit.Junk ), 1.25f ), false, Rotation.FromYaw( rng.R( -12f, 12f ) ) );
		b.Box( "Ribbon", V( 0, 0, 12 + size.z * 0.5f ), V( size.x + 1, 4, size.z + 1 ), primary );
		b.Box( "Ribbon", V( 0, 0, 12 + size.z + 0.6f ), V( 4, size.y + 1, 1 ), primary );
		b.Box( "Tag", V( size.x * 0.5f + 2, 6, 13 ), V( 1, 7, 5 ), secondary, false, Rotation.FromRoll( 15f ) );
	}
}