RunStart (ServerShared, no Unity type) owns what a new run starts with (docs/scenarios-cut.md, 2.2): - GenerateArena: the galaxy's entrance pack, generated under the scenario's Ambient rule. ZoneGenerator.GenerateZone gains `ambient`; false keeps planets, orbits and stations and generates no ship, turret or wanderer. - Check: every failure staging a scenario would hit, found with no zone, touching no store. - Stage: all-or-nothing. With no scenario, the generated starting-hull ship at the origin, as StartGame built it. With one, the player preset and the entities at their authored place and heading with cargo, stance set both ways through SetIff, a Minion for each piloted one; all through Zone.Admit. Scenario (aetheria.scenario v1) joins AetheriaStores.CatalogTypes. RunStartTests stage into a real prelude arena from the shipped catalog and authored settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.8 KiB
C#
42 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using GameCult.Caching;
|
|
using MessagePack;
|
|
using CultMath;
|
|
|
|
// A scenario is an arena whose conditions are present at spawn (docs/scenarios-cut.md): the player's ship and every
|
|
// other entity already fitted and placed. Authored catalog data, read at runtime; RunStart stages it into a new run.
|
|
// It sets conditions and nothing else: once staged, its entities are ordinary run state.
|
|
[CultDocument("aetheria.scenario", "1"), MessagePackObject]
|
|
public class Scenario
|
|
{
|
|
[CultName, Key(0)] public string Name;
|
|
[Key(1)] public string Brief; // the conditions in a line or two, shown in the menu
|
|
[Key(2)] public uint Seed; // the arena galaxy derives from it, so every launch has one layout
|
|
[Key(3)] public bool Ambient; // false: planets, orbits and stations, but no generated ship or turret
|
|
[Key(4)] public ScenarioShip Player;
|
|
[Key(5)] public List<ScenarioEntity> Entities = new List<ScenarioEntity>();
|
|
}
|
|
|
|
// A preset placed in the arena. A ship hull stages a Ship; a turret hull an orbital entity with no orbit, which stays
|
|
// where it is put.
|
|
[MessagePackObject]
|
|
public class ScenarioShip
|
|
{
|
|
[Key(0)] public CultRecordRef<Loadout> Loadout;
|
|
[Key(1)] public float2 Position; // zone xz
|
|
[Key(2)] public float2 Direction; // zero keeps the entity's default heading
|
|
[Key(3)] public List<CultRecordRef<EquippableItemData>> Cargo = new List<CultRecordRef<EquippableItemData>>(); // first cargo bay
|
|
}
|
|
|
|
[MessagePackObject]
|
|
public class ScenarioEntity : ScenarioShip
|
|
{
|
|
[Key(4)] public ScenarioStance Stance; // applied both ways between this entity and the player
|
|
[Key(5)] public bool Piloted; // a Minion flies it; otherwise it has no agent and stays put
|
|
}
|
|
|
|
public enum ScenarioStance
|
|
{
|
|
Neutral,
|
|
Hostile
|
|
}
|