Galaxy.IsPrelude is the one owner of whether a run is the prelude: ActionGameManager.IsTutorial and PlayerSettings.TutorialPassed are cut

IsTutorial duplicated Galaxy.IsPrelude; its readers read CurrentGalaxy.IsPrelude, and RunSave.Capture writes
SavedGame.IsTutorial from galaxy.IsPrelude with no isTutorial argument. TutorialPassed was never written and its only
reader was New Game's unreachable main-galaxy branch, which goes with it (S2 brings the main galaxy back as a
scenario). spawnturret's two identical generator branches collapse to one. Old player.cc files still load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-03 20:26:30 +02:00
commit 8a0a29e0de
6 changed files with 60 additions and 46 deletions

View file

@ -106,7 +106,6 @@ public class ActionGameManager : MonoBehaviour
}
public static Galaxy CurrentGalaxy;
public static bool IsTutorial;
public GameSettings Settings;
//public string StarterShipTemplate = "Longinus";
@ -250,7 +249,7 @@ public class ActionGameManager : MonoBehaviour
{
if (CurrentGalaxy != null)
{
var (game, zones) = RunSave.Capture(CultCache, CurrentGalaxy, Zone, DockedEntity ?? CurrentEntity, IsTutorial,
var (game, zones) = RunSave.Capture(CultCache, CurrentGalaxy, Zone, DockedEntity ?? CurrentEntity,
_actionBarSlots.Select(s => s.Save()).ToArray());
RunSave.Commit(CultCache, game, zones, ItemManager.Lots);
}
@ -578,19 +577,7 @@ public class ActionGameManager : MonoBehaviour
{
var nearestFaction = CurrentGalaxy.Factions.MinBy(f => CurrentGalaxy.HomeZones[f].Distance[Zone.GalaxyZone]);
var loadoutGenerator = IsTutorial ? new LoadoutGenerator(
ref ItemManager.Random,
ItemManager,
CurrentGalaxy,
Zone.GalaxyZone,
nearestFaction,
.5f) : new LoadoutGenerator(
ref ItemManager.Random,
ItemManager,
CurrentGalaxy,
Zone.GalaxyZone,
nearestFaction,
.5f);
var loadoutGenerator = new LoadoutGenerator(ref ItemManager.Random, ItemManager, CurrentGalaxy, Zone.GalaxyZone, nearestFaction, .5f);
var turret = EntitySerializer.Unpack(ItemManager, Zone, loadoutGenerator.GenerateTurretLoadout());
turret.Position.xz = _currentEntity.Position.xz +
@ -728,7 +715,7 @@ public class ActionGameManager : MonoBehaviour
Settings.ZoneSettings,
CurrentGalaxy,
galaxyZone,
IsTutorial
CurrentGalaxy.IsPrelude
);
galaxyZone.Contents = new Zone(ItemManager, Settings.PlanetSettings, galaxyZone.PackedContents, galaxyZone, CurrentGalaxy);
}
@ -815,7 +802,7 @@ public class ActionGameManager : MonoBehaviour
PopulateLevel(CurrentGalaxy.Entrance);
var failures = new List<string>();
var staged = RunStart.Stage(ItemManager, Zone, null, Settings.StartingHullName,
IsTutorial ? CurrentGalaxy.ResolveFaction(Settings.TutorialGenerationSettings.ProtagonistFaction) : null, failures)
CurrentGalaxy.IsPrelude ? CurrentGalaxy.ResolveFaction(Settings.TutorialGenerationSettings.ProtagonistFaction) : null, failures)
?? throw new InvalidOperationException($"The new run could not stage: {string.Join("; ", failures)}");
BindToEntity(staged.Player);
}

View file

@ -10,7 +10,7 @@ using static CultMath.math;
public class PlayerSettings
{
[Key(0)] public string Name = "Anonymous";
[Key(2)] public bool TutorialPassed;
// Keys 1 and 2 are retired; an older player.cc that still carries them loads, and they are dropped.
[Key(3)] public Dictionary<string, string> HashedStoryFiles = new Dictionary<string, string>();
[Key(4)] public PlayerGameplaySettings GameplaySettings = new PlayerGameplaySettings();
[Key(5)] public PlayerInputSettings InputSettings = new PlayerInputSettings();

View file

@ -55,7 +55,7 @@ public static class RunSave
{
// The live run as plain documents. Writes nothing.
public static (SavedGame Game, SavedZone[] Zones) Capture(CultCache cache, Galaxy galaxy, Zone currentZone,
Entity currentEntity, bool isTutorial, SavedActionBarBinding[] actionBar)
Entity currentEntity, SavedActionBarBinding[] actionBar)
{
var factions = galaxy.HomeZones.Keys.ToArray();
var game = new SavedGame
@ -74,7 +74,7 @@ public static class RunSave
CurrentZoneEntity = currentZone.Entities.IndexOf(currentEntity),
Entrance = Array.IndexOf(galaxy.Zones, galaxy.Entrance),
Exit = Array.IndexOf(galaxy.Zones, galaxy.Exit),
IsTutorial = isTutorial,
IsTutorial = galaxy.IsPrelude,
ActionBarBindings = actionBar
};

View file

@ -111,7 +111,6 @@ public class MainMenu : MonoBehaviour
{
try { RunSave.RequireDesigns(cache, saved); }
catch (InvalidOperationException error) { Refuse("Cannot continue this run", error.Message); return; }
ActionGameManager.IsTutorial = saved.IsTutorial;
ActionGameManager.CurrentGalaxy = new Galaxy(cache, saved, Debug.Log);
EnterGame();
});
@ -130,29 +129,6 @@ public class MainMenu : MonoBehaviour
Dialog.AddProperty(() => generatorState);
Dialog.Show();
if (ActionGameManager.PlayerSettings.TutorialPassed)
{
var backgroundSettings = MessagePackSerializer.Deserialize<SectorBackgroundSettings>(
MessagePackSerializer.Serialize(Settings.SectorBackgroundSettings));
backgroundSettings.NoisePosition = Random.value * 1000;
ActionGameManager.IsTutorial = false;
Task.Run(() =>
{
var sector = new Galaxy(
Settings.SectorGenerationSettings,
backgroundSettings,
Settings.NameGeneratorSettings,
ActionGameManager.CultCache,
Debug.Log,
setState);
Observable.NextFrame().Subscribe(_ =>
{
ActionGameManager.CurrentGalaxy = sector;
EnterGame();
});
}).ContinueWith(t => Debug.LogException(t.Exception), TaskContinuationOptions.OnlyOnFaulted);
}
else
{
var backgroundSettings = MessagePackSerializer.Deserialize<SectorBackgroundSettings>(
MessagePackSerializer.Serialize(Settings.TutorialBackgroundSettings));
@ -163,7 +139,6 @@ public class MainMenu : MonoBehaviour
setState($"Finding Galaxy Position: iteration {iteration++}");
} while (backgroundSettings.CloudDensity(float2(0.5f)) < .5f);
ActionGameManager.IsTutorial = true;
Task.Run(() =>
{
var sector = new Galaxy(