mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Better fixers (#537)
make the InteractVolume fix and etc use a component instead of FireOnNextUpdate so it works with scatter and VR
This commit is contained in:
commit
80e5f0c15e
@ -253,39 +253,41 @@ namespace NewHorizons.Builder.Props
|
||||
/// <param name="isTorch"></param>
|
||||
private static void FixSectoredComponent(Component component, Sector sector, bool isTorch = false)
|
||||
{
|
||||
if (component is Sector s)
|
||||
{
|
||||
s.SetParentSector(sector);
|
||||
}
|
||||
|
||||
if (component is SectorCullGroup sectorCullGroup)
|
||||
{
|
||||
sectorCullGroup._controllingProxy = null;
|
||||
}
|
||||
|
||||
// fix Sector stuff, eg SectorCullGroup (without this, props that have a SectorCullGroup component will become invisible inappropriately)
|
||||
if (component is ISectorGroup sectorGroup)
|
||||
{
|
||||
sectorGroup.SetSector(sector);
|
||||
}
|
||||
|
||||
if (component is SectoredMonoBehaviour behaviour)
|
||||
// Not doing else if here because idk if any of the classes below implement ISectorGroup
|
||||
|
||||
if (component is Sector s)
|
||||
{
|
||||
s.SetParentSector(sector);
|
||||
}
|
||||
|
||||
else if (component is SectorCullGroup sectorCullGroup)
|
||||
{
|
||||
sectorCullGroup._controllingProxy = null;
|
||||
}
|
||||
|
||||
else if(component is SectoredMonoBehaviour behaviour)
|
||||
{
|
||||
behaviour.SetSector(sector);
|
||||
}
|
||||
|
||||
if (component is OWItemSocket socket)
|
||||
else if(component is OWItemSocket socket)
|
||||
{
|
||||
socket._sector = sector;
|
||||
}
|
||||
|
||||
// Fix slide reel - Softlocks if this object is a vision torch
|
||||
if (!isTorch && component is SlideCollectionContainer container)
|
||||
else if(!isTorch && component is SlideCollectionContainer container)
|
||||
{
|
||||
sector.OnOccupantEnterSector.AddListener(_ => container.LoadStreamingTextures());
|
||||
}
|
||||
|
||||
if (component is NomaiRemoteCameraPlatform remoteCameraPlatform)
|
||||
else if(component is NomaiRemoteCameraPlatform remoteCameraPlatform)
|
||||
{
|
||||
remoteCameraPlatform._visualSector = sector;
|
||||
}
|
||||
@ -314,22 +316,19 @@ namespace NewHorizons.Builder.Props
|
||||
Component.DestroyImmediate(component);
|
||||
return;
|
||||
}
|
||||
|
||||
if (component is DarkMatterVolume)
|
||||
else if (component is DarkMatterVolume)
|
||||
{
|
||||
var probeVisuals = component.gameObject.transform.Find("ProbeVisuals");
|
||||
if (probeVisuals != null) probeVisuals.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (component is DarkMatterSubmergeController submergeController)
|
||||
else if (component is DarkMatterSubmergeController submergeController)
|
||||
{
|
||||
var water = planetGO.GetComponentsInChildren<RadialFluidVolume>().FirstOrDefault(x => x._fluidType == FluidVolume.Type.WATER);
|
||||
if (submergeController._fluidDetector)
|
||||
submergeController._fluidDetector._onlyDetectableFluid = water;
|
||||
}
|
||||
|
||||
// Fix anglerfish speed on orbiting planets
|
||||
if (component is AnglerfishController angler)
|
||||
else if (component is AnglerfishController angler)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -342,50 +341,48 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
|
||||
// fix campfires
|
||||
if (component is InteractVolume interactVolume)
|
||||
else if (component is InteractVolume)
|
||||
{
|
||||
Delay.FireOnNextUpdate(() => interactVolume._playerCam = Locator.GetPlayerCamera());
|
||||
component.gameObject.AddComponent<InteractVolumeFixer>();
|
||||
}
|
||||
if (component is PlayerAttachPoint playerAttachPoint)
|
||||
else if (component is PlayerAttachPoint)
|
||||
{
|
||||
var playerBody = GameObject.Find("Player_Body");
|
||||
playerAttachPoint._playerController = playerBody.GetComponent<PlayerCharacterController>();
|
||||
playerAttachPoint._playerOWRigidbody = playerBody.GetComponent<OWRigidbody>();
|
||||
playerAttachPoint._playerTransform = playerBody.transform;
|
||||
Delay.FireOnNextUpdate(() => playerAttachPoint._fpsCamController = Locator.GetPlayerCameraController());
|
||||
component.gameObject.AddComponent<PlayerAttachPointFixer>();
|
||||
}
|
||||
|
||||
if (component is NomaiInterfaceOrb orb)
|
||||
else if (component is NomaiInterfaceOrb orb)
|
||||
{
|
||||
orb._parentAstroObject = planetGO.GetComponent<AstroObject>();
|
||||
orb._parentBody = planetGO.GetComponent<OWRigidbody>();
|
||||
}
|
||||
|
||||
if (component is VisionTorchItem torchItem)
|
||||
else if (component is VisionTorchItem torchItem)
|
||||
{
|
||||
torchItem.enabled = true;
|
||||
torchItem.mindProjectorTrigger.enabled = true;
|
||||
Delay.FireOnNextUpdate(() => torchItem.mindSlideProjector._mindProjectorImageEffect = Locator.GetPlayerCamera().GetComponent<MindProjectorImageEffect>());
|
||||
torchItem.gameObject.AddComponent<VisionTorchItemFixer>();
|
||||
}
|
||||
|
||||
if (component is Animator animator) animator.enabled = true;
|
||||
if (component is Collider collider) collider.enabled = true;
|
||||
else if (component is Animator animator) animator.enabled = true;
|
||||
else if(component is Collider collider) collider.enabled = true;
|
||||
// Bug 533 - Don't show the electricity effect renderers
|
||||
if (component is Renderer renderer && component.gameObject.GetComponent<ElectricityEffect>() == null) renderer.enabled = true;
|
||||
if (component is Shape shape) shape.enabled = true;
|
||||
else if (component is Renderer renderer && component.gameObject.GetComponent<ElectricityEffect>() == null) renderer.enabled = true;
|
||||
else if(component is Shape shape) shape.enabled = true;
|
||||
|
||||
// fixes sector cull group deactivating renderers on map view enter and fast foward
|
||||
// TODO: does this actually work? what? how?
|
||||
if (component is SectorCullGroup sectorCullGroup)
|
||||
else if(component is SectorCullGroup sectorCullGroup)
|
||||
{
|
||||
sectorCullGroup._inMapView = false;
|
||||
sectorCullGroup._isFastForwarding = false;
|
||||
sectorCullGroup.SetVisible(sectorCullGroup.ShouldBeVisible(), true, false);
|
||||
}
|
||||
|
||||
|
||||
// If it's not a moving anglerfish make sure the anim controller is regular
|
||||
if (component is AnglerfishAnimController && component.GetComponentInParent<AnglerfishController>() == null)
|
||||
else if(component is AnglerfishAnimController && component.GetComponentInParent<AnglerfishController>() == null)
|
||||
{
|
||||
component.gameObject.AddComponent<AnglerAnimFixer>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -416,5 +413,53 @@ namespace NewHorizons.Builder.Props
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Has to happen after 1 frame to work with VR
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(InteractVolume))]
|
||||
private class InteractVolumeFixer : MonoBehaviour
|
||||
{
|
||||
public void Start()
|
||||
{
|
||||
var interactVolume = GetComponent<InteractVolume>();
|
||||
interactVolume._playerCam = Locator.GetPlayerCamera();
|
||||
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Has to happen after 1 frame to work with VR
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(PlayerAttachPoint))]
|
||||
private class PlayerAttachPointFixer : MonoBehaviour
|
||||
{
|
||||
public void Start()
|
||||
{
|
||||
var playerAttachPoint = GetComponent<PlayerAttachPoint>();
|
||||
playerAttachPoint._playerController = Locator.GetPlayerController();
|
||||
playerAttachPoint._playerOWRigidbody = Locator.GetPlayerBody();
|
||||
playerAttachPoint._playerTransform = Locator.GetPlayerTransform();
|
||||
playerAttachPoint._fpsCamController = Locator.GetPlayerCameraController();
|
||||
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Has to happen after 1 frame to work with VR
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(VisionTorchItem))]
|
||||
private class VisionTorchItemFixer : MonoBehaviour
|
||||
{
|
||||
public void Start()
|
||||
{
|
||||
var torchItem = GetComponent<VisionTorchItem>();
|
||||
torchItem.mindSlideProjector._mindProjectorImageEffect = Locator.GetPlayerCamera().GetComponent<MindProjectorImageEffect>();
|
||||
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user