mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
finished signal propogation and fixed bug where nodes wouldn't pair in some cases
This commit is contained in:
parent
e573f691ef
commit
2e6e9d729f
@ -35,10 +35,13 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
public static void FinishPairingNodesForDimension(string dimensionName, AstroObject dimensionAO = null)
|
public static void FinishPairingNodesForDimension(string dimensionName, AstroObject dimensionAO = null)
|
||||||
{
|
{
|
||||||
|
Logger.Log("finishing paring nodes for dimension " + dimensionName);
|
||||||
if (!unpairedNodes.ContainsKey(dimensionName)) return;
|
if (!unpairedNodes.ContainsKey(dimensionName)) return;
|
||||||
|
|
||||||
|
Logger.Log("continuing to paring nodes for dimension " + dimensionName);
|
||||||
foreach (var nodeWarpController in unpairedNodes[dimensionName])
|
foreach (var nodeWarpController in unpairedNodes[dimensionName])
|
||||||
{
|
{
|
||||||
|
Logger.Log(". paring node for dimension" + dimensionName);
|
||||||
PairEntrance(nodeWarpController, dimensionName, dimensionAO);
|
PairEntrance(nodeWarpController, dimensionName, dimensionAO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +52,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
if (!unpairedNodes.ContainsKey(linksTo)) unpairedNodes[linksTo] = new();
|
if (!unpairedNodes.ContainsKey(linksTo)) unpairedNodes[linksTo] = new();
|
||||||
|
|
||||||
|
Logger.Log("recording entrance for " + linksTo);
|
||||||
unpairedNodes[linksTo].Add(warpVolume);
|
unpairedNodes[linksTo].Add(warpVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +75,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
// 1) Run Floyd-Warshall on the dimensions (where each dimension is a vertex and each node is an edge)
|
// 1) Run Floyd-Warshall on the dimensions (where each dimension is a vertex and each node is an edge)
|
||||||
// 2) For each dimension A, if it's possible to reach dimension B, add dimension B's signals to the list propogatedSignals[A]
|
// 2) For each dimension A, if it's possible to reach dimension B, add dimension B's signals to the list propogatedSignals[A]
|
||||||
|
|
||||||
var allDimensions = new List<PlanetConfig>(); // TODO: grab this list from Main or something, idk
|
var allDimensions = PlanetCreationHandler.allBodies.Where(body => body?.Config?.Bramble?.dimension != null).Select(body => body.Config).ToList();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Floyd Warshall
|
// Floyd Warshall
|
||||||
@ -132,6 +136,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
private static bool PairEntrance(InnerFogWarpVolume nodeWarp, string destinationName, AstroObject dimensionAO = null)
|
private static bool PairEntrance(InnerFogWarpVolume nodeWarp, string destinationName, AstroObject dimensionAO = null)
|
||||||
{
|
{
|
||||||
|
Logger.Log("Attempting to pair entrance to " + destinationName);
|
||||||
var destinationAO = dimensionAO ?? AstroObjectLocator.GetAstroObject(destinationName); // find child "Sector/OuterWarp"
|
var destinationAO = dimensionAO ?? AstroObjectLocator.GetAstroObject(destinationName); // find child "Sector/OuterWarp"
|
||||||
if (destinationAO == null) return false;
|
if (destinationAO == null) return false;
|
||||||
|
|
||||||
@ -139,6 +144,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
var destination = GetOuterFogWarpVolumeFromAstroObject(destinationAO.gameObject);
|
var destination = GetOuterFogWarpVolumeFromAstroObject(destinationAO.gameObject);
|
||||||
if (destination == null) return false;
|
if (destination == null) return false;
|
||||||
|
|
||||||
|
Logger.Log("Pairing entrance to " + destinationName);
|
||||||
nodeWarp._linkedOuterWarpVolume = destination;
|
nodeWarp._linkedOuterWarpVolume = destination;
|
||||||
destination.RegisterSenderWarp(nodeWarp);
|
destination.RegisterSenderWarp(nodeWarp);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -25,6 +25,8 @@ namespace NewHorizons.Handlers
|
|||||||
private static Dictionary<NHAstroObject, NewHorizonsBody> _dict;
|
private static Dictionary<NHAstroObject, NewHorizonsBody> _dict;
|
||||||
private static Dictionary<AstroObject, NewHorizonsBody> _dimensions;
|
private static Dictionary<AstroObject, NewHorizonsBody> _dimensions;
|
||||||
|
|
||||||
|
public static List<NewHorizonsBody> allBodies;
|
||||||
|
|
||||||
public static NewHorizonsBody GetNewHorizonsBody(AstroObject ao)
|
public static NewHorizonsBody GetNewHorizonsBody(AstroObject ao)
|
||||||
{
|
{
|
||||||
if (ao is NHAstroObject nhAO)
|
if (ao is NHAstroObject nhAO)
|
||||||
@ -44,6 +46,7 @@ namespace NewHorizons.Handlers
|
|||||||
ExistingAOConfigs = new Dictionary<AstroObject, NewHorizonsBody>();
|
ExistingAOConfigs = new Dictionary<AstroObject, NewHorizonsBody>();
|
||||||
_dict = new Dictionary<NHAstroObject, NewHorizonsBody>();
|
_dict = new Dictionary<NHAstroObject, NewHorizonsBody>();
|
||||||
_dimensions = new Dictionary<AstroObject, NewHorizonsBody>();
|
_dimensions = new Dictionary<AstroObject, NewHorizonsBody>();
|
||||||
|
allBodies = bodies;
|
||||||
|
|
||||||
// Set up stars
|
// Set up stars
|
||||||
// Need to manage this when there are multiple stars
|
// Need to manage this when there are multiple stars
|
||||||
@ -461,13 +464,16 @@ namespace NewHorizons.Handlers
|
|||||||
StarLightController.AddStar(StarBuilder.Make(go, sector, body.Config.Star, body.Mod));
|
StarLightController.AddStar(StarBuilder.Make(go, sector, body.Config.Star, body.Mod));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Config?.Bramble?.nodes != null)
|
if (body.Config?.Bramble != null)
|
||||||
{
|
{
|
||||||
BrambleNodeBuilder.Make(go, sector, body.Config.Bramble.nodes, body.Mod);
|
if (body.Config.Bramble.nodes != null)
|
||||||
|
{
|
||||||
|
BrambleNodeBuilder.Make(go, sector, body.Config.Bramble.nodes, body.Mod);
|
||||||
|
}
|
||||||
|
|
||||||
if (body.Config.Bramble.dimension != null)
|
if (body.Config.Bramble.dimension != null)
|
||||||
{
|
{
|
||||||
BrambleNodeBuilder.FinishPairingNodesForDimension(body.Config.name, body.Object.GetComponent<AstroObject>());
|
BrambleNodeBuilder.FinishPairingNodesForDimension(body.Config.name, go.GetComponent<AstroObject>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user