mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Put sectors on everything
This commit is contained in:
parent
420e212695
commit
18ebcb85cc
@ -1,4 +1,5 @@
|
|||||||
using OWML.Utils;
|
using NewHorizons.External;
|
||||||
|
using OWML.Utils;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
@ -6,16 +7,16 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
{
|
{
|
||||||
static class AirBuilder
|
static class AirBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject body, float airScale, bool isRaining, bool hasOxygen)
|
public static void Make(GameObject body, Sector sector, AtmosphereModule.AirInfo info)
|
||||||
{
|
{
|
||||||
GameObject airGO = new GameObject("Air");
|
GameObject airGO = new GameObject("Air");
|
||||||
airGO.SetActive(false);
|
airGO.SetActive(false);
|
||||||
airGO.layer = 17;
|
airGO.layer = 17;
|
||||||
airGO.transform.parent = body.transform;
|
airGO.transform.parent = sector?.transform ?? body.transform;
|
||||||
|
|
||||||
SphereCollider SC = airGO.AddComponent<SphereCollider>();
|
SphereCollider SC = airGO.AddComponent<SphereCollider>();
|
||||||
SC.isTrigger = true;
|
SC.isTrigger = true;
|
||||||
SC.radius = airScale;
|
SC.radius = info.Scale;
|
||||||
|
|
||||||
SimpleFluidVolume SFV = airGO.AddComponent<SimpleFluidVolume>();
|
SimpleFluidVolume SFV = airGO.AddComponent<SimpleFluidVolume>();
|
||||||
SFV._layer = 5;
|
SFV._layer = 5;
|
||||||
@ -25,12 +26,12 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
SFV._allowShipAutoroll = true;
|
SFV._allowShipAutoroll = true;
|
||||||
SFV._disableOnStart = false;
|
SFV._disableOnStart = false;
|
||||||
|
|
||||||
if(hasOxygen)
|
if(info.HasOxygen)
|
||||||
{
|
{
|
||||||
airGO.AddComponent<OxygenVolume>();
|
airGO.AddComponent<OxygenVolume>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRaining)
|
if (info.IsRaining)
|
||||||
{
|
{
|
||||||
VisorRainEffectVolume VREF = airGO.AddComponent<VisorRainEffectVolume>();
|
VisorRainEffectVolume VREF = airGO.AddComponent<VisorRainEffectVolume>();
|
||||||
VREF._rainDirection = VisorRainEffectVolume.RainDirection.Radial;
|
VREF._rainDirection = VisorRainEffectVolume.RainDirection.Radial;
|
||||||
|
|||||||
@ -6,11 +6,11 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
{
|
{
|
||||||
static class AtmosphereBuilder
|
static class AtmosphereBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject body, AtmosphereModule atmosphereModule, float surfaceSize)
|
public static void Make(GameObject body, Sector sector, AtmosphereModule atmosphereModule, float surfaceSize)
|
||||||
{
|
{
|
||||||
GameObject atmoGO = new GameObject("Atmosphere");
|
GameObject atmoGO = new GameObject("Atmosphere");
|
||||||
atmoGO.SetActive(false);
|
atmoGO.SetActive(false);
|
||||||
atmoGO.transform.parent = body.transform;
|
atmoGO.transform.parent = sector?.transform ?? body.transform;
|
||||||
|
|
||||||
if (atmosphereModule.HasAtmosphere)
|
if (atmosphereModule.HasAtmosphere)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
|
|
||||||
GameObject cloudsMainGO = new GameObject("Clouds");
|
GameObject cloudsMainGO = new GameObject("Clouds");
|
||||||
cloudsMainGO.SetActive(false);
|
cloudsMainGO.SetActive(false);
|
||||||
cloudsMainGO.transform.parent = body.transform;
|
cloudsMainGO.transform.parent = sector?.transform ?? body.transform;
|
||||||
|
|
||||||
GameObject cloudsTopGO = new GameObject("TopClouds");
|
GameObject cloudsTopGO = new GameObject("TopClouds");
|
||||||
cloudsTopGO.SetActive(false);
|
cloudsTopGO.SetActive(false);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.Utility;
|
using NewHorizons.External;
|
||||||
|
using NewHorizons.Utility;
|
||||||
using OWML.Utils;
|
using OWML.Utils;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
@ -7,11 +8,11 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
{
|
{
|
||||||
static class EffectsBuilder
|
static class EffectsBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject body, Sector sector, float surfaceSize, float atmoSize, bool hasRain, bool hasSnow)
|
public static void Make(GameObject body, Sector sector, AtmosphereModule.AirInfo info, float surfaceSize)
|
||||||
{
|
{
|
||||||
GameObject effectsGO = new GameObject("Effects");
|
GameObject effectsGO = new GameObject("Effects");
|
||||||
effectsGO.SetActive(false);
|
effectsGO.SetActive(false);
|
||||||
effectsGO.transform.parent = body.transform;
|
effectsGO.transform.parent = sector?.transform ?? body.transform;
|
||||||
effectsGO.transform.localPosition = Vector3.zero;
|
effectsGO.transform.localPosition = Vector3.zero;
|
||||||
|
|
||||||
SectorCullGroup SCG = effectsGO.AddComponent<SectorCullGroup>();
|
SectorCullGroup SCG = effectsGO.AddComponent<SectorCullGroup>();
|
||||||
@ -21,7 +22,7 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
SCG._dynamicCullingBounds = false;
|
SCG._dynamicCullingBounds = false;
|
||||||
SCG._waitForStreaming = false;
|
SCG._waitForStreaming = false;
|
||||||
|
|
||||||
if(hasRain)
|
if(info.IsRaining)
|
||||||
{
|
{
|
||||||
var rainGO = GameObject.Instantiate(SearchUtilities.CachedFind("/GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/Effects_GD_Rain"), effectsGO.transform);
|
var rainGO = GameObject.Instantiate(SearchUtilities.CachedFind("/GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/Effects_GD_Rain"), effectsGO.transform);
|
||||||
rainGO.transform.localPosition = Vector3.zero;
|
rainGO.transform.localPosition = Vector3.zero;
|
||||||
@ -31,7 +32,7 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
{
|
{
|
||||||
new Keyframe(surfaceSize - 0.5f, 0),
|
new Keyframe(surfaceSize - 0.5f, 0),
|
||||||
new Keyframe(surfaceSize, 10f),
|
new Keyframe(surfaceSize, 10f),
|
||||||
new Keyframe(atmoSize, 0f)
|
new Keyframe(info.Scale, 0f)
|
||||||
});
|
});
|
||||||
|
|
||||||
rainGO.GetComponent<PlanetaryVectionController>()._activeInSector = sector;
|
rainGO.GetComponent<PlanetaryVectionController>()._activeInSector = sector;
|
||||||
@ -39,7 +40,7 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
rainGO.SetActive(true);
|
rainGO.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasSnow)
|
if(info.IsSnowing)
|
||||||
{
|
{
|
||||||
var snowGO = new GameObject("SnowEffects");
|
var snowGO = new GameObject("SnowEffects");
|
||||||
snowGO.transform.parent = effectsGO.transform;
|
snowGO.transform.parent = effectsGO.transform;
|
||||||
@ -55,7 +56,7 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
{
|
{
|
||||||
new Keyframe(surfaceSize - 0.5f, 0),
|
new Keyframe(surfaceSize - 0.5f, 0),
|
||||||
new Keyframe(surfaceSize, 10f),
|
new Keyframe(surfaceSize, 10f),
|
||||||
new Keyframe(atmoSize, 0f)
|
new Keyframe(info.Scale, 0f)
|
||||||
});
|
});
|
||||||
|
|
||||||
snowEmitter.GetComponent<PlanetaryVectionController>()._activeInSector = sector;
|
snowEmitter.GetComponent<PlanetaryVectionController>()._activeInSector = sector;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
{
|
{
|
||||||
GameObject fogGO = new GameObject("FogSphere");
|
GameObject fogGO = new GameObject("FogSphere");
|
||||||
fogGO.SetActive(false);
|
fogGO.SetActive(false);
|
||||||
fogGO.transform.parent = body.transform;
|
fogGO.transform.parent = sector?.transform ?? body.transform;
|
||||||
fogGO.transform.localScale = Vector3.one;
|
fogGO.transform.localScale = Vector3.one;
|
||||||
|
|
||||||
// Going to copy from dark bramble
|
// Going to copy from dark bramble
|
||||||
|
|||||||
@ -7,11 +7,11 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
{
|
{
|
||||||
static class SunOverrideBuilder
|
static class SunOverrideBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject body, Sector sector, float surfaceSize, AtmosphereModule atmo)
|
public static void Make(GameObject body, Sector sector, AtmosphereModule atmo, float surfaceSize)
|
||||||
{
|
{
|
||||||
GameObject overrideGO = new GameObject("SunOverride");
|
GameObject overrideGO = new GameObject("SunOverride");
|
||||||
overrideGO.SetActive(false);
|
overrideGO.SetActive(false);
|
||||||
overrideGO.transform.parent = body.transform;
|
overrideGO.transform.parent = sector?.transform ?? body.transform;
|
||||||
|
|
||||||
GiantsDeepSunOverrideVolume GDSOV = overrideGO.AddComponent<GiantsDeepSunOverrideVolume>();
|
GiantsDeepSunOverrideVolume GDSOV = overrideGO.AddComponent<GiantsDeepSunOverrideVolume>();
|
||||||
GDSOV._sector = sector;
|
GDSOV._sector = sector;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
{
|
{
|
||||||
static class VolumesBuilder
|
static class VolumesBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject body, float innerRadius, float outerRadius, IPlanetConfig config)
|
public static void Make(GameObject body, float innerRadius, float outerRadius, bool useMiniMap)
|
||||||
{
|
{
|
||||||
GameObject volumesGO = new GameObject("Volumes");
|
GameObject volumesGO = new GameObject("Volumes");
|
||||||
volumesGO.SetActive(false);
|
volumesGO.SetActive(false);
|
||||||
@ -30,8 +30,8 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
PlanetoidRuleset PR = rulesetGO.AddComponent<PlanetoidRuleset>();
|
PlanetoidRuleset PR = rulesetGO.AddComponent<PlanetoidRuleset>();
|
||||||
PR._altitudeFloor = innerRadius;
|
PR._altitudeFloor = innerRadius;
|
||||||
PR._altitudeCeiling = outerRadius;
|
PR._altitudeCeiling = outerRadius;
|
||||||
PR._useMinimap = !config.Base.IsSatellite;
|
PR._useMinimap = useMiniMap;
|
||||||
PR._useAltimeter = !config.Base.IsSatellite;
|
PR._useAltimeter = useMiniMap;
|
||||||
|
|
||||||
EffectRuleset ER = rulesetGO.AddComponent<EffectRuleset>();
|
EffectRuleset ER = rulesetGO.AddComponent<EffectRuleset>();
|
||||||
ER._type = EffectRuleset.BubbleType.Underwater;
|
ER._type = EffectRuleset.BubbleType.Underwater;
|
||||||
|
|||||||
@ -12,9 +12,9 @@ namespace NewHorizons.Builder.Body
|
|||||||
{
|
{
|
||||||
public static class CometTailBuilder
|
public static class CometTailBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject go, IPlanetConfig config, AstroObject primary)
|
public static void Make(GameObject go, Sector sector, IPlanetConfig config, AstroObject primary)
|
||||||
{
|
{
|
||||||
var cometTail = GameObject.Instantiate(GameObject.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes"), go.transform);
|
var cometTail = GameObject.Instantiate(GameObject.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes"), sector?.transform ?? go.transform);
|
||||||
cometTail.transform.localPosition = Vector3.zero;
|
cometTail.transform.localPosition = Vector3.zero;
|
||||||
cometTail.name = "CometTail";
|
cometTail.name = "CometTail";
|
||||||
cometTail.transform.localScale = Vector3.one * config.Base.SurfaceSize / 110;
|
cometTail.transform.localScale = Vector3.one * config.Base.SurfaceSize / 110;
|
||||||
|
|||||||
@ -5,10 +5,10 @@ namespace NewHorizons.Builder.Body
|
|||||||
{
|
{
|
||||||
static class GeometryBuilder
|
static class GeometryBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject body, float groundScale)
|
public static void Make(GameObject body, Sector sector, float groundScale)
|
||||||
{
|
{
|
||||||
GameObject groundGO = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
GameObject groundGO = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
||||||
groundGO.transform.parent = body.transform;
|
groundGO.transform.parent = sector?.transform ?? body.transform;
|
||||||
groundGO.transform.localScale = new Vector3(groundScale, groundScale, groundScale);
|
groundGO.transform.localScale = new Vector3(groundScale, groundScale, groundScale);
|
||||||
groundGO.transform.localPosition = Vector3.zero;
|
groundGO.transform.localPosition = Vector3.zero;
|
||||||
groundGO.GetComponent<MeshFilter>().mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent<MeshFilter>().mesh;
|
groundGO.GetComponent<MeshFilter>().mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent<MeshFilter>().mesh;
|
||||||
|
|||||||
@ -17,7 +17,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
{
|
{
|
||||||
public static Shader PlanetShader;
|
public static Shader PlanetShader;
|
||||||
|
|
||||||
public static void Make(GameObject go, HeightMapModule module, IModBehaviour mod)
|
public static void Make(GameObject go, Sector sector, HeightMapModule module, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
Texture2D heightMap, textureMap;
|
Texture2D heightMap, textureMap;
|
||||||
try
|
try
|
||||||
@ -35,7 +35,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
GameObject cubeSphere = new GameObject("CubeSphere");
|
GameObject cubeSphere = new GameObject("CubeSphere");
|
||||||
cubeSphere.SetActive(false);
|
cubeSphere.SetActive(false);
|
||||||
cubeSphere.transform.parent = go.transform;
|
cubeSphere.transform.parent = sector?.transform ?? go.transform;
|
||||||
cubeSphere.transform.rotation = Quaternion.Euler(90, 0, 0);
|
cubeSphere.transform.rotation = Quaternion.Euler(90, 0, 0);
|
||||||
|
|
||||||
Mesh mesh = CubeSphere.Build(51, heightMap, module.MinHeight, module.MaxHeight, module.Stretch);
|
Mesh mesh = CubeSphere.Build(51, heightMap, module.MinHeight, module.MaxHeight, module.Stretch);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
{
|
{
|
||||||
static class LavaBuilder
|
static class LavaBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject body, Sector sector, OWRigidbody rb, LavaModule module)
|
public static void Make(GameObject go, Sector sector, OWRigidbody rb, LavaModule module)
|
||||||
{
|
{
|
||||||
var heightScale = module.Size;
|
var heightScale = module.Size;
|
||||||
if(module.Curve != null)
|
if(module.Curve != null)
|
||||||
@ -27,7 +27,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
var moltenCore = new GameObject("MoltenCore");
|
var moltenCore = new GameObject("MoltenCore");
|
||||||
moltenCore.SetActive(false);
|
moltenCore.SetActive(false);
|
||||||
moltenCore.transform.parent = body.transform;
|
moltenCore.transform.parent = sector?.transform ?? go.transform;
|
||||||
moltenCore.transform.localPosition = Vector3.zero;
|
moltenCore.transform.localPosition = Vector3.zero;
|
||||||
moltenCore.transform.localScale = Vector3.one * module.Size;
|
moltenCore.transform.localScale = Vector3.one * module.Size;
|
||||||
|
|
||||||
|
|||||||
@ -11,10 +11,10 @@ namespace NewHorizons.Builder.Body
|
|||||||
{
|
{
|
||||||
static class ProcGenBuilder
|
static class ProcGenBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject go, ProcGenModule module)
|
public static void Make(GameObject go, Sector sector, ProcGenModule module)
|
||||||
{
|
{
|
||||||
GameObject icosphere = new GameObject("Icosphere");
|
GameObject icosphere = new GameObject("Icosphere");
|
||||||
icosphere.transform.parent = go.transform;
|
icosphere.transform.parent = sector?.transform ?? go.transform;
|
||||||
icosphere.transform.rotation = Quaternion.Euler(90, 0, 0);
|
icosphere.transform.rotation = Quaternion.Euler(90, 0, 0);
|
||||||
icosphere.transform.localPosition = Vector3.zero;
|
icosphere.transform.localPosition = Vector3.zero;
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
public static Shader UnlitRingShader;
|
public static Shader UnlitRingShader;
|
||||||
public static Shader UnlitRingShader1Pixel;
|
public static Shader UnlitRingShader1Pixel;
|
||||||
|
|
||||||
public static GameObject Make(GameObject body, RingModule ring, IModBehaviour mod)
|
public static GameObject Make(GameObject body, Sector sector, RingModule ring, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
// Properly lit shader doesnt work yet
|
// Properly lit shader doesnt work yet
|
||||||
ring.Unlit = true;
|
ring.Unlit = true;
|
||||||
@ -38,7 +38,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ringGO = new GameObject("Ring");
|
var ringGO = new GameObject("Ring");
|
||||||
ringGO.transform.parent = body.transform;
|
ringGO.transform.parent = sector.transform ?? body.transform;
|
||||||
ringGO.transform.localPosition = Vector3.zero;
|
ringGO.transform.localPosition = Vector3.zero;
|
||||||
ringGO.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
ringGO.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||||
ringGO.transform.Rotate(ringGO.transform.TransformDirection(Vector3.up), ring.LongitudeOfAscendingNode);
|
ringGO.transform.Rotate(ringGO.transform.TransformDirection(Vector3.up), ring.LongitudeOfAscendingNode);
|
||||||
@ -55,7 +55,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
if (UnlitRingShader1Pixel == null) UnlitRingShader1Pixel = Main.ShaderBundle.LoadAsset<Shader>("Assets/Shaders/UnlitRing1Pixel.shader");
|
if (UnlitRingShader1Pixel == null) UnlitRingShader1Pixel = Main.ShaderBundle.LoadAsset<Shader>("Assets/Shaders/UnlitRing1Pixel.shader");
|
||||||
|
|
||||||
var mat = new Material(ring.Unlit ? UnlitRingShader : RingShader);
|
var mat = new Material(ring.Unlit ? UnlitRingShader : RingShader);
|
||||||
if(texture.width == 1)
|
if (texture.width == 1)
|
||||||
{
|
{
|
||||||
mat = new Material(ring.Unlit ? UnlitRingShader1Pixel : RingShader1Pixel);
|
mat = new Material(ring.Unlit ? UnlitRingShader1Pixel : RingShader1Pixel);
|
||||||
mat.SetFloat("_InnerRadius", 0);
|
mat.SetFloat("_InnerRadius", 0);
|
||||||
@ -70,7 +70,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
var segments = (int)Mathf.Clamp(ring.OuterRadius, 20, 2000);
|
var segments = (int)Mathf.Clamp(ring.OuterRadius, 20, 2000);
|
||||||
BuildRingMesh(ringMesh, segments, ring.InnerRadius, ring.OuterRadius);
|
BuildRingMesh(ringMesh, segments, ring.InnerRadius, ring.OuterRadius);
|
||||||
|
|
||||||
if(ring.RotationSpeed != 0)
|
if (ring.RotationSpeed != 0)
|
||||||
{
|
{
|
||||||
var rot = ringGO.AddComponent<RotateTransform>();
|
var rot = ringGO.AddComponent<RotateTransform>();
|
||||||
rot._degreesPerSecond = ring.RotationSpeed;
|
rot._degreesPerSecond = ring.RotationSpeed;
|
||||||
@ -102,7 +102,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
var sfv = ringVolume.AddComponent<SimpleFluidVolume>();
|
var sfv = ringVolume.AddComponent<SimpleFluidVolume>();
|
||||||
var fluidType = FluidVolume.Type.NONE;
|
var fluidType = FluidVolume.Type.NONE;
|
||||||
|
|
||||||
if(!string.IsNullOrEmpty(ring.FluidType))
|
if (!string.IsNullOrEmpty(ring.FluidType))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,7 +17,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
sandGO.SetActive(false);
|
sandGO.SetActive(false);
|
||||||
|
|
||||||
var sandSphere = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/SandSphere"), sandGO.transform);
|
var sandSphere = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/SandSphere"), sandGO.transform);
|
||||||
if(module.Tint != null)
|
if (module.Tint != null)
|
||||||
{
|
{
|
||||||
var oldMR = sandSphere.GetComponent<TessellatedSphereRenderer>();
|
var oldMR = sandSphere.GetComponent<TessellatedSphereRenderer>();
|
||||||
var sandMaterials = oldMR.sharedMaterials;
|
var sandMaterials = oldMR.sharedMaterials;
|
||||||
@ -45,18 +45,18 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
sandSphere.AddComponent<ChildColliderSettings>();
|
sandSphere.AddComponent<ChildColliderSettings>();
|
||||||
|
|
||||||
if(module.Curve != null)
|
if (module.Curve != null)
|
||||||
{
|
{
|
||||||
var levelController = sandGO.AddComponent<SandLevelController>();
|
var levelController = sandGO.AddComponent<SandLevelController>();
|
||||||
var curve = new AnimationCurve();
|
var curve = new AnimationCurve();
|
||||||
foreach(var pair in module.Curve)
|
foreach (var pair in module.Curve)
|
||||||
{
|
{
|
||||||
curve.AddKey(new Keyframe(pair.Time, 2f * module.Size * pair.Value));
|
curve.AddKey(new Keyframe(pair.Time, 2f * module.Size * pair.Value));
|
||||||
}
|
}
|
||||||
levelController._scaleCurve = curve;
|
levelController._scaleCurve = curve;
|
||||||
}
|
}
|
||||||
|
|
||||||
sandGO.transform.parent = go.transform;
|
sandGO.transform.parent = sector?.transform ?? go.transform;
|
||||||
sandGO.transform.localPosition = Vector3.zero;
|
sandGO.transform.localPosition = Vector3.zero;
|
||||||
sandGO.transform.localScale = Vector3.one * module.Size * 2f;
|
sandGO.transform.localScale = Vector3.one * module.Size * 2f;
|
||||||
|
|
||||||
|
|||||||
@ -23,14 +23,14 @@ namespace NewHorizons.Builder.Body
|
|||||||
private static Shader blackHoleShader = null;
|
private static Shader blackHoleShader = null;
|
||||||
private static Shader whiteHoleShader = null;
|
private static Shader whiteHoleShader = null;
|
||||||
|
|
||||||
public static void Make(GameObject body, Sector sector, OWRigidbody OWRB, IPlanetConfig config)
|
public static void Make(GameObject go, Sector sector, OWRigidbody OWRB, IPlanetConfig config)
|
||||||
{
|
{
|
||||||
// Backwards compatibility
|
// Backwards compatibility
|
||||||
if(config.Singularity == null)
|
if(config.Singularity == null)
|
||||||
{
|
{
|
||||||
if(config.Base.BlackHoleSize != 0)
|
if(config.Base.BlackHoleSize != 0)
|
||||||
{
|
{
|
||||||
MakeBlackHole(body, sector, Vector3.zero, config.Base.BlackHoleSize, true, null);
|
MakeBlackHole(go, sector, Vector3.zero, config.Base.BlackHoleSize, true, null);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -53,10 +53,10 @@ namespace NewHorizons.Builder.Body
|
|||||||
switch (polarity)
|
switch (polarity)
|
||||||
{
|
{
|
||||||
case Polarity.BlackHole:
|
case Polarity.BlackHole:
|
||||||
newSingularity = MakeBlackHole(body, sector, localPosition, size, hasHazardVolume, config.Singularity.TargetStarSystem);
|
newSingularity = MakeBlackHole(go, sector, localPosition, size, hasHazardVolume, config.Singularity.TargetStarSystem);
|
||||||
break;
|
break;
|
||||||
case Polarity.WhiteHole:
|
case Polarity.WhiteHole:
|
||||||
newSingularity = MakeWhiteHole(body, sector, OWRB, localPosition, size);
|
newSingularity = MakeWhiteHole(go, sector, OWRB, localPosition, size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,11 +92,11 @@ namespace NewHorizons.Builder.Body
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject MakeBlackHole(GameObject body, Sector sector, Vector3 localPosition, float size, bool hasDestructionVolume, string targetSolarSystem, bool makeAudio = true)
|
public static GameObject MakeBlackHole(GameObject go, Sector sector, Vector3 localPosition, float size, bool hasDestructionVolume, string targetSolarSystem, bool makeAudio = true)
|
||||||
{
|
{
|
||||||
var blackHole = new GameObject("BlackHole");
|
var blackHole = new GameObject("BlackHole");
|
||||||
blackHole.SetActive(false);
|
blackHole.SetActive(false);
|
||||||
blackHole.transform.parent = body.transform;
|
blackHole.transform.parent = sector?.transform ?? go.transform;
|
||||||
blackHole.transform.localPosition = localPosition;
|
blackHole.transform.localPosition = localPosition;
|
||||||
|
|
||||||
var blackHoleRender = new GameObject("BlackHoleRender");
|
var blackHoleRender = new GameObject("BlackHoleRender");
|
||||||
@ -167,7 +167,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
{
|
{
|
||||||
var whiteHole = new GameObject("WhiteHole");
|
var whiteHole = new GameObject("WhiteHole");
|
||||||
whiteHole.SetActive(false);
|
whiteHole.SetActive(false);
|
||||||
whiteHole.transform.parent = body.transform;
|
whiteHole.transform.parent = sector?.transform ?? body.transform;
|
||||||
whiteHole.transform.localPosition = localPosition;
|
whiteHole.transform.localPosition = localPosition;
|
||||||
|
|
||||||
var whiteHoleRenderer = new GameObject("WhiteHoleRenderer");
|
var whiteHoleRenderer = new GameObject("WhiteHoleRenderer");
|
||||||
|
|||||||
@ -17,14 +17,14 @@ namespace NewHorizons.Builder.Body
|
|||||||
static class StarBuilder
|
static class StarBuilder
|
||||||
{
|
{
|
||||||
public const float OuterRadiusRatio = 1.5f;
|
public const float OuterRadiusRatio = 1.5f;
|
||||||
|
|
||||||
private static Texture2D _colorOverTime;
|
private static Texture2D _colorOverTime;
|
||||||
public static StarController Make(GameObject body, Sector sector, StarModule starModule)
|
|
||||||
|
public static StarController Make(GameObject go, Sector sector, StarModule starModule)
|
||||||
{
|
{
|
||||||
if (_colorOverTime == null) _colorOverTime = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/StarColorOverTime.png");
|
if (_colorOverTime == null) _colorOverTime = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/StarColorOverTime.png");
|
||||||
|
|
||||||
var starGO = new GameObject("Star");
|
var starGO = new GameObject("Star");
|
||||||
starGO.transform.parent = body.transform;
|
starGO.transform.parent = sector?.transform ?? go.transform;
|
||||||
|
|
||||||
var sunSurface = GameObject.Instantiate(GameObject.Find("Sun_Body/Sector_SUN/Geometry_SUN/Surface"), starGO.transform);
|
var sunSurface = GameObject.Instantiate(GameObject.Find("Sun_Body/Sector_SUN/Geometry_SUN/Surface"), starGO.transform);
|
||||||
sunSurface.transform.localPosition = Vector3.zero;
|
sunSurface.transform.localPosition = Vector3.zero;
|
||||||
@ -67,7 +67,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
if(starModule.HasAtmosphere)
|
if(starModule.HasAtmosphere)
|
||||||
{
|
{
|
||||||
var sunAtmosphere = GameObject.Instantiate(GameObject.Find("Sun_Body/Atmosphere_SUN"), body.transform);
|
var sunAtmosphere = GameObject.Instantiate(GameObject.Find("Sun_Body/Atmosphere_SUN"), go.transform);
|
||||||
sunAtmosphere.transform.localPosition = Vector3.zero;
|
sunAtmosphere.transform.localPosition = Vector3.zero;
|
||||||
sunAtmosphere.transform.localScale = Vector3.one;
|
sunAtmosphere.transform.localScale = Vector3.one;
|
||||||
sunAtmosphere.name = "Atmosphere_Star";
|
sunAtmosphere.name = "Atmosphere_Star";
|
||||||
@ -157,7 +157,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
StarController starController = null;
|
StarController starController = null;
|
||||||
if (starModule.SolarLuminosity != 0)
|
if (starModule.SolarLuminosity != 0)
|
||||||
{
|
{
|
||||||
starController = body.AddComponent<StarController>();
|
starController = go.AddComponent<StarController>();
|
||||||
starController.Light = light;
|
starController.Light = light;
|
||||||
starController.AmbientLight = ambientLight;
|
starController.AmbientLight = ambientLight;
|
||||||
starController.FaceActiveCamera = faceActiveCamera;
|
starController.FaceActiveCamera = faceActiveCamera;
|
||||||
|
|||||||
@ -11,14 +11,14 @@ namespace NewHorizons.Builder.Body
|
|||||||
{
|
{
|
||||||
static class WaterBuilder
|
static class WaterBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject body, Sector sector, OWRigidbody rb, WaterModule module)
|
public static void Make(GameObject go, Sector sector, OWRigidbody rb, WaterModule module)
|
||||||
{
|
{
|
||||||
var waterSize = module.Size;
|
var waterSize = module.Size;
|
||||||
|
|
||||||
GameObject waterGO = new GameObject("Water");
|
GameObject waterGO = new GameObject("Water");
|
||||||
waterGO.SetActive(false);
|
waterGO.SetActive(false);
|
||||||
waterGO.layer = 15;
|
waterGO.layer = 15;
|
||||||
waterGO.transform.parent = body.transform;
|
waterGO.transform.parent = sector?.transform ?? go.transform;
|
||||||
waterGO.transform.localScale = new Vector3(waterSize, waterSize, waterSize);
|
waterGO.transform.localScale = new Vector3(waterSize, waterSize, waterSize);
|
||||||
|
|
||||||
var GDTSR = GameObject.Find("Ocean_GD").GetComponent<TessellatedSphereRenderer>();
|
var GDTSR = GameObject.Find("Ocean_GD").GetComponent<TessellatedSphereRenderer>();
|
||||||
|
|||||||
@ -8,9 +8,9 @@ namespace NewHorizons.Builder.General
|
|||||||
{
|
{
|
||||||
static class AmbientLightBuilder
|
static class AmbientLightBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject body, float scale)
|
public static void Make(GameObject body, Sector sector, float scale)
|
||||||
{
|
{
|
||||||
GameObject lightGO = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/AmbientLight_BH_Surface"), body.transform);
|
GameObject lightGO = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/AmbientLight_BH_Surface"), sector?.transform ?? body.transform);
|
||||||
lightGO.transform.localPosition = Vector3.zero;
|
lightGO.transform.localPosition = Vector3.zero;
|
||||||
lightGO.name = "Light";
|
lightGO.name = "Light";
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
var original = GameObject.Find("TimberHearth_Body/Sector_TH/Interactables_TH/Geysers/Geyser_Village");
|
var original = GameObject.Find("TimberHearth_Body/Sector_TH/Interactables_TH/Geysers/Geyser_Village");
|
||||||
GameObject geyserGO = original.InstantiateInactive();
|
GameObject geyserGO = original.InstantiateInactive();
|
||||||
geyserGO.transform.parent = sector.transform;
|
geyserGO.transform.parent = sector?.transform ?? go.transform;
|
||||||
geyserGO.name = "Geyser";
|
geyserGO.name = "Geyser";
|
||||||
|
|
||||||
var pos = ((Vector3)info.position);
|
var pos = ((Vector3)info.position);
|
||||||
|
|||||||
@ -92,7 +92,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
nomaiWallTextObj.transform.up = up;
|
nomaiWallTextObj.transform.up = up;
|
||||||
nomaiWallTextObj.transform.forward = forward;
|
nomaiWallTextObj.transform.forward = forward;
|
||||||
}
|
}
|
||||||
if(info.rotation != null)
|
if (info.rotation != null)
|
||||||
{
|
{
|
||||||
nomaiWallTextObj.transform.localRotation = Quaternion.Euler(info.rotation);
|
nomaiWallTextObj.transform.localRotation = Quaternion.Euler(info.rotation);
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
arc = _childArcPrefabs[Random.Range(0, _childArcPrefabs.Count())].InstantiateInactive();
|
arc = _childArcPrefabs[Random.Range(0, _childArcPrefabs.Count())].InstantiateInactive();
|
||||||
}
|
}
|
||||||
else if(type == "stranger" && _ghostArcPrefabs.Count() > 0) // It could be empty if they dont have the DLC
|
else if (type == "stranger" && _ghostArcPrefabs.Count() > 0) // It could be empty if they dont have the DLC
|
||||||
{
|
{
|
||||||
arc = _ghostArcPrefabs[Random.Range(0, _ghostArcPrefabs.Count())].InstantiateInactive();
|
arc = _ghostArcPrefabs[Random.Range(0, _ghostArcPrefabs.Count())].InstantiateInactive();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
var slideCollectionContainer = slideReelObj.GetRequiredComponent<SlideCollectionContainer>();
|
var slideCollectionContainer = slideReelObj.GetRequiredComponent<SlideCollectionContainer>();
|
||||||
|
|
||||||
foreach(var renderer in slideReelObj.GetComponentsInChildren<Renderer>())
|
foreach (var renderer in slideReelObj.GetComponentsInChildren<Renderer>())
|
||||||
{
|
{
|
||||||
renderer.enabled = true;
|
renderer.enabled = true;
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
// The base game ones only have 15 slides max
|
// The base game ones only have 15 slides max
|
||||||
var textures = new Texture2D[slidesCount >= 15 ? 15 : slidesCount];
|
var textures = new Texture2D[slidesCount >= 15 ? 15 : slidesCount];
|
||||||
|
|
||||||
for(int i = 0; i < slidesCount; i++)
|
for (int i = 0; i < slidesCount; i++)
|
||||||
{
|
{
|
||||||
var slide = new Slide();
|
var slide = new Slide();
|
||||||
var slideInfo = info.slides[i];
|
var slideInfo = info.slides[i];
|
||||||
@ -71,7 +71,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
slide.textureOverride = ImageUtilities.Invert(texture);
|
slide.textureOverride = ImageUtilities.Invert(texture);
|
||||||
|
|
||||||
// Track the first 15 to put on the slide reel object
|
// Track the first 15 to put on the slide reel object
|
||||||
if(i < 15) textures[i] = texture;
|
if (i < 15) textures[i] = texture;
|
||||||
|
|
||||||
AddModules(slideInfo, ref slide);
|
AddModules(slideInfo, ref slide);
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
public static void Make(GameObject planetGO, Sector sector, PropModule.RaftInfo info, OWRigidbody planetBody)
|
public static void Make(GameObject planetGO, Sector sector, PropModule.RaftInfo info, OWRigidbody planetBody)
|
||||||
{
|
{
|
||||||
if(_prefab == null)
|
if (_prefab == null)
|
||||||
{
|
{
|
||||||
_prefab = GameObject.FindObjectOfType<RaftController>()?.gameObject?.InstantiateInactive();
|
_prefab = GameObject.FindObjectOfType<RaftController>()?.gameObject?.InstantiateInactive();
|
||||||
if (_prefab == null)
|
if (_prefab == null)
|
||||||
@ -33,7 +33,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
GameObject raftObject = _prefab.InstantiateInactive();
|
GameObject raftObject = _prefab.InstantiateInactive();
|
||||||
raftObject.name = "Raft_Body";
|
raftObject.name = "Raft_Body";
|
||||||
raftObject.transform.parent = sector.transform;
|
raftObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
raftObject.transform.localPosition = info.position;
|
raftObject.transform.localPosition = info.position;
|
||||||
raftObject.transform.localRotation = Quaternion.identity;
|
raftObject.transform.localRotation = Quaternion.identity;
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
heightMapTexture = ImageUtilities.GetTexture(mod, heightMap.HeightMap);
|
heightMapTexture = ImageUtilities.GetTexture(mod, heightMap.HeightMap);
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
if(heightMapTexture == null)
|
if (heightMapTexture == null)
|
||||||
{
|
{
|
||||||
radius = heightMap.MaxHeight;
|
radius = heightMap.MaxHeight;
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
else prefab = GameObject.Find(propInfo.path);
|
else prefab = GameObject.Find(propInfo.path);
|
||||||
for (int i = 0; i < propInfo.count; i++)
|
for (int i = 0; i < propInfo.count; i++)
|
||||||
{
|
{
|
||||||
var randomInd = (int)Random.Range(0, points.Count-1);
|
var randomInd = (int)Random.Range(0, points.Count - 1);
|
||||||
var point = points[randomInd];
|
var point = points[randomInd];
|
||||||
|
|
||||||
var height = radius;
|
var height = radius;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
Logger.Log($"Initializing SignalBuilder");
|
Logger.Log($"Initializing SignalBuilder");
|
||||||
_customSignalNames = new Dictionary<SignalName, string>();
|
_customSignalNames = new Dictionary<SignalName, string>();
|
||||||
_availableSignalNames = new Stack<SignalName> (new SignalName[]
|
_availableSignalNames = new Stack<SignalName>(new SignalName[]
|
||||||
{
|
{
|
||||||
(SignalName)17,
|
(SignalName)17,
|
||||||
(SignalName)18,
|
(SignalName)18,
|
||||||
@ -100,7 +100,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
NumberOfFrequencies++;
|
NumberOfFrequencies++;
|
||||||
|
|
||||||
// This stuff happens after the signalscope is Awake so we have to change the number of frequencies now
|
// This stuff happens after the signalscope is Awake so we have to change the number of frequencies now
|
||||||
GameObject.FindObjectOfType<Signalscope>()._strongestSignals = new AudioSignal[NumberOfFrequencies+1];
|
GameObject.FindObjectOfType<Signalscope>()._strongestSignals = new AudioSignal[NumberOfFrequencies + 1];
|
||||||
|
|
||||||
return freq;
|
return freq;
|
||||||
}
|
}
|
||||||
@ -131,17 +131,17 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
public static void Make(GameObject body, Sector sector, SignalModule module, IModBehaviour mod)
|
public static void Make(GameObject body, Sector sector, SignalModule module, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
foreach(var info in module.Signals)
|
foreach (var info in module.Signals)
|
||||||
{
|
{
|
||||||
Make(body, sector, info, mod);
|
Make(body, sector, info, mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Make(GameObject body, Sector sector, SignalModule.SignalInfo info, IModBehaviour mod)
|
public static void Make(GameObject planetGO, Sector sector, SignalModule.SignalInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
var signalGO = new GameObject($"Signal_{info.Name}");
|
var signalGO = new GameObject($"Signal_{info.Name}");
|
||||||
signalGO.SetActive(false);
|
signalGO.SetActive(false);
|
||||||
signalGO.transform.parent = body.transform;
|
signalGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
signalGO.transform.localPosition = info.Position != null ? (Vector3)info.Position : Vector3.zero;
|
signalGO.transform.localPosition = info.Position != null ? (Vector3)info.Position : Vector3.zero;
|
||||||
signalGO.layer = LayerMask.NameToLayer("AdvancedEffectVolume");
|
signalGO.layer = LayerMask.NameToLayer("AdvancedEffectVolume");
|
||||||
|
|
||||||
@ -156,14 +156,14 @@ namespace NewHorizons.Builder.Props
|
|||||||
var name = StringToSignalName(info.Name);
|
var name = StringToSignalName(info.Name);
|
||||||
|
|
||||||
AudioClip clip = null;
|
AudioClip clip = null;
|
||||||
if(info.AudioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(info.AudioClip);
|
if (info.AudioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(info.AudioClip);
|
||||||
else if (info.AudioFilePath != null)
|
else if (info.AudioFilePath != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + info.AudioFilePath);
|
clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + info.AudioFilePath);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.LogError($"Couldn't load audio file {info.AudioFilePath} : {e.Message}");
|
Logger.LogError($"Couldn't load audio file {info.AudioFilePath} : {e.Message}");
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
audioSignal.SetSector(sector);
|
audioSignal.SetSector(sector);
|
||||||
|
|
||||||
if(name == SignalName.Default) audioSignal._preventIdentification = true;
|
if (name == SignalName.Default) audioSignal._preventIdentification = true;
|
||||||
|
|
||||||
audioSignal._frequency = frequency;
|
audioSignal._frequency = frequency;
|
||||||
audioSignal._name = name;
|
audioSignal._name = name;
|
||||||
@ -194,7 +194,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
source.velocityUpdateMode = AudioVelocityUpdateMode.Fixed;
|
source.velocityUpdateMode = AudioVelocityUpdateMode.Fixed;
|
||||||
source.rolloffMode = AudioRolloffMode.Custom;
|
source.rolloffMode = AudioRolloffMode.Custom;
|
||||||
|
|
||||||
if(_customCurve == null)
|
if (_customCurve == null)
|
||||||
_customCurve = GameObject.Find("Moon_Body/Sector_THM/Characters_THM/Villager_HEA_Esker/Signal_Whistling").GetComponent<AudioSource>().GetCustomCurve(AudioSourceCurveType.CustomRolloff);
|
_customCurve = GameObject.Find("Moon_Body/Sector_THM/Characters_THM/Villager_HEA_Esker/Signal_Whistling").GetComponent<AudioSource>().GetCustomCurve(AudioSourceCurveType.CustomRolloff);
|
||||||
|
|
||||||
source.SetCustomCurve(AudioSourceCurveType.CustomRolloff, _customCurve);
|
source.SetCustomCurve(AudioSourceCurveType.CustomRolloff, _customCurve);
|
||||||
@ -210,7 +210,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
var signalDetectionGO = new GameObject($"SignalDetectionTrigger_{info.Name}");
|
var signalDetectionGO = new GameObject($"SignalDetectionTrigger_{info.Name}");
|
||||||
signalDetectionGO.SetActive(false);
|
signalDetectionGO.SetActive(false);
|
||||||
signalDetectionGO.transform.parent = body.transform;
|
signalDetectionGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
signalDetectionGO.transform.localPosition = info.Position != null ? (Vector3)info.Position : Vector3.zero;
|
signalDetectionGO.transform.localPosition = info.Position != null ? (Vector3)info.Position : Vector3.zero;
|
||||||
signalDetectionGO.layer = LayerMask.NameToLayer("AdvancedEffectVolume");
|
signalDetectionGO.layer = LayerMask.NameToLayer("AdvancedEffectVolume");
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
private static SignalFrequency StringToFrequency(string str)
|
private static SignalFrequency StringToFrequency(string str)
|
||||||
{
|
{
|
||||||
foreach(SignalFrequency freq in Enum.GetValues(typeof(SignalFrequency)))
|
foreach (SignalFrequency freq in Enum.GetValues(typeof(SignalFrequency)))
|
||||||
{
|
{
|
||||||
if (str.Equals(freq.ToString())) return freq;
|
if (str.Equals(freq.ToString())) return freq;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,12 +26,12 @@ namespace NewHorizons.Builder.Props
|
|||||||
upPrefab = GameObject.Find("BrittleHollow_Body/Sector_BH/Sector_SouthHemisphere/Sector_SouthPole/Sector_Observatory/Interactables_Observatory/MockUpTornado").InstantiateInactive();
|
upPrefab = GameObject.Find("BrittleHollow_Body/Sector_BH/Sector_SouthHemisphere/Sector_SouthPole/Sector_Observatory/Interactables_Observatory/MockUpTornado").InstantiateInactive();
|
||||||
upPrefab.name = "Tornado_Up_Prefab";
|
upPrefab.name = "Tornado_Up_Prefab";
|
||||||
}
|
}
|
||||||
if(downPrefab == null)
|
if (downPrefab == null)
|
||||||
{
|
{
|
||||||
downPrefab = GameObject.Find("BrittleHollow_Body/Sector_BH/Sector_SouthHemisphere/Sector_SouthPole/Sector_Observatory/Interactables_Observatory/MockDownTornado").InstantiateInactive();
|
downPrefab = GameObject.Find("BrittleHollow_Body/Sector_BH/Sector_SouthHemisphere/Sector_SouthPole/Sector_Observatory/Interactables_Observatory/MockDownTornado").InstantiateInactive();
|
||||||
downPrefab.name = "Tornado_Down_Prefab";
|
downPrefab.name = "Tornado_Down_Prefab";
|
||||||
}
|
}
|
||||||
if(soundPrefab == null)
|
if (soundPrefab == null)
|
||||||
{
|
{
|
||||||
soundPrefab = GameObject.Find("GiantsDeep_Body/Sector_GD/Sector_GDInterior/Tornadoes_GDInterior/SouthernTornadoes/DownTornado_Pivot/DownTornado/AudioRail").InstantiateInactive();
|
soundPrefab = GameObject.Find("GiantsDeep_Body/Sector_GD/Sector_GDInterior/Tornadoes_GDInterior/SouthernTornadoes/DownTornado_Pivot/DownTornado/AudioRail").InstantiateInactive();
|
||||||
soundPrefab.name = "AudioRail_Prefab";
|
soundPrefab.name = "AudioRail_Prefab";
|
||||||
@ -39,12 +39,12 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
float elevation;
|
float elevation;
|
||||||
Vector3 position;
|
Vector3 position;
|
||||||
if(info.position != null)
|
if (info.position != null)
|
||||||
{
|
{
|
||||||
position = info.position ?? Random.onUnitSphere * info.elevation;
|
position = info.position ?? Random.onUnitSphere * info.elevation;
|
||||||
elevation = position.magnitude;
|
elevation = position.magnitude;
|
||||||
}
|
}
|
||||||
else if(info.elevation != 0)
|
else if (info.elevation != 0)
|
||||||
{
|
{
|
||||||
position = Random.onUnitSphere * info.elevation;
|
position = Random.onUnitSphere * info.elevation;
|
||||||
elevation = info.elevation;
|
elevation = info.elevation;
|
||||||
@ -108,10 +108,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
tornadoGO.GetComponentInChildren<CapsuleShape>().enabled = true;
|
tornadoGO.GetComponentInChildren<CapsuleShape>().enabled = true;
|
||||||
|
|
||||||
if(info.tint != null)
|
if (info.tint != null)
|
||||||
{
|
{
|
||||||
var colour = info.tint.ToColor();
|
var colour = info.tint.ToColor();
|
||||||
foreach(var renderer in tornadoGO.GetComponentsInChildren<Renderer>())
|
foreach (var renderer in tornadoGO.GetComponentsInChildren<Renderer>())
|
||||||
{
|
{
|
||||||
renderer.material.color = colour;
|
renderer.material.color = colour;
|
||||||
renderer.material.SetColor("_DetailColor", colour);
|
renderer.material.SetColor("_DetailColor", colour);
|
||||||
@ -119,7 +119,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(info.wanderRate != 0)
|
if (info.wanderRate != 0)
|
||||||
{
|
{
|
||||||
var wanderer = tornadoGO.AddComponent<NHTornadoWanderController>();
|
var wanderer = tornadoGO.AddComponent<NHTornadoWanderController>();
|
||||||
wanderer.wanderRate = info.wanderRate;
|
wanderer.wanderRate = info.wanderRate;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
var launcherGO = prefab.InstantiateInactive();
|
var launcherGO = prefab.InstantiateInactive();
|
||||||
launcherGO.transform.parent = sector.transform;
|
launcherGO.transform.parent = sector.transform;
|
||||||
launcherGO.transform.localPosition = info.position == null ? Vector3.zero : (Vector3) info.position;
|
launcherGO.transform.localPosition = info.position == null ? Vector3.zero : (Vector3)info.position;
|
||||||
launcherGO.transform.rotation = Quaternion.FromToRotation(launcherGO.transform.TransformDirection(Vector3.up), ((Vector3)info.position).normalized).normalized;
|
launcherGO.transform.rotation = Quaternion.FromToRotation(launcherGO.transform.TransformDirection(Vector3.up), ((Vector3)info.position).normalized).normalized;
|
||||||
launcherGO.name = "MeteorLauncher";
|
launcherGO.name = "MeteorLauncher";
|
||||||
|
|
||||||
@ -37,7 +37,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
launcherGO.SetActive(true);
|
launcherGO.SetActive(true);
|
||||||
|
|
||||||
// Have to null check else it breaks on reload configs
|
// Have to null check else it breaks on reload configs
|
||||||
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady && meteorLauncher._meteorPool != null, () => {
|
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady && meteorLauncher._meteorPool != null, () =>
|
||||||
|
{
|
||||||
foreach (var meteor in meteorLauncher._meteorPool)
|
foreach (var meteor in meteorLauncher._meteorPool)
|
||||||
{
|
{
|
||||||
FixMeteor(meteor, info);
|
FixMeteor(meteor, info);
|
||||||
|
|||||||
@ -218,9 +218,9 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
Vector2 pivot = new Vector2(newTexture.width / 2, newTexture.height / 2);
|
Vector2 pivot = new Vector2(newTexture.width / 2, newTexture.height / 2);
|
||||||
return Sprite.Create(newTexture, rect, pivot);
|
return Sprite.Create(newTexture, rect, pivot);
|
||||||
}
|
}
|
||||||
catch(Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
if(logError) Logger.LogError($"Couldn't load image for {entryId} at {relativePath}");
|
if (logError) Logger.LogError($"Couldn't load image for {entryId} at {relativePath}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
NewHorizons/External/AtmosphereModule.cs
vendored
8
NewHorizons/External/AtmosphereModule.cs
vendored
@ -25,5 +25,13 @@ namespace NewHorizons.External
|
|||||||
public bool HasOxygen { get; set; }
|
public bool HasOxygen { get; set; }
|
||||||
public bool HasAtmosphere { get; set; }
|
public bool HasAtmosphere { get; set; }
|
||||||
public MColor AtmosphereTint { get; set; }
|
public MColor AtmosphereTint { get; set; }
|
||||||
|
|
||||||
|
public class AirInfo
|
||||||
|
{
|
||||||
|
public float Scale { get; set; }
|
||||||
|
public bool HasOxygen { get; set; }
|
||||||
|
public bool IsRaining { get; set; }
|
||||||
|
public bool IsSnowing { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using NewHorizons.Builder.Orbital;
|
|||||||
using NewHorizons.Builder.Props;
|
using NewHorizons.Builder.Props;
|
||||||
using NewHorizons.Components;
|
using NewHorizons.Components;
|
||||||
using NewHorizons.Components.Orbital;
|
using NewHorizons.Components.Orbital;
|
||||||
|
using NewHorizons.External;
|
||||||
using NewHorizons.External.VariableSize;
|
using NewHorizons.External.VariableSize;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using System;
|
using System;
|
||||||
@ -119,9 +120,9 @@ namespace NewHorizons.Handlers
|
|||||||
Logger.Log("Done loading bodies");
|
Logger.Log("Done loading bodies");
|
||||||
|
|
||||||
// I don't know what these do but they look really weird from a distance
|
// I don't know what these do but they look really weird from a distance
|
||||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(PlanetDestroyer.RemoveAllProxies);
|
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(PlanetDestructionHandler.RemoveAllProxies);
|
||||||
|
|
||||||
if (Main.SystemDict[Main.Instance.CurrentStarSystem].Config.destroyStockPlanets) PlanetDestroyer.RemoveSolarSystem();
|
if (Main.SystemDict[Main.Instance.CurrentStarSystem].Config.destroyStockPlanets) PlanetDestructionHandler.RemoveSolarSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)
|
public static bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)
|
||||||
@ -145,7 +146,7 @@ namespace NewHorizons.Handlers
|
|||||||
if (body.Config.Destroy)
|
if (body.Config.Destroy)
|
||||||
{
|
{
|
||||||
var ao = existingPlanet.GetComponent<AstroObject>();
|
var ao = existingPlanet.GetComponent<AstroObject>();
|
||||||
if (ao != null) Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestroyer.RemoveBody(ao), 2);
|
if (ao != null) Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestructionHandler.RemoveBody(ao), 2);
|
||||||
else Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => existingPlanet.SetActive(false), 2);
|
else Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => existingPlanet.SetActive(false), 2);
|
||||||
}
|
}
|
||||||
else UpdateBody(body, existingPlanet);
|
else UpdateBody(body, existingPlanet);
|
||||||
@ -230,10 +231,8 @@ namespace NewHorizons.Handlers
|
|||||||
var go = new GameObject(body.Config.Name.Replace(" ", "").Replace("'", "") + "_Body");
|
var go = new GameObject(body.Config.Name.Replace(" ", "").Replace("'", "") + "_Body");
|
||||||
go.SetActive(false);
|
go.SetActive(false);
|
||||||
|
|
||||||
if (body.Config.Base.GroundSize != 0)
|
var owRigidBody = RigidBodyBuilder.Make(go, body.Config);
|
||||||
{
|
var ao = AstroObjectBuilder.Make(go, primaryBody, body.Config);
|
||||||
GeometryBuilder.Make(go, body.Config.Base.GroundSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
var atmoSize = body.Config.Atmosphere != null ? body.Config.Atmosphere.Size : 0f;
|
var atmoSize = body.Config.Atmosphere != null ? body.Config.Atmosphere.Size : 0f;
|
||||||
float sphereOfInfluence = Mathf.Max(Mathf.Max(atmoSize, 50), body.Config.Base.SurfaceSize * 2f);
|
float sphereOfInfluence = Mathf.Max(Mathf.Max(atmoSize, 50), body.Config.Base.SurfaceSize * 2f);
|
||||||
@ -243,8 +242,13 @@ namespace NewHorizons.Handlers
|
|||||||
sphereOfInfluence = overrideSOI;
|
sphereOfInfluence = overrideSOI;
|
||||||
}
|
}
|
||||||
|
|
||||||
var owRigidBody = RigidBodyBuilder.Make(go, body.Config);
|
var sector = MakeSector.Make(go, owRigidBody, sphereOfInfluence * 2f);
|
||||||
var ao = AstroObjectBuilder.Make(go, primaryBody, body.Config);
|
ao._rootSector = sector;
|
||||||
|
|
||||||
|
if (body.Config.Base.GroundSize != 0)
|
||||||
|
{
|
||||||
|
GeometryBuilder.Make(go, sector, body.Config.Base.GroundSize);
|
||||||
|
}
|
||||||
|
|
||||||
if (body.Config.Base.SurfaceGravity != 0)
|
if (body.Config.Base.SurfaceGravity != 0)
|
||||||
{
|
{
|
||||||
@ -263,22 +267,19 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
if (body.Config.Base.HasAmbientLight)
|
if (body.Config.Base.HasAmbientLight)
|
||||||
{
|
{
|
||||||
AmbientLightBuilder.Make(go, sphereOfInfluence);
|
AmbientLightBuilder.Make(go, sector, sphereOfInfluence);
|
||||||
}
|
}
|
||||||
|
|
||||||
var sector = MakeSector.Make(go, owRigidBody, sphereOfInfluence * 2f);
|
VolumesBuilder.Make(go, body.Config.Base.SurfaceSize, sphereOfInfluence, !body.Config.Base.IsSatellite);
|
||||||
ao._rootSector = sector;
|
|
||||||
|
|
||||||
VolumesBuilder.Make(go, body.Config.Base.SurfaceSize, sphereOfInfluence, body.Config);
|
|
||||||
|
|
||||||
if (body.Config.HeightMap != null)
|
if (body.Config.HeightMap != null)
|
||||||
{
|
{
|
||||||
HeightMapBuilder.Make(go, body.Config.HeightMap, body.Mod);
|
HeightMapBuilder.Make(go, sector, body.Config.HeightMap, body.Mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Config.ProcGen != null)
|
if (body.Config.ProcGen != null)
|
||||||
{
|
{
|
||||||
ProcGenBuilder.Make(go, body.Config.ProcGen);
|
ProcGenBuilder.Make(go, sector, body.Config.ProcGen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Config.Star != null)
|
if (body.Config.Star != null)
|
||||||
@ -330,13 +331,13 @@ namespace NewHorizons.Handlers
|
|||||||
private static GameObject SharedGenerateBody(NewHorizonsBody body, GameObject go, Sector sector, OWRigidbody rb)
|
private static GameObject SharedGenerateBody(NewHorizonsBody body, GameObject go, Sector sector, OWRigidbody rb)
|
||||||
{
|
{
|
||||||
if (body.Config.Ring != null)
|
if (body.Config.Ring != null)
|
||||||
RingBuilder.Make(go, body.Config.Ring, body.Mod);
|
RingBuilder.Make(go, sector, body.Config.Ring, body.Mod);
|
||||||
|
|
||||||
if (body.Config.AsteroidBelt != null)
|
if (body.Config.AsteroidBelt != null)
|
||||||
AsteroidBeltBuilder.Make(body.Config.Name, body.Config, body.Mod);
|
AsteroidBeltBuilder.Make(body.Config.Name, body.Config, body.Mod);
|
||||||
|
|
||||||
if (body.Config.Base.HasCometTail)
|
if (body.Config.Base.HasCometTail)
|
||||||
CometTailBuilder.Make(go, body.Config, go.GetComponent<AstroObject>().GetPrimaryBody());
|
CometTailBuilder.Make(go, sector, body.Config, go.GetComponent<AstroObject>().GetPrimaryBody());
|
||||||
|
|
||||||
// Backwards compatability
|
// Backwards compatability
|
||||||
if (body.Config.Base.LavaSize != 0)
|
if (body.Config.Base.LavaSize != 0)
|
||||||
@ -366,21 +367,31 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
if (body.Config.Atmosphere != null)
|
if (body.Config.Atmosphere != null)
|
||||||
{
|
{
|
||||||
AirBuilder.Make(go, body.Config.Atmosphere.Size, body.Config.Atmosphere.HasRain, body.Config.Atmosphere.HasOxygen);
|
var airInfo = new AtmosphereModule.AirInfo()
|
||||||
|
{
|
||||||
|
HasOxygen = body.Config.Atmosphere.HasOxygen,
|
||||||
|
IsRaining = body.Config.Atmosphere.HasRain,
|
||||||
|
IsSnowing = body.Config.Atmosphere.HasSnow,
|
||||||
|
Scale = body.Config.Atmosphere.Size
|
||||||
|
};
|
||||||
|
|
||||||
|
var surfaceSize = body.Config.Base.SurfaceSize;
|
||||||
|
|
||||||
|
AirBuilder.Make(go, sector, airInfo);
|
||||||
|
|
||||||
if (body.Config.Atmosphere.Cloud != null)
|
if (body.Config.Atmosphere.Cloud != null)
|
||||||
{
|
{
|
||||||
CloudsBuilder.Make(go, sector, body.Config.Atmosphere, body.Mod);
|
CloudsBuilder.Make(go, sector, body.Config.Atmosphere, body.Mod);
|
||||||
SunOverrideBuilder.Make(go, sector, body.Config.Base.SurfaceSize, body.Config.Atmosphere);
|
SunOverrideBuilder.Make(go, sector, body.Config.Atmosphere, surfaceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Config.Atmosphere.HasRain || body.Config.Atmosphere.HasSnow)
|
if (body.Config.Atmosphere.HasRain || body.Config.Atmosphere.HasSnow)
|
||||||
EffectsBuilder.Make(go, sector, body.Config.Base.SurfaceSize, body.Config.Atmosphere.Size, body.Config.Atmosphere.HasRain, body.Config.Atmosphere.HasSnow);
|
EffectsBuilder.Make(go, sector, airInfo, surfaceSize);
|
||||||
|
|
||||||
if (body.Config.Atmosphere.FogSize != 0)
|
if (body.Config.Atmosphere.FogSize != 0)
|
||||||
FogBuilder.Make(go, sector, body.Config.Atmosphere);
|
FogBuilder.Make(go, sector, body.Config.Atmosphere);
|
||||||
|
|
||||||
AtmosphereBuilder.Make(go, body.Config.Atmosphere, body.Config.Base.SurfaceSize);
|
AtmosphereBuilder.Make(go, sector, body.Config.Atmosphere, surfaceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Config.Props != null)
|
if (body.Config.Props != null)
|
||||||
|
|||||||
@ -9,9 +9,9 @@ using System.Threading.Tasks;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.General
|
namespace NewHorizons.Handlers
|
||||||
{
|
{
|
||||||
static class PlanetDestroyer
|
static class PlanetDestructionHandler
|
||||||
{
|
{
|
||||||
private static readonly string[] _solarSystemBodies = new string[]
|
private static readonly string[] _solarSystemBodies = new string[]
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ namespace NewHorizons.Handlers
|
|||||||
heightMap.TextureMap = body.Config.Atmosphere.Cloud;
|
heightMap.TextureMap = body.Config.Atmosphere.Cloud;
|
||||||
}
|
}
|
||||||
|
|
||||||
HeightMapBuilder.Make(titleScreenGO, heightMap, body.Mod);
|
HeightMapBuilder.Make(titleScreenGO, null, heightMap, body.Mod);
|
||||||
|
|
||||||
GameObject pivot = GameObject.Instantiate(GameObject.Find("Scene/Background/PlanetPivot"), GameObject.Find("Scene/Background").transform);
|
GameObject pivot = GameObject.Instantiate(GameObject.Find("Scene/Background/PlanetPivot"), GameObject.Find("Scene/Background").transform);
|
||||||
pivot.GetComponent<RotateTransform>()._degreesPerSecond = 10f;
|
pivot.GetComponent<RotateTransform>()._degreesPerSecond = 10f;
|
||||||
@ -101,7 +101,7 @@ namespace NewHorizons.Handlers
|
|||||||
newRing.InnerRadius = size * 1.2f;
|
newRing.InnerRadius = size * 1.2f;
|
||||||
newRing.OuterRadius = size * 2f;
|
newRing.OuterRadius = size * 2f;
|
||||||
newRing.Texture = body.Config.Ring.Texture;
|
newRing.Texture = body.Config.Ring.Texture;
|
||||||
var ring = RingBuilder.Make(titleScreenGO, newRing, body.Mod);
|
var ring = RingBuilder.Make(titleScreenGO, null, newRing, body.Mod);
|
||||||
titleScreenGO.transform.localScale = Vector3.one * 0.8f;
|
titleScreenGO.transform.localScale = Vector3.one * 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user