Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submerge dark matter #504

Merged
merged 7 commits into from
Jan 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion NewHorizons/Builder/Body/WaterBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal static void InitPrefabs()
if (_oceanAmbientLight == null) _oceanAmbientLight = SearchUtilities.Find("Ocean_GD").GetComponent<OceanLODController>()._ambientLight.gameObject.InstantiateInactive().Rename("OceanAmbientLight").DontDestroyOnLoad();
}

public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, WaterModule module)
public static RadialFluidVolume Make(GameObject planetGO, Sector sector, OWRigidbody rb, WaterModule module)
{
InitPrefabs();

Expand Down Expand Up @@ -148,6 +148,8 @@ public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, Wate

waterGO.transform.position = planetGO.transform.position;
waterGO.SetActive(true);

return fluidVolume;
}
}
}
6 changes: 6 additions & 0 deletions NewHorizons/Builder/Props/DetailBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ private static void FixComponent(Component component, GameObject planetGO)
if (probeVisuals != null) probeVisuals.gameObject.SetActive(true);
}

if (component is DarkMatterSubmergeController submergeController)
{
var water = planetGO.GetComponentsInChildren<RadialFluidVolume>().FirstOrDefault(x => x._fluidType == FluidVolume.Type.WATER);
submergeController._fluidDetector?.SetDetectableFluid(water);
}

// Fix anglerfish speed on orbiting planets
if (component is AnglerfishController angler)
{
Expand Down
18 changes: 18 additions & 0 deletions NewHorizons/Builder/Volumes/HazardVolumeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ public static HazardVolume Make(GameObject planetGO, Sector sector, OWRigidbody
var visorFrostEffectVolume = go.AddComponent<VisorFrostEffectVolume>();
visorFrostEffectVolume._frostRate = 0.5f;
visorFrostEffectVolume._maxFrost = 0.91f;

var water = planetGO.GetComponentsInChildren<RadialFluidVolume>().FirstOrDefault(x => x._fluidType == FluidVolume.Type.WATER);
if (water != null)
{
var submerge = go.AddComponent<DarkMatterSubmergeController>();
submerge._activeWhenSubmerged = false;
submerge._effectVolumes = new EffectVolume[] { hazardVolume, visorFrostEffectVolume };
// THERE ARE NO RENDERERS??? RUH ROH!!!

var detectorGO = new GameObject("ConstantFluidDetector");
detectorGO.transform.parent = go.transform;
detectorGO.transform.localPosition = Vector3.zero;
detectorGO.layer = LayerMask.NameToLayer("BasicDetector");
var detector = detectorGO.AddComponent<ConstantFluidDetector>();
detector.SetDetectableFluid(water);

submerge._fluidDetector = detector;
}
}
else if (info.type == VolumesModule.HazardVolumeInfo.HazardType.ELECTRICITY)
{
Expand Down