mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
fixed bramble signals and created a dictionary in planetcreationhandler for dimensions (non-body bodies, like bramble dimensions for example) and a lookup function for them
This commit is contained in:
parent
4b25a11fde
commit
71abd4495e
@ -1,5 +1,6 @@
|
||||
using HarmonyLib;
|
||||
using NewHorizons.Builder.Body;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -66,7 +67,7 @@ namespace NewHorizons.Builder.Props
|
||||
if (destinationAO == null) return false;
|
||||
|
||||
// add the destination dimension's signals to this node
|
||||
var dimensionNewHorizonsBody = destinationAO.GetComponent<NewHorizonsBody>();
|
||||
var dimensionNewHorizonsBody = PlanetCreationHandler.GetNewHorizonsBody(destinationAO);
|
||||
if (dimensionNewHorizonsBody != null && dimensionNewHorizonsBody.Config?.Signal?.signals != null)
|
||||
{
|
||||
var body = nodeWarp.GetComponentInParent<AstroObject>().gameObject;
|
||||
@ -76,6 +77,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
var signalGO = SignalBuilder.Make(body, sector, signalConfig, dimensionNewHorizonsBody.Mod);
|
||||
signalGO.GetComponent<AudioSignal>()._identificationDistance = 0;
|
||||
signalGO.GetComponent<AudioSignal>()._sourceRadius = 1;
|
||||
signalGO.transform.position = nodeWarp.transform.position;
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,6 +181,7 @@ namespace NewHorizons.Builder.Props
|
||||
audioSignal._onlyAudibleToScope = info.onlyAudibleToScope;
|
||||
audioSignal._identificationDistance = info.identificationRadius;
|
||||
audioSignal._canBePickedUpByScope = true;
|
||||
audioSignal._outerFogWarpVolume = planetGO.GetComponentInChildren<OuterFogWarpVolume>(); // shouldn't break non-bramble signals
|
||||
|
||||
source.clip = clip;
|
||||
source.loop = true;
|
||||
|
||||
@ -23,6 +23,19 @@ namespace NewHorizons.Handlers
|
||||
private static Dictionary<AstroObject, NewHorizonsBody> ExistingAOConfigs;
|
||||
|
||||
private static Dictionary<NHAstroObject, NewHorizonsBody> _dict;
|
||||
private static Dictionary<AstroObject, NewHorizonsBody> _dimensions;
|
||||
|
||||
public static NewHorizonsBody GetNewHorizonsBody(AstroObject ao)
|
||||
{
|
||||
if (ao is NHAstroObject nhAO)
|
||||
{
|
||||
if (_dict.ContainsKey(nhAO)) return _dict[nhAO];
|
||||
}
|
||||
|
||||
if (!_dimensions.ContainsKey(ao)) return null;
|
||||
|
||||
return _dimensions[ao];
|
||||
}
|
||||
|
||||
public static void Init(List<NewHorizonsBody> bodies)
|
||||
{
|
||||
@ -30,6 +43,7 @@ namespace NewHorizons.Handlers
|
||||
|
||||
ExistingAOConfigs = new Dictionary<AstroObject, NewHorizonsBody>();
|
||||
_dict = new Dictionary<NHAstroObject, NewHorizonsBody>();
|
||||
_dimensions = new Dictionary<AstroObject, NewHorizonsBody>();
|
||||
|
||||
// Set up stars
|
||||
// Need to manage this when there are multiple stars
|
||||
@ -223,7 +237,9 @@ namespace NewHorizons.Handlers
|
||||
if (planetObject == null) return false;
|
||||
planetObject.SetActive(true);
|
||||
var nhAO = planetObject.GetComponent<NHAstroObject>();
|
||||
var owAO = planetObject.GetComponent<AstroObject>();
|
||||
if (nhAO != null) _dict.Add(nhAO, body);
|
||||
else if (owAO != null) _dimensions.Add(owAO, body);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -290,6 +306,7 @@ namespace NewHorizons.Handlers
|
||||
var owRigidBody = go.GetComponent<OWRigidbody>();
|
||||
|
||||
go = SharedGenerateBody(body, go, sector, owRigidBody);
|
||||
body.Object = go;
|
||||
|
||||
if (ao.GetAstroObjectName() == AstroObject.Name.CustomString)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user