Geyser tint and force

This commit is contained in:
TerrificTrifid 2022-07-31 22:31:55 -05:00
parent 5fd2bbacab
commit f5efd7b9ce
2 changed files with 34 additions and 5 deletions

View File

@ -24,9 +24,21 @@ namespace NewHorizons.Builder.Props
var up = planetGO.transform.TransformPoint(pos) - planetGO.transform.position;
geyserGO.transform.rotation = Quaternion.FromToRotation(geyserGO.transform.up, up) * geyserGO.transform.rotation;
if (info.disableBubbles) geyserGO.FindChild("GeyserParticles/GeyserBubbles").SetActive(false);
if (info.disableShaft) geyserGO.FindChild("GeyserParticles/GeyserShaft").SetActive(false);
if (info.disableSpout) geyserGO.FindChild("GeyserParticles/GeyserSpout").SetActive(false);
var bubbles = geyserGO.FindChild("GeyserParticles/GeyserBubbles");
var shaft = geyserGO.FindChild("GeyserParticles/GeyserShaft");
var spout = geyserGO.FindChild("GeyserParticles/GeyserSpout");
if (info.tint != null)
{
var tint = info.tint.ToColor();
bubbles.GetComponent<ParticleSystemRenderer>().material.color = new Color(tint.r, tint.g, tint.b, Mathf.LerpUnclamped(0.5f, 1f, tint.a)); //bubbles disappear at 0.5 alpha
shaft.GetComponent<ParticleSystemRenderer>().material.color = tint;
spout.GetComponent<ParticleSystemRenderer>().material.color = tint;
}
if (info.disableBubbles) bubbles.SetActive(false);
if (info.disableShaft) shaft.SetActive(false);
if (info.disableSpout) spout.SetActive(false);
geyserGO.SetActive(true);
@ -35,8 +47,15 @@ namespace NewHorizons.Builder.Props
// Do this after awake
Delay.FireOnNextUpdate(() => geyserFluidVolume._maxHeight = 1);
geyserFluidVolume.enabled = true; // why do we enable this? idk
geyserFluidVolume.GetComponent<CapsuleShape>().enabled = true; // i think this is already enabled but wtv
if (info.force == 0f) geyserFluidVolume.enabled = false;
else
{
geyserFluidVolume.enabled = true; // why do we enable this? idk
geyserFluidVolume.GetComponent<CapsuleShape>().enabled = true; // i think this is already enabled but wtv
geyserFluidVolume._attractionalFlowSpeed *= info.force / 55f;
geyserFluidVolume._directionalFlowSpeed = info.force;
}
}
}
}

View File

@ -224,6 +224,16 @@ namespace NewHorizons.External.Modules
/// </summary>
[DefaultValue(-97.5f)] public float offset = -97.5f;
/// <summary>
/// Force of the geyser on objects
/// </summary>
[DefaultValue(55f)] public float force = 55f;
/// <summary>
/// Color of the geyser. Alpha sets the particle density.
/// </summary>
public MColor tint;
/// <summary>
/// Disable the individual particle systems of the geyser
/// </summary>