2026-11-28 10:37:12 +01:00
using System.Collections.Generic ;
A station buys only goods its installed gear wants, only as far as its bays hold: StationWants, Zenith's ore silo and standing haul order
StationWants.Of derives the wants per call: the draws of each installed recipe facility's run list (Production.Draws, beside Take) and, for a silo-carrying station, the goods of the haul orders that start at its orbit. TrySellPart is gated by it and says NotWanted or NoRoom; OreValue and TrySellOre sell only wanted ore. SiloData is a bay on a Facility row that holds commodity stacks only; HaulOrderData is a run document staged by DemoTerminus (ScenarioStage.Station, HaulOrder). Generated station gear stock stops at half the stock bay (StationStockShare) and skips silos. Facilities authors facility:ore-silo, its NotOffered product and trade-hub's Facilities (economy author Facilities apply; a rerun writes nothing); L-facility accepts a silo. EconomyLoop sells the sortie's hold to the processing station and reports sold, refused and offered value. TradeMenu (outside the dotnet build) reports NotWanted and NoRoom. Tests: fixtures seat a Smelter; new StationWantsTests; DemoLoop re-anchors BaseBuyRatio (cheapest piece Zenith stocks reads 2500, not 15500, once stock stops at half the bay).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-28 12:03:41 +01:00
using System.Linq ;
using GameCult.Caching ;
2026-11-28 16:58:32 +01:00
using static CultMath . math ;
using static ItemRotation ;
2026-10-06 19:32:02 +02:00
using float2 = CultMath . float2 ;
// The demo: one gate, one region and one boss, with a fixed cast. The Pirates are the protagonist's ostensible
// employer, Zhestokost the antagonist whose home is the boss zone and the exit, Lucent Media and Aeronautics Unlimited
2026-11-28 16:58:32 +01:00
// the neutrals. A galaxy of that cast at half influence; the player, who is not a Pirate, flies the authored Longinus of
// Starter, the same fit on every seed (ruling demo-start-hull-longinus). Its entrance holds two stations on every seed: Aeronautics Unlimited's Zenith trade hub and the Pirates' refinery.
2026-10-06 19:32:02 +02:00
public sealed class DemoTerminus : Scenario
{
Retire the prelude and the tutorial: the cast, the scenario and the save own what they bundled
Galaxy.IsPrelude, SavedGame.IsTutorial (key 11 retired), TutorialGalaxy, TutorialGenerationSettings, its Settings.asset block and the
dead GalaxyStage/Galaxy constructor parameters (PlayerSettings, narrative directory) are gone. The rules they bundled move to their
owners: GalaxyCast.InfluenceScale (demo and test cast .5, main 1) carried by Galaxy and saved as SavedGame key 17, so a pre-cut run is
refused at Continue with a message; Scenario.EntranceStation (MainGalaxy false) decides the forced entrance station instead of the
galaxy; GalaxyStage.Cast(cast) replaces Prelude. The six arenas that read the authored cast generate DemoTerminus.Cast; Development
lists only Main Galaxy. TutorialBackgroundSettings is renamed CastBackgroundSettings in the asset YAML. Tests build their galaxy from
TestCasts.Wide and Background, the retired block's values, so every test galaxy is unchanged.
Suite at 8b2d1f544: 4 red (font credits, chunk info, trojan swarm, two-ai digest, Windows). After: the same 4, digest unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-19 20:14:26 +01:00
public static readonly GalaxyCast Cast = new GalaxyCast
2026-10-06 19:32:02 +02:00
{
ProtagonistFaction = "Pirates" ,
AntagonistFaction = "Zhe" ,
BufferFaction = "Luc" ,
NeutralFactions = new [ ] { "Aero" } ,
QuestFaction = null ,
ZoneCount = 64 ,
Retire the prelude and the tutorial: the cast, the scenario and the save own what they bundled
Galaxy.IsPrelude, SavedGame.IsTutorial (key 11 retired), TutorialGalaxy, TutorialGenerationSettings, its Settings.asset block and the
dead GalaxyStage/Galaxy constructor parameters (PlayerSettings, narrative directory) are gone. The rules they bundled move to their
owners: GalaxyCast.InfluenceScale (demo and test cast .5, main 1) carried by Galaxy and saved as SavedGame key 17, so a pre-cut run is
refused at Continue with a message; Scenario.EntranceStation (MainGalaxy false) decides the forced entrance station instead of the
galaxy; GalaxyStage.Cast(cast) replaces Prelude. The six arenas that read the authored cast generate DemoTerminus.Cast; Development
lists only Main Galaxy. TutorialBackgroundSettings is renamed CastBackgroundSettings in the asset YAML. Tests build their galaxy from
TestCasts.Wide and Background, the retired block's values, so every test galaxy is unchanged.
Suite at 8b2d1f544: 4 red (font credits, chunk info, trojan swarm, two-ai digest, Windows). After: the same 4, digest unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-19 20:14:26 +01:00
LinkDensity = . 5f ,
InfluenceScale = . 5f
2026-10-06 19:32:02 +02:00
} ;
2026-11-28 10:37:12 +01:00
// Zenith (ruling demo-zenith-ore-depot) and the Pirates' processing station (ruling demo-processing-station-buys-ore),
// named from the cast so the cast and the orders cannot drift.
public override IReadOnlyList < EntranceStationOrder > EntranceStations { get ; } = new [ ]
{
new EntranceStationOrder ( Cast . NeutralFactions [ 0 ] , "trade-hub" ) ,
new EntranceStationOrder ( Cast . ProtagonistFaction , "processing" )
} ;
2026-10-06 19:32:02 +02:00
public override string Name = > "Terminus (Demo)" ;
2026-10-21 19:01:43 +02:00
public override string Id = > "demo-terminus" ;
2026-10-06 19:32:02 +02:00
public override string Brief = > "One gate, one region, one boss. Allied: the Pirates. Opposed: Zhestokost. " +
"Neutral: Lucent Media and Aeronautics Unlimited." ;
2026-11-28 16:58:32 +01:00
// The quality of every lot of the starter: a sim-tuned knob (economy-numbers-are-sim-tuned-knobs), repair scales with it.
public const float StarterQuality = . 5f ;
// The demo player's ship (ruling demo-start-hull-longinus, read by economy-is-never-faked: an authored fit, no random draw):
// the Longinus with its Light Lasers on the two Energy mounts, since a Cell Blaster there is ammunition-fed and the starter
// mines with its lasers. Everything else is the design the generator gives every seed, by product, at the generator's cells.
public static ScenarioFit Starter ( ScenarioStage stage ) = > stage . Fit ( "Longinus" , StarterQuality ,
( "Wheelhouse" , int2 ( 2 , 6 ) , None ) , // Cockpit 2x2
( "True North" , int2 ( 1 , 0 ) , Reversed ) , // Large Drive
( "True North" , int2 ( 3 , 0 ) , Reversed ) , // Large Drive
( "Hestia" , int2 ( 2 , 4 ) , None ) , // Compact Reactor
( "Homer" , int2 ( 0 , 5 ) , None ) , // Guided Missile Launcher
( "Homer" , int2 ( 5 , 5 ) , None ) , // Guided Missile Launcher
( "Stagecoach" , int2 ( 2 , 14 ) , CounterClockwise ) , // Medium Drive
( "Stagecoach" , int2 ( 3 , 14 ) , Clockwise ) , // Medium Drive
( "Spotlight" , int2 ( 1 , 8 ) , None ) , // Light Laser
( "Spotlight" , int2 ( 4 , 8 ) , None ) , // Light Laser
( "Iapyx" , int2 ( 2 , 2 ) , CounterClockwise ) , // Radiator
( "Iapyx" , int2 ( 3 , 2 ) , Clockwise ) , // Radiator
( "not if i see you first" , int2 ( 3 , 10 ) , None ) , // Compact Sensor
( "PotaT+-" , int2 ( 1 , 5 ) , None ) , // Capacitor
( "👀🎯" , int2 ( 1 , 6 ) , None ) , // Targeting Computer
( "Space Tractor" , int2 ( 1 , 7 ) , None ) , // Tractor Beam
( "Pithos" , int2 ( 2 , 8 ) , None ) ) ; // Cargo Bay
2026-10-06 19:32:02 +02:00
public override Galaxy Generate ( GalaxyStage stage )
{
Retire the prelude and the tutorial: the cast, the scenario and the save own what they bundled
Galaxy.IsPrelude, SavedGame.IsTutorial (key 11 retired), TutorialGalaxy, TutorialGenerationSettings, its Settings.asset block and the
dead GalaxyStage/Galaxy constructor parameters (PlayerSettings, narrative directory) are gone. The rules they bundled move to their
owners: GalaxyCast.InfluenceScale (demo and test cast .5, main 1) carried by Galaxy and saved as SavedGame key 17, so a pre-cut run is
refused at Continue with a message; Scenario.EntranceStation (MainGalaxy false) decides the forced entrance station instead of the
galaxy; GalaxyStage.Cast(cast) replaces Prelude. The six arenas that read the authored cast generate DemoTerminus.Cast; Development
lists only Main Galaxy. TutorialBackgroundSettings is renamed CastBackgroundSettings in the asset YAML. Tests build their galaxy from
TestCasts.Wide and Background, the retired block's values, so every test galaxy is unchanged.
Suite at 8b2d1f544: 4 red (font credits, chunk info, trojan swarm, two-ai digest, Windows). After: the same 4, digest unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-19 20:14:26 +01:00
var galaxy = stage . Cast ( Cast ) ;
2026-10-06 19:32:02 +02:00
galaxy . PlaceGate ( galaxy . ResolveFaction ( Cast . AntagonistFaction ) ) ;
return galaxy ;
}
public override void Stage ( ScenarioStage stage )
{
var galaxy = stage . Galaxy ;
var pirates = galaxy . ResolveFaction ( Cast . ProtagonistFaction ) ;
galaxy . FactionRelationships [ pirates ] = FactionRelationship . Friendly ;
galaxy . FactionRelationships [ galaxy . ResolveFaction ( Cast . AntagonistFaction ) ] = FactionRelationship . Hated ;
galaxy . FactionRelationships [ galaxy . ResolveFaction ( Cast . BufferFaction ) ] = FactionRelationship . Neutral ;
foreach ( var neutral in Cast . NeutralFactions )
galaxy . FactionRelationships [ galaxy . ResolveFaction ( neutral ) ] = FactionRelationship . Neutral ;
2026-11-28 16:58:32 +01:00
stage . Player ( Starter ( stage ) , float2 . zero ) ;
A station buys only goods its installed gear wants, only as far as its bays hold: StationWants, Zenith's ore silo and standing haul order
StationWants.Of derives the wants per call: the draws of each installed recipe facility's run list (Production.Draws, beside Take) and, for a silo-carrying station, the goods of the haul orders that start at its orbit. TrySellPart is gated by it and says NotWanted or NoRoom; OreValue and TrySellOre sell only wanted ore. SiloData is a bay on a Facility row that holds commodity stacks only; HaulOrderData is a run document staged by DemoTerminus (ScenarioStage.Station, HaulOrder). Generated station gear stock stops at half the stock bay (StationStockShare) and skips silos. Facilities authors facility:ore-silo, its NotOffered product and trade-hub's Facilities (economy author Facilities apply; a rerun writes nothing); L-facility accepts a silo. EconomyLoop sells the sortie's hold to the processing station and reports sold, refused and offered value. TradeMenu (outside the dotnet build) reports NotWanted and NoRoom. Tests: fixtures seat a Smelter; new StationWantsTests; DemoLoop re-anchors BaseBuyRatio (cheapest piece Zenith stocks reads 2500, not 15500, once stock stops at half the bay).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-28 12:03:41 +01:00
// Zenith's silo buys the ores the refinery's gear draws (ruling demo-zenith-ore-depot), by a standing order to the
2026-11-28 14:23:47 +01:00
// refinery, and a hauler of Zenith's faction carries it (ore-haul-run).
A station buys only goods its installed gear wants, only as far as its bays hold: StationWants, Zenith's ore silo and standing haul order
StationWants.Of derives the wants per call: the draws of each installed recipe facility's run list (Production.Draws, beside Take) and, for a silo-carrying station, the goods of the haul orders that start at its orbit. TrySellPart is gated by it and says NotWanted or NoRoom; OreValue and TrySellOre sell only wanted ore. SiloData is a bay on a Facility row that holds commodity stacks only; HaulOrderData is a run document staged by DemoTerminus (ScenarioStage.Station, HaulOrder). Generated station gear stock stops at half the stock bay (StationStockShare) and skips silos. Facilities authors facility:ore-silo, its NotOffered product and trade-hub's Facilities (economy author Facilities apply; a rerun writes nothing); L-facility accepts a silo. EconomyLoop sells the sortie's hold to the processing station and reports sold, refused and offered value. TradeMenu (outside the dotnet build) reports NotWanted and NoRoom. Tests: fixtures seat a Smelter; new StationWantsTests; DemoLoop re-anchors BaseBuyRatio (cheapest piece Zenith stocks reads 2500, not 15500, once stock stops at half the bay).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-28 12:03:41 +01:00
var zenith = stage . Station ( "trade-hub" ) ;
var refinery = stage . Station ( "processing" ) ;
if ( refinery = = null ) return ;
var items = refinery . ItemManager ;
var ores = StationWants . Of ( refinery ) . Where ( good = > FieldKinds . IsOre ( items . ItemData , items . ItemData . Get ( new CultRecordRef < ItemData > ( good ) ) ) )
. OrderBy ( good = > good . Value , System . StringComparer . Ordinal ) . Select ( good = > new CultRecordRef < ItemData > ( good ) ) ;
stage . HaulOrder ( "demo-terminus-ore" , zenith , refinery , ores , "scenario:demo-terminus" ) ;
2026-11-28 16:58:32 +01:00
// Interim scaffolding (economy-is-never-faked): the hauler's draw is deleted when an Aeronautics Unlimited shipyard in the
// region's chain (demo-chain-spans-the-region) builds it.
2026-11-28 14:23:47 +01:00
stage . Hauler ( stage . Generated ( null , zenith . Faction ) , "demo-terminus-ore" , stage . Arena . GetOrbitPosition ( zenith . OrbitData ) ) ;
2026-10-06 19:32:02 +02:00
}
}