added option to force nodes/dimensions to only allow certan exits

This commit is contained in:
FreezeDriedMangoes 2022-07-15 09:25:41 -04:00
parent 590377cd51
commit 3988b5d103
3 changed files with 36 additions and 0 deletions

View File

@ -242,6 +242,19 @@ namespace NewHorizons.Builder.Body
PairExit(config.linksTo, outerFogWarpVolume);
// If the config says only certain entrances are allowed, enforce that
if (config.allowedEntrances != null)
{
var entrances = outerFogWarpVolume._exits;
var newEntrances = new List<SphericalFogWarpExit>();
foreach (var index in config.allowedEntrances)
{
if(index < 0 || 5 < index) continue;
newEntrances.Add(entrances[index]);
}
outerFogWarpVolume._exits = newEntrances.ToArray();
}
// Set the scale
var scale = config.radius / BASE_DIMENSION_RADIUS;
geometry.transform.localScale = Vector3.one * scale;

View File

@ -215,6 +215,19 @@ namespace NewHorizons.Builder.Props
sector.RegisterFogLight(fogLight);
// If the config says only certain entrances are allowed, enforce that
if (config.possibleExits != null)
{
var exits = innerFogWarpVolume._exits;
var newExits = new List<SphericalFogWarpExit>();
foreach (var index in config.possibleExits)
{
if(index < 0 || 5 < index) continue;
newExits.Add(exits[index]);
}
innerFogWarpVolume._exits = newExits.ToArray();
}
// set up screen fog effect
// (in the base game, any sector that contains a bramble node needs an EffectRuleset with type FogWarp)
// (this isn't jank I swear, this is how it's supposed to work)

View File

@ -41,6 +41,11 @@ namespace NewHorizons.External.Modules
/// The internal radius (in meters) of the dimension. The default is 1705.
/// </summary>
[DefaultValue(1705f)] public float radius = 1705f;
/// <summary>
/// An array of integers from 0-5. By default, all entrances are allowed. To force this dimension to warp players in from only one point (like the anglerfish nest dimension in the base game) set this value to [3], [5], or similar. Values of 0-5 only.
/// </summary>
public int[] allowedEntrances;
}
@ -86,6 +91,11 @@ namespace NewHorizons.External.Modules
/// The color of the shafts of light coming from the entrances to the node. Leave blank for the default yellowish color: (131, 124, 105, 255)
/// </summary>
public MColor lightTint;
/// <summary>
/// An array of integers from 0-5. By default, all entrances are allowed. To force this node to warp players out from only one hole set this value to [3], [5], or similar. Values of 0-5 only.
/// </summary>
public int[] possibleExits;
}
}
}