Fix bramble exits

This commit is contained in:
TerrificTrifid 2022-08-10 17:26:00 -05:00
parent a177bbffca
commit c919b17c47
2 changed files with 34 additions and 27 deletions

View File

@ -139,19 +139,6 @@ namespace NewHorizons.Builder.Body
PairExit(config.linksTo, outerFogWarpVolume); 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 is < 0 or > 5) continue;
newEntrances.Add(entrances[index]);
}
outerFogWarpVolume._exits = newEntrances.ToArray();
}
// Set the scale // Set the scale
var scale = config.radius / BASE_DIMENSION_RADIUS; var scale = config.radius / BASE_DIMENSION_RADIUS;
geometry.transform.localScale = Vector3.one * scale; geometry.transform.localScale = Vector3.one * scale;
@ -199,6 +186,22 @@ namespace NewHorizons.Builder.Body
exitWarps.SetActive(true); exitWarps.SetActive(true);
repelVolume.SetActive(true); repelVolume.SetActive(true);
// If the config says only certain entrances are allowed, enforce that
if (config.allowedEntrances != null)
{
Delay.FireOnNextUpdate(() =>
{
var entrances = outerFogWarpVolume._exits;
var newEntrances = new List<SphericalFogWarpExit>();
foreach (var index in config.allowedEntrances)
{
if (index is < 0 or > 5) continue;
newEntrances.Add(entrances[index]);
}
outerFogWarpVolume._exits = newEntrances.ToArray();
});
}
return go; return go;
} }

View File

@ -194,19 +194,6 @@ namespace NewHorizons.Builder.Props
fogLight._linkedFogLights = new List<FogLight>(); fogLight._linkedFogLights = new List<FogLight>();
fogLight._linkedLightData = new List<FogLight.LightData>(); fogLight._linkedLightData = new List<FogLight.LightData>();
// If the config says only certain exits 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 is < 0 or > 5) continue;
newExits.Add(exits[index]);
}
innerFogWarpVolume._exits = newExits.ToArray();
}
// Set up screen fog effect // Set up screen fog effect
var fogEffectRuleset = sector.gameObject.GetAddComponent<EffectRuleset>(); var fogEffectRuleset = sector.gameObject.GetAddComponent<EffectRuleset>();
fogEffectRuleset._attachedBody = sector.GetAttachedOWRigidbody(); fogEffectRuleset._attachedBody = sector.GetAttachedOWRigidbody();
@ -338,8 +325,25 @@ namespace NewHorizons.Builder.Props
} }
} }
// Done!
brambleNode.SetActive(true); brambleNode.SetActive(true);
// If the config says only certain exits are allowed, enforce that
if (config.possibleExits != null)
{
Delay.FireOnNextUpdate(() =>
{
var exits = innerFogWarpVolume._exits;
var newExits = new List<SphericalFogWarpExit>();
foreach (var index in config.possibleExits)
{
if (index is < 0 or > 5) continue;
newExits.Add(exits[index]);
}
innerFogWarpVolume._exits = newExits.ToArray();
});
}
// Done!
return brambleNode; return brambleNode;
static Color CalculateLightShaftTint(float H, float S, float V) static Color CalculateLightShaftTint(float H, float S, float V)