Machine softlock (#630)

## Bug fixes
- Fix softlock affecting The Machine due to a secret hidden slide reel
that destroyed everything (thanks Damian)
This commit is contained in:
Nick 2023-07-07 00:13:16 -04:00 committed by GitHub
commit 5503d2aad0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View File

@ -102,7 +102,6 @@ namespace NewHorizons.Builder.Props
StreamingHandler.SetUpStreaming(prop, detail.keepLoaded ? null : sector);
// Could check this in the for loop but I'm not sure what order we need to know about this in
var isTorch = prop.GetComponent<VisionTorchItem>() != null;
isItem = false;
foreach (var component in prop.GetComponentsInChildren<Component>(true))
@ -120,7 +119,7 @@ namespace NewHorizons.Builder.Props
{
if (FixUnsectoredComponent(component)) continue;
}
else FixSectoredComponent(component, sector, isTorch, detail.keepLoaded);
else FixSectoredComponent(component, sector, detail.keepLoaded);
FixComponent(component, go, detail.ignoreSun);
}
@ -219,7 +218,7 @@ namespace NewHorizons.Builder.Props
/// <summary>
/// Fix components that have sectors. Has a specific fix if there is a VisionTorchItem on the object.
/// </summary>
private static void FixSectoredComponent(Component component, Sector sector, bool isTorch, bool keepLoaded)
private static void FixSectoredComponent(Component component, Sector sector, bool keepLoaded)
{
// keepLoaded should remove existing groups
// renderers/colliders get enabled later so we dont have to do that here
@ -265,10 +264,10 @@ namespace NewHorizons.Builder.Props
socket._sector = sector;
}
// Fix slide reel - Softlocks if this object is a vision torch
else if(!isTorch && component is SlideCollectionContainer container)
// TODO: Fix low res reels (probably in VanillaFix since its a vanilla bug)
else if(component is SlideReelItem)
{
sector.OnOccupantEnterSector.AddListener(_ => container.LoadStreamingTextures());
}
else if(component is NomaiRemoteCameraPlatform remoteCameraPlatform)

View File

@ -811,6 +811,12 @@ namespace NewHorizons
return;
}
if (LoadManager.GetCurrentScene() == OWScene.SolarSystem || LoadManager.GetCurrentScene() == OWScene.EyeOfTheUniverse)
{
// Slide reel unloading is tied to being removed from the sector, so we do that here to prevent a softlock
Locator.GetPlayerSectorDetector().RemoveFromAllSectors();
}
if (IsChangingStarSystem) return;
IsWarpingFromShip = warp;

View File

@ -15,8 +15,8 @@
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OWML" Version="2.9.0" />
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.456" />
<PackageReference Include="OWML" Version="2.9.3" />
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
</ItemGroup>
<ItemGroup>