mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
added exit pairing for dimensions
This commit is contained in:
parent
5625fd394e
commit
ce9522e90a
@ -47,6 +47,9 @@ namespace NewHorizons.Builder.Body
|
|||||||
intr.name = "Interactibles";
|
intr.name = "Interactibles";
|
||||||
GameObject.Destroy(intr);
|
GameObject.Destroy(intr);
|
||||||
|
|
||||||
|
exitWarps.GetComponent<OuterFogWarpVolume>()._senderWarps.Clear();
|
||||||
|
exitWarps.GetComponent<OuterFogWarpVolume>()._linkedInnerWarpVolume = null;
|
||||||
|
|
||||||
// TODO MAYBE: set "exitWarps/ExitPoint", "exitWarp/ExitPoint (1)", ... "exitWarp/ExitPoint (5)"
|
// TODO MAYBE: set "exitWarps/ExitPoint", "exitWarp/ExitPoint (1)", ... "exitWarp/ExitPoint (5)"
|
||||||
|
|
||||||
return dimension;
|
return dimension;
|
||||||
|
|||||||
@ -16,18 +16,29 @@ namespace NewHorizons.Builder.Props
|
|||||||
// unpairedNodes[name of dimension that doesn't exist yet] => List{warp controller for node that links to that dimension, ...}
|
// unpairedNodes[name of dimension that doesn't exist yet] => List{warp controller for node that links to that dimension, ...}
|
||||||
private static Dictionary<string, List<InnerFogWarpVolume>> unpairedNodes = new();
|
private static Dictionary<string, List<InnerFogWarpVolume>> unpairedNodes = new();
|
||||||
|
|
||||||
public static void PairUnpairedNodesForDimension(string dimensionName, AstroObject dimensionAO = null)
|
public static Dictionary<string, InnerFogWarpVolume> namedNodes = new();
|
||||||
{
|
|
||||||
if (!unpairedNodes.ContainsKey(dimensionName)) return;
|
|
||||||
|
|
||||||
foreach (var warpVolume in unpairedNodes[dimensionName])
|
public static void FinishPairingNodesForDimension(string dimensionName, AstroObject dimensionAO = null, BrambleDimensionInfo dimensionInfo = null)
|
||||||
{
|
{
|
||||||
Pair(warpVolume, dimensionName, dimensionAO);
|
// pair node->dimension (entrances)
|
||||||
|
if (unpairedNodes.ContainsKey(dimensionName))
|
||||||
|
{
|
||||||
|
foreach (var nodeWarpController in unpairedNodes[dimensionName])
|
||||||
|
{
|
||||||
|
Pair(nodeWarpController, dimensionName, dimensionAO);
|
||||||
}
|
}
|
||||||
|
|
||||||
unpairedNodes.Remove(dimensionName);
|
unpairedNodes.Remove(dimensionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pair dimension->node (exit)
|
||||||
|
if (dimensionInfo != null && dimensionAO != null && namedNodes.ContainsKey(dimensionInfo.linksTo))
|
||||||
|
{
|
||||||
|
var dimensionWarpController = dimensionAO.GetComponentInChildren<OuterFogWarpVolume>();
|
||||||
|
dimensionWarpController._linkedInnerWarpVolume = namedNodes[dimensionInfo.linksTo];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void RecordUnpairedNode(InnerFogWarpVolume warpVolume, string linksTo)
|
private static void RecordUnpairedNode(InnerFogWarpVolume warpVolume, string linksTo)
|
||||||
{
|
{
|
||||||
if (!unpairedNodes.ContainsKey(linksTo)) unpairedNodes[linksTo] = new();
|
if (!unpairedNodes.ContainsKey(linksTo)) unpairedNodes[linksTo] = new();
|
||||||
@ -56,6 +67,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
if (destination == null) return false;
|
if (destination == null) return false;
|
||||||
|
|
||||||
nodeWarp._linkedOuterWarpVolume = destination;
|
nodeWarp._linkedOuterWarpVolume = destination;
|
||||||
|
destination._senderWarps.Add(nodeWarp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
NewHorizons/External/Modules/BrambleModule.cs
vendored
12
NewHorizons/External/Modules/BrambleModule.cs
vendored
@ -35,6 +35,11 @@ namespace NewHorizons.External.Modules
|
|||||||
/// The color of the fog inside this dimension. Leave blank for the default yellowish color
|
/// The color of the fog inside this dimension. Leave blank for the default yellowish color
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MColor fogTint;
|
public MColor fogTint;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the *node* that the player is taken to when exiting this dimension.
|
||||||
|
/// </summary>
|
||||||
|
public string linksTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -61,10 +66,15 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string linksTo;
|
public string linksTo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of this node. Only required if this node should serve as an exit.
|
||||||
|
/// </summary>
|
||||||
|
public string name;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set this to true to make this node a seed instead of a node the player can enter
|
/// Set this to true to make this node a seed instead of a node the player can enter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool seed;
|
public bool isSeed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The color of the fog inside the node. Leave blank for the default yellowish color
|
/// The color of the fog inside the node. Leave blank for the default yellowish color
|
||||||
|
|||||||
@ -435,7 +435,7 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
if (body.Config.Bramble.dimension != null)
|
if (body.Config.Bramble.dimension != null)
|
||||||
{
|
{
|
||||||
BrambleNodeBuilder.PairUnpairedNodesForDimension(body.Config.name, body.Object.GetComponent<AstroObject>());
|
BrambleNodeBuilder.FinishPairingNodesForDimension(body.Config.name, body.Object.GetComponent<AstroObject>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user