tidy a lil

This commit is contained in:
JohnCorby 2022-07-15 14:53:51 -07:00
parent 83d1be4852
commit c73a393f97
2 changed files with 6 additions and 7 deletions

View File

@ -249,7 +249,7 @@ namespace NewHorizons.Builder.Body
var newEntrances = new List<SphericalFogWarpExit>(); var newEntrances = new List<SphericalFogWarpExit>();
foreach (var index in config.allowedEntrances) foreach (var index in config.allowedEntrances)
{ {
if(index < 0 || 5 < index) continue; if(index is < 0 or > 5) continue;
newEntrances.Add(entrances[index]); newEntrances.Add(entrances[index]);
} }
outerFogWarpVolume._exits = newEntrances.ToArray(); outerFogWarpVolume._exits = newEntrances.ToArray();

View File

@ -215,14 +215,14 @@ namespace NewHorizons.Builder.Props
sector.RegisterFogLight(fogLight); sector.RegisterFogLight(fogLight);
// If the config says only certain entrances are allowed, enforce that // If the config says only certain exits are allowed, enforce that
if (config.possibleExits != null) if (config.possibleExits != null)
{ {
var exits = innerFogWarpVolume._exits; var exits = innerFogWarpVolume._exits;
var newExits = new List<SphericalFogWarpExit>(); var newExits = new List<SphericalFogWarpExit>();
foreach (var index in config.possibleExits) foreach (var index in config.possibleExits)
{ {
if(index < 0 || 5 < index) continue; if(index is < 0 or > 5) continue;
newExits.Add(exits[index]); newExits.Add(exits[index]);
} }
innerFogWarpVolume._exits = newExits.ToArray(); innerFogWarpVolume._exits = newExits.ToArray();
@ -233,8 +233,7 @@ namespace NewHorizons.Builder.Props
// (this isn't jank I swear, this is how it's supposed to work) // (this isn't jank I swear, this is how it's supposed to work)
var sectorHasFogEffectRuleset = sector var sectorHasFogEffectRuleset = sector
.GetComponents<EffectRuleset>() .GetComponents<EffectRuleset>()
.Where(effectRuleset => effectRuleset._type == EffectRuleset.BubbleType.FogWarp) .Any(effectRuleset => effectRuleset._type == EffectRuleset.BubbleType.FogWarp);
.Count() > 0;
if (!sectorHasFogEffectRuleset) if (!sectorHasFogEffectRuleset)
{ {
var fogEffectRuleset = sector.gameObject.AddComponent<EffectRuleset>(); var fogEffectRuleset = sector.gameObject.AddComponent<EffectRuleset>();
@ -257,7 +256,7 @@ namespace NewHorizons.Builder.Props
// Seed fog works differently, so it doesn't need to be fixed (it's also located on a different child path, so the below FindChild calls wouldn't work) // Seed fog works differently, so it doesn't need to be fixed (it's also located on a different child path, so the below FindChild calls wouldn't work)
if (!config.isSeed) if (!config.isSeed)
{ {
var fog = brambleNode.FindChild("Effects").FindChild("InnerWarpFogSphere"); var fog = brambleNode.FindChild("Effects/InnerWarpFogSphere");
var fogMaterial = fog.GetComponent<MeshRenderer>().sharedMaterial; var fogMaterial = fog.GetComponent<MeshRenderer>().sharedMaterial;
fog.transform.localScale /= config.scale; fog.transform.localScale /= config.scale;
fogMaterial.SetFloat("_Radius", fogMaterial.GetFloat("_Radius") * config.scale); fogMaterial.SetFloat("_Radius", fogMaterial.GetFloat("_Radius") * config.scale);
@ -313,7 +312,7 @@ namespace NewHorizons.Builder.Props
fogRenderer._fogColor = fogTint.Value; fogRenderer._fogColor = fogTint.Value;
var fogBackdrop = brambleNode.FindChild("Terrain_DB_BrambleSphere_Inner_v2")?.FindChild("fogbackdrop_v2"); var fogBackdrop = brambleNode.FindChild("Terrain_DB_BrambleSphere_Inner_v2/fogbackdrop_v2");
if (fogBackdrop != null) fogBackdrop.GetComponent<MeshRenderer>().sharedMaterial.color = (Color)fogTint; if (fogBackdrop != null) fogBackdrop.GetComponent<MeshRenderer>().sharedMaterial.color = (Color)fogTint;
} }