Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Source/Client/Windows/BootstrapConfiguratorWindow.BootstrapFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public partial class BootstrapConfiguratorWindow
{
private const string BootstrapSaveName = "MpBootstrapSave";
private const float PostMapEnterSaveDelaySeconds = 1.5f;
private const float PostMapEnterWindowDelaySeconds = 0.1f;

private bool hideWindowDuringMapGen;
private bool autoAdvanceArmed;
Expand All @@ -29,6 +30,7 @@ public partial class BootstrapConfiguratorWindow
private string saveUploadStatus;
private float saveUploadProgress;
private float postMapEnterSaveDelayRemaining;
private float postMapEnterWindowDelayRemaining;

private float GetGenerateMapStepHeight()
{
Expand Down Expand Up @@ -132,6 +134,7 @@ private void StartVanillaNewColonyFlow()
savedReplayPath = null;
autoAdvanceArmed = true;
AwaitingBootstrapMapInit = true;
postMapEnterWindowDelayRemaining = 0f;
saveUploadStatus = "Generating map...";
Find.WindowStack.TryRemove(this);

Expand All @@ -144,7 +147,7 @@ private void TryArmAwaitingBootstrapMapInit()
if (AwaitingBootstrapMapInit)
return;

if (Multiplayer.Client != null || bootstrapSaveQueued || saveReady || isUploadingSave || saveUploadAutoStarted)
if (Multiplayer.Client != null || bootstrapSaveQueued || saveReady || isUploadingSave || saveUploadAutoStarted || awaitingControllablePawns || postMapEnterSaveDelayRemaining > 0f)
return;

if (Current.ProgramState != ProgramState.Playing || Find.Maps == null || Find.Maps.Count == 0)
Expand Down Expand Up @@ -174,11 +177,10 @@ public void OnBootstrapMapInitialized()
retainInstanceOnClose = false;
AwaitingBootstrapMapInit = false;
postMapEnterSaveDelayRemaining = PostMapEnterSaveDelaySeconds;
postMapEnterWindowDelayRemaining = PostMapEnterWindowDelaySeconds;
awaitingControllablePawns = true;
bootstrapSaveQueued = false;
saveUploadStatus = "Map initialized. Waiting for controllable colonists to spawn...";

TryShowBootstrapWindow();
}

private void TryShowBootstrapWindow()
Expand All @@ -189,7 +191,7 @@ private void TryShowBootstrapWindow()
if (Find.WindowStack.WindowOfType<BootstrapConfiguratorWindow>() != null)
return;

if (Find.WindowStack.Windows.OfType<Dialog_MessageBox>().Any())
if (Find.WindowStack.Windows.Any(window => window is Dialog_MessageBox or Dialog_NodeTree))
return;

Find.WindowStack.Add(this);
Expand All @@ -200,6 +202,13 @@ private void TickPostMapEnterSaveDelayAndMaybeSave()
if (hideWindowDuringMapGen || bootstrapSaveQueued || saveReady || isUploadingSave)
return;

if (postMapEnterWindowDelayRemaining > 0f || postMapEnterSaveDelayRemaining > 0f || awaitingControllablePawns)
{
postMapEnterWindowDelayRemaining -= Time.deltaTime;
if (postMapEnterWindowDelayRemaining <= 0f)
TryShowBootstrapWindow();
}
Comment on lines +205 to +210

if (postMapEnterSaveDelayRemaining <= 0f && !awaitingControllablePawns)
return;

Expand Down
1 change: 1 addition & 0 deletions Source/Client/Windows/BootstrapConfiguratorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ internal void ResetTransientUiState(bool resetServerDrivenState = false)
isUploadingSave = false;
saveUploadAutoStarted = false;
postMapEnterSaveDelayRemaining = 0f;
postMapEnterWindowDelayRemaining = 0f;

if (resetServerDrivenState)
{
Expand Down
Loading