mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge branch 'dev' into height-map-resolution
This commit is contained in:
commit
6c4d4154c1
4
.github/workflows/release_build.yml
vendored
4
.github/workflows/release_build.yml
vendored
@ -22,7 +22,7 @@ on:
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
if: ${{ github.ref == 'refs/heads/main' || (github.event.pull_request.draft == 'false' && contains(github.event.pull_request.labels.*.name, 'update-pr')) }}
|
||||
if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'update-pr') }}
|
||||
uses: ./.github/workflows/build.yaml
|
||||
with:
|
||||
build_type: Release
|
||||
@ -43,7 +43,7 @@ jobs:
|
||||
Update_Release:
|
||||
name: 'Create/Update Release Asset'
|
||||
needs: Build
|
||||
if: ${{ github.ref != 'refs/heads/main' && github.event.pull_request.draft == 'false' && contains(github.event.pull_request.labels.*.name, 'update-pr') }}
|
||||
if: ${{ github.ref != 'refs/heads/main' && contains(github.event.pull_request.labels.*.name, 'update-pr') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download Asset
|
||||
|
||||
2
.github/workflows/update_release.yml
vendored
2
.github/workflows/update_release.yml
vendored
@ -11,7 +11,7 @@ on:
|
||||
jobs:
|
||||
Update_Release:
|
||||
name: Create/Update Release
|
||||
if: ${{ github.event.pull_request.draft == 'false' && contains(github.event.pull_request.labels.*.name, 'update-pr') }}
|
||||
if: contains(github.event.pull_request.labels.*.name, 'update-pr')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create/Update Release
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.External.Modules;
|
||||
using UnityEngine;
|
||||
namespace NewHorizons.Builder.Atmosphere
|
||||
{
|
||||
public static class AirBuilder
|
||||
{
|
||||
public static void Make(GameObject planetGO, Sector sector, AtmosphereModule.AirInfo info)
|
||||
public static void Make(GameObject planetGO, Sector sector, PlanetConfig config)
|
||||
{
|
||||
GameObject airGO = new GameObject("Air");
|
||||
airGO.SetActive(false);
|
||||
@ -13,7 +14,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
|
||||
SphereCollider sc = airGO.AddComponent<SphereCollider>();
|
||||
sc.isTrigger = true;
|
||||
sc.radius = info.scale;
|
||||
sc.radius = config.Atmosphere.size;
|
||||
|
||||
SimpleFluidVolume sfv = airGO.AddComponent<SimpleFluidVolume>();
|
||||
sfv._layer = 5;
|
||||
@ -26,15 +27,29 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
ShockLayerRuleset shockLayerRuleset = planetGO.GetComponentInChildren<PlanetoidRuleset>().gameObject.AddComponent<ShockLayerRuleset>();
|
||||
shockLayerRuleset._type = ShockLayerRuleset.ShockType.Atmospheric;
|
||||
shockLayerRuleset._radialCenter = airGO.transform;
|
||||
shockLayerRuleset._innerRadius = 0;
|
||||
shockLayerRuleset._outerRadius = info.scale;
|
||||
shockLayerRuleset._minShockSpeed = config.Atmosphere.minShockSpeed;
|
||||
shockLayerRuleset._maxShockSpeed = config.Atmosphere.maxShockSpeed;
|
||||
|
||||
if (info.hasOxygen)
|
||||
if (config.Atmosphere.clouds != null)
|
||||
{
|
||||
shockLayerRuleset._innerRadius = config.Atmosphere.clouds.innerCloudRadius;
|
||||
shockLayerRuleset._outerRadius = config.Atmosphere.clouds.outerCloudRadius;
|
||||
}
|
||||
else
|
||||
{
|
||||
var bottom = config.Base.surfaceSize;
|
||||
var top = config.Atmosphere.size;
|
||||
|
||||
shockLayerRuleset._innerRadius = (bottom + top) / 2f;
|
||||
shockLayerRuleset._outerRadius = top;
|
||||
}
|
||||
|
||||
if (config.Atmosphere.hasOxygen)
|
||||
{
|
||||
airGO.AddComponent<OxygenVolume>();
|
||||
}
|
||||
|
||||
if (info.isRaining)
|
||||
if (config.Atmosphere.hasRain)
|
||||
{
|
||||
var vref = airGO.AddComponent<VisorRainEffectVolume>();
|
||||
vref._rainDirection = VisorRainEffectVolume.RainDirection.Radial;
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.Utility;
|
||||
using UnityEngine;
|
||||
namespace NewHorizons.Builder.Atmosphere
|
||||
{
|
||||
public static class EffectsBuilder
|
||||
{
|
||||
public static void Make(GameObject planetGO, Sector sector, AtmosphereModule.AirInfo info, float surfaceSize)
|
||||
public static void Make(GameObject planetGO, Sector sector, PlanetConfig config, float surfaceSize)
|
||||
{
|
||||
GameObject effectsGO = new GameObject("Effects");
|
||||
effectsGO.SetActive(false);
|
||||
@ -19,7 +20,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
SCG._dynamicCullingBounds = false;
|
||||
SCG._waitForStreaming = false;
|
||||
|
||||
if (info.isRaining)
|
||||
if (config.Atmosphere.hasRain)
|
||||
{
|
||||
var rainGO = GameObject.Instantiate(SearchUtilities.Find("GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/Effects_GD_Rain"), effectsGO.transform);
|
||||
rainGO.transform.position = planetGO.transform.position;
|
||||
@ -29,7 +30,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
{
|
||||
new Keyframe(surfaceSize - 0.5f, 0),
|
||||
new Keyframe(surfaceSize, 10f),
|
||||
new Keyframe(info.scale, 0f)
|
||||
new Keyframe(config.Atmosphere.size, 0f)
|
||||
});
|
||||
|
||||
rainGO.GetComponent<PlanetaryVectionController>()._activeInSector = sector;
|
||||
@ -37,7 +38,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
rainGO.SetActive(true);
|
||||
}
|
||||
|
||||
if (info.isSnowing)
|
||||
if (config.Atmosphere.hasSnow)
|
||||
{
|
||||
var snowGO = new GameObject("SnowEffects");
|
||||
snowGO.transform.parent = effectsGO.transform;
|
||||
@ -53,7 +54,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
{
|
||||
new Keyframe(surfaceSize - 0.5f, 0),
|
||||
new Keyframe(surfaceSize, 10f),
|
||||
new Keyframe(info.scale, 0f)
|
||||
new Keyframe(config.Atmosphere.size, 0f)
|
||||
});
|
||||
|
||||
snowEmitter.GetComponent<PlanetaryVectionController>()._activeInSector = sector;
|
||||
|
||||
@ -7,6 +7,13 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
{
|
||||
private static Texture2D _ramp;
|
||||
|
||||
private static readonly int FogTexture = Shader.PropertyToID("_FogTex");
|
||||
private static readonly int Tint = Shader.PropertyToID("_Tint");
|
||||
private static readonly int Radius = Shader.PropertyToID("_Radius");
|
||||
private static readonly int Density = Shader.PropertyToID("_Density");
|
||||
private static readonly int DensityExponent = Shader.PropertyToID("_DensityExp");
|
||||
private static readonly int ColorRampTexture = Shader.PropertyToID("_ColorRampTex");
|
||||
|
||||
public static void Make(GameObject planetGO, Sector sector, AtmosphereModule atmo)
|
||||
{
|
||||
if (_ramp == null) _ramp = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/FogColorRamp.png");
|
||||
@ -14,7 +21,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
GameObject fogGO = new GameObject("FogSphere");
|
||||
fogGO.SetActive(false);
|
||||
fogGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
fogGO.transform.localScale = Vector3.one;
|
||||
fogGO.transform.localScale = Vector3.one * atmo.fogSize;
|
||||
|
||||
// Going to copy from dark bramble
|
||||
var dbFog = SearchUtilities.Find("DarkBramble_Body/Atmosphere_DB/FogLOD");
|
||||
@ -28,14 +35,23 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
MR.allowOcclusionWhenDynamic = true;
|
||||
|
||||
PlanetaryFogController PFC = fogGO.AddComponent<PlanetaryFogController>();
|
||||
PFC._fogImpostor = MR;
|
||||
PFC.fogLookupTexture = dbPlanetaryFogController.fogLookupTexture;
|
||||
PFC.fogRadius = atmo.fogSize;
|
||||
PFC.lodFadeDistance = PFC.fogRadius * 0.5f;
|
||||
PFC.fogDensity = atmo.fogDensity;
|
||||
PFC.fogExponent = 1f;
|
||||
PFC.fogColorRampTexture = atmo.fogTint == null ? _ramp : ImageUtilities.TintImage(_ramp, atmo.fogTint.ToColor());
|
||||
var colorRampTexture = atmo.fogTint == null ? _ramp : ImageUtilities.TintImage(_ramp, atmo.fogTint.ToColor());
|
||||
PFC.fogColorRampTexture = colorRampTexture;
|
||||
PFC.fogColorRampIntensity = 1f;
|
||||
PFC.fogTint = atmo.fogTint.ToColor();
|
||||
|
||||
MR.material.SetColor(Tint, atmo.fogTint.ToColor());
|
||||
MR.material.SetFloat(Radius, atmo.fogSize);
|
||||
MR.material.SetFloat(Density, atmo.fogDensity);
|
||||
MR.material.SetFloat(DensityExponent, 1);
|
||||
MR.material.SetTexture(ColorRampTexture, colorRampTexture);
|
||||
|
||||
fogGO.transform.position = planetGO.transform.position;
|
||||
|
||||
fogGO.SetActive(true);
|
||||
|
||||
@ -235,6 +235,11 @@ namespace NewHorizons.Builder.Body
|
||||
fog._fogRadius *= scale;
|
||||
fog._fogDensity *= scale;
|
||||
|
||||
var volumesShape = volumes.FindChild("ZeroG_Fluid_Audio_Volume");
|
||||
var sphereShape = volumesShape.GetComponent<SphereShape>();
|
||||
sphereShape.enabled = true; // this starts disabled for some fucking reason
|
||||
sphereShape.radius *= scale;
|
||||
|
||||
// Change fog color
|
||||
if (body.Config.Bramble.dimension.fogTint != null)
|
||||
{
|
||||
@ -248,7 +253,13 @@ namespace NewHorizons.Builder.Body
|
||||
var cloak = repelVolume.gameObject.GetComponentInChildren<DarkBrambleCloakSphere>();
|
||||
cloak.transform.localScale = Vector3.one * 4000f;
|
||||
cloak._sectors = new Sector[] { sector };
|
||||
cloak.GetComponent<Renderer>().enabled = true;
|
||||
|
||||
// fix the fog backdrop
|
||||
atmo.GetComponent<SectorCullGroup>()._sector = sector;
|
||||
atmo.GetComponent<SectorLightsCullGroup>()._sector = sector;
|
||||
|
||||
// finalize
|
||||
atmo.SetActive(true);
|
||||
volumes.SetActive(true);
|
||||
effects.SetActive(true);
|
||||
|
||||
@ -16,8 +16,6 @@ namespace NewHorizons.Builder.Body
|
||||
private static Texture2D _colorOverTime;
|
||||
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
|
||||
private static readonly int SkyColor = Shader.PropertyToID("_SkyColor");
|
||||
private static readonly int AtmosFar = Shader.PropertyToID("_AtmosFar");
|
||||
private static readonly int AtmosNear = Shader.PropertyToID("_AtmosNear");
|
||||
private static readonly int Tint = Shader.PropertyToID("_Tint");
|
||||
private static readonly int Radius = Shader.PropertyToID("_Radius");
|
||||
private static readonly int InnerRadius = Shader.PropertyToID("_InnerRadius");
|
||||
@ -54,8 +52,6 @@ namespace NewHorizons.Builder.Body
|
||||
foreach (var lod in sunAtmosphere.transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>())
|
||||
{
|
||||
lod.material.SetColor(SkyColor, starModule.tint.ToColor());
|
||||
lod.material.SetColor(AtmosFar, starModule.tint.ToColor());
|
||||
lod.material.SetColor(AtmosNear, starModule.tint.ToColor());
|
||||
lod.material.SetFloat(InnerRadius, starModule.size);
|
||||
lod.material.SetFloat(OuterRadius, starModule.size * OuterRadiusRatio);
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ namespace NewHorizons.Components
|
||||
|
||||
public int GetRandomNewState()
|
||||
{
|
||||
var range = Enumerable.Range(0, states.Count - 1).Where(i => i != CurrentIndex);
|
||||
var range = Enumerable.Range(0, states.Count).Where(i => i != CurrentIndex);
|
||||
var index = Random.Range(0, range.Count());
|
||||
return range.ElementAt(index);
|
||||
}
|
||||
|
||||
@ -55,6 +55,8 @@ namespace NewHorizons.Components.SizeControllers
|
||||
private float maxScale;
|
||||
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
|
||||
|
||||
private Color _currentColour;
|
||||
|
||||
void Start()
|
||||
{
|
||||
var sun = GameObject.FindObjectOfType<SunController>();
|
||||
@ -114,7 +116,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
_atmosphereRenderers = atmosphere?.transform?.Find("AtmoSphere")?.GetComponentsInChildren<MeshRenderer>();
|
||||
}
|
||||
|
||||
if (WillExplode) GlobalMessenger.AddListener("TriggerSupernova", Die);
|
||||
if (WillExplode) GlobalMessenger.AddListener("TriggerSupernova", StartCollapse);
|
||||
|
||||
if (scaleCurve != null)
|
||||
{
|
||||
@ -132,7 +134,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
if (WillExplode) GlobalMessenger.RemoveListener("TriggerSupernova", Die);
|
||||
if (WillExplode) GlobalMessenger.RemoveListener("TriggerSupernova", StartCollapse);
|
||||
}
|
||||
|
||||
public void SetProxy(StarEvolutionController proxy)
|
||||
@ -141,86 +143,109 @@ namespace NewHorizons.Components.SizeControllers
|
||||
_proxy.supernova.SetIsProxy(true);
|
||||
}
|
||||
|
||||
public void Die()
|
||||
private void UpdateMainSequence()
|
||||
{
|
||||
// Only do colour transition stuff if they set an end colour
|
||||
if (EndColour != null)
|
||||
{
|
||||
// Use the age if theres no resizing happening, else make it get redder the larger it is or wtv
|
||||
var t = _age / (lifespan * 60f);
|
||||
if (maxScale > 0) t = CurrentScale / maxScale;
|
||||
if (t < 1f)
|
||||
{
|
||||
_currentColour = Color.Lerp(_startColour, _endColour, t);
|
||||
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentColour = _endColour;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentColour = _startColour;
|
||||
}
|
||||
|
||||
if (_flareEmitter != null) _flareEmitter._tint = _currentColour;
|
||||
}
|
||||
|
||||
private void UpdateCollapse()
|
||||
{
|
||||
// When its collapsing we directly take over the scale
|
||||
var t = _collapseTimer / collapseTime;
|
||||
CurrentScale = Mathf.Lerp(_collapseStartSize, 0, t);
|
||||
transform.localScale = Vector3.one * CurrentScale;
|
||||
_collapseTimer += Time.deltaTime;
|
||||
|
||||
_currentColour = Color.Lerp(_endColour, Color.white, t);
|
||||
|
||||
supernova._surface._materials[0].Lerp(_collapseStartSurfaceMaterial, _collapseEndSurfaceMaterial, t);
|
||||
|
||||
// After the collapse is done we go supernova
|
||||
if (_collapseTimer > collapseTime) StartSupernova();
|
||||
}
|
||||
|
||||
private void UpdateSupernova()
|
||||
{
|
||||
// Reset the scale back to normal bc now its just the supernova scaling itself + destruction and heat volumes
|
||||
transform.localScale = Vector3.one;
|
||||
|
||||
// Make the destruction volume scale slightly smaller so you really have to be in the supernova to die
|
||||
if (_destructionVolume != null) _destructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f;
|
||||
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius();
|
||||
|
||||
if (Time.time > _supernovaStartTime + 45f)
|
||||
{
|
||||
// Just turn off the star entirely
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartCollapse()
|
||||
{
|
||||
Logger.LogVerbose($"{gameObject.transform.root.name} started collapse");
|
||||
|
||||
_isCollapsing = true;
|
||||
_collapseStartSize = CurrentScale;
|
||||
_collapseTimer = 0f;
|
||||
supernova._surface._materials[0].CopyPropertiesFromMaterial(_collapseStartSurfaceMaterial);
|
||||
|
||||
if (_proxy != null) _proxy.Die();
|
||||
if (_proxy != null) _proxy.StartCollapse();
|
||||
}
|
||||
|
||||
private void StartSupernova()
|
||||
{
|
||||
Logger.LogVerbose($"{gameObject.transform.root.name} started supernova");
|
||||
|
||||
SupernovaStart.Invoke();
|
||||
supernova.enabled = true;
|
||||
_isSupernova = true;
|
||||
_supernovaStartTime = Time.time;
|
||||
if (atmosphere != null) atmosphere.SetActive(false);
|
||||
if (_destructionVolume != null) _destructionVolume._deathType = DeathType.Supernova;
|
||||
}
|
||||
|
||||
protected new void FixedUpdate()
|
||||
{
|
||||
_age += Time.deltaTime;
|
||||
|
||||
var ageValue = _age / (lifespan * 60f);
|
||||
|
||||
// If we've gone supernova and its been 45 seconds that means it has faded out and is gone
|
||||
// The 45 is from the animation curve used for the supernova alpha
|
||||
if (_isSupernova)
|
||||
{
|
||||
// Reset the scale back to normal bc now its just the supernova scaling itself + destruction and heat volumes
|
||||
transform.localScale = Vector3.one;
|
||||
|
||||
// Make the destruction volume scale slightly smaller so you really have to be in the supernova to die
|
||||
if (_destructionVolume != null) _destructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f;
|
||||
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius();
|
||||
|
||||
if (Time.time > _supernovaStartTime + 45f)
|
||||
{
|
||||
// Just turn off the star entirely
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
UpdateSupernova();
|
||||
return;
|
||||
}
|
||||
|
||||
Color currentColour;
|
||||
|
||||
if (!_isCollapsing)
|
||||
{
|
||||
base.FixedUpdate();
|
||||
|
||||
// Only do colour transition stuff if they set an end colour
|
||||
if (EndColour != null)
|
||||
{
|
||||
// Use the age if theres no resizing happening, else make it get redder the larger it is or wtv
|
||||
var t = ageValue;
|
||||
if (maxScale > 0) t = CurrentScale / maxScale;
|
||||
currentColour = Color.Lerp(_startColour, _endColour, t);
|
||||
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentColour = _startColour;
|
||||
}
|
||||
|
||||
if (_flareEmitter != null) _flareEmitter._tint = currentColour;
|
||||
UpdateMainSequence();
|
||||
}
|
||||
else
|
||||
{
|
||||
// When its collapsing we directly take over the scale
|
||||
var t = _collapseTimer / collapseTime;
|
||||
CurrentScale = Mathf.Lerp(_collapseStartSize, 0, t);
|
||||
transform.localScale = Vector3.one * CurrentScale;
|
||||
_collapseTimer += Time.deltaTime;
|
||||
|
||||
currentColour = Color.Lerp(_endColour, Color.white, t);
|
||||
|
||||
supernova._surface._materials[0].Lerp(_collapseStartSurfaceMaterial, _collapseEndSurfaceMaterial, t);
|
||||
|
||||
// After the collapse is done we go supernova
|
||||
if (_collapseTimer > collapseTime)
|
||||
{
|
||||
SupernovaStart.Invoke();
|
||||
supernova.enabled = true;
|
||||
_isSupernova = true;
|
||||
_supernovaStartTime = Time.time;
|
||||
if (atmosphere != null) atmosphere.SetActive(false);
|
||||
if (_destructionVolume != null) _destructionVolume._deathType = DeathType.Supernova;
|
||||
return;
|
||||
}
|
||||
UpdateCollapse();
|
||||
if (_isSupernova) return;
|
||||
}
|
||||
|
||||
// This is just all the scales stuff for the atmosphere effects
|
||||
@ -230,8 +255,8 @@ namespace NewHorizons.Components.SizeControllers
|
||||
_fog.lodFadeDistance = CurrentScale * StarBuilder.OuterRadiusRatio / 3f;
|
||||
|
||||
// The colour thing goes over one
|
||||
var max = Math.Max(currentColour.g, Math.Max(currentColour.b, currentColour.r));
|
||||
var fogColour = currentColour / max / 1.5f;
|
||||
var max = Math.Max(_currentColour.g, Math.Max(_currentColour.b, _currentColour.r));
|
||||
var fogColour = _currentColour / max / 1.5f;
|
||||
fogColour.a = 1f;
|
||||
_fog.fogTint = fogColour;
|
||||
_fog._fogTint = fogColour;
|
||||
@ -243,9 +268,9 @@ namespace NewHorizons.Components.SizeControllers
|
||||
{
|
||||
lod.material.SetFloat("_InnerRadius", CurrentScale);
|
||||
lod.material.SetFloat("_OuterRadius", CurrentScale * StarBuilder.OuterRadiusRatio);
|
||||
lod.material.SetColor("_AtmosFar", currentColour);
|
||||
lod.material.SetColor("_AtmosNear", currentColour);
|
||||
lod.material.SetColor("_SkyColor", currentColour);
|
||||
|
||||
// These break once it reaches endColour and I have no idea why
|
||||
//lod.material.SetColor("_SkyColor", _currentColour);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
97
NewHorizons/External/Configs/PlanetConfig.cs
vendored
97
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -182,6 +182,54 @@ namespace NewHorizons.External.Configs
|
||||
if (Atmosphere?.clouds?.lightningGradient != null) Atmosphere.clouds.hasLightning = true;
|
||||
if (Bramble?.dimension != null && Orbit?.staticPosition == null) throw new Exception($"Dimension {name} must have Orbit.staticPosition defined.");
|
||||
if (Orbit?.staticPosition != null) Orbit.isStatic = true;
|
||||
|
||||
// For each quantum group, verify the following:
|
||||
// this group's id should be unique
|
||||
// if type == sockets, group.sockets should not be null or empty
|
||||
// if type == sockets, count every prop that references this group. the number should be < group.sockets.Count
|
||||
// if type == sockets, for each socket, if rotation == null, rotation = Vector3.zero
|
||||
// if type == sockets, for each socket, position must not be null
|
||||
// For each detail prop,
|
||||
// if detail.quantumGroupID != null, there exists a quantum group with that id
|
||||
if (Props?.quantumGroups != null && Props?.details != null)
|
||||
{
|
||||
Dictionary<string, PropModule.QuantumGroupInfo> existingGroups = new Dictionary<string, PropModule.QuantumGroupInfo>();
|
||||
foreach (var quantumGroup in Props.quantumGroups)
|
||||
{
|
||||
if (existingGroups.ContainsKey(quantumGroup.id)) { Logger.LogWarning($"Duplicate quantumGroup id found: {quantumGroup.id}"); quantumGroup.type = PropModule.QuantumGroupType.FailedValidation; }
|
||||
|
||||
existingGroups[quantumGroup.id] = quantumGroup;
|
||||
if (quantumGroup.type == PropModule.QuantumGroupType.Sockets)
|
||||
{
|
||||
if (quantumGroup.sockets?.Length == 0) { Logger.LogError($"quantumGroup {quantumGroup.id} is of type \"sockets\" but has no defined sockets."); quantumGroup.type = PropModule.QuantumGroupType.FailedValidation; }
|
||||
else
|
||||
{
|
||||
foreach (var socket in quantumGroup.sockets)
|
||||
{
|
||||
if (socket.rotation == null) socket.rotation = UnityEngine.Vector3.zero;
|
||||
if (socket.position == null) { Logger.LogError($"quantumGroup {quantumGroup.id} has a socket without a position."); quantumGroup.type = PropModule.QuantumGroupType.FailedValidation; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<string, int> existingGroupsPropCounts = new Dictionary<string, int>();
|
||||
foreach (var prop in Props?.details)
|
||||
{
|
||||
if (prop.quantumGroupID == null) continue;
|
||||
if (!existingGroups.ContainsKey(prop.quantumGroupID)) Logger.LogWarning($"A prop wants to be a part of quantum group {prop.quantumGroupID}, but this group does not exist.");
|
||||
else existingGroupsPropCounts[prop.quantumGroupID] = existingGroupsPropCounts.GetValueOrDefault(prop.quantumGroupID) + 1;
|
||||
}
|
||||
|
||||
foreach (var quantumGroup in Props.quantumGroups)
|
||||
{
|
||||
if (quantumGroup.type == PropModule.QuantumGroupType.Sockets && existingGroupsPropCounts.GetValueOrDefault(quantumGroup.id) >= quantumGroup.sockets?.Length)
|
||||
{
|
||||
Logger.LogError($"quantumGroup {quantumGroup.id} is of type \"sockets\" and has more props than sockets.");
|
||||
quantumGroup.type = PropModule.QuantumGroupType.FailedValidation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Migrate()
|
||||
@ -258,55 +306,6 @@ namespace NewHorizons.External.Configs
|
||||
|
||||
if (Base.sphereOfInfluence != 0f) Base.soiOverride = Base.sphereOfInfluence;
|
||||
|
||||
// for each quantum group, verify the following:
|
||||
// this group's id should be unique
|
||||
// if type == sockets, group.sockets should not be null or empty
|
||||
// if type == sockets, count every prop that references this group. the number should be < group.sockets.Count
|
||||
// if type == sockets, for each socket, if rotation == null, rotation = Vector3.zero
|
||||
// if type == sockets, for each socket, position must not be null
|
||||
// for each detail prop,
|
||||
// if detail.quantumGroupID != null, there exists a quantum group with that id
|
||||
|
||||
if (Props?.quantumGroups != null && Props?.details != null)
|
||||
{
|
||||
Dictionary<string, PropModule.QuantumGroupInfo> existingGroups = new Dictionary<string, PropModule.QuantumGroupInfo>();
|
||||
foreach (var quantumGroup in Props.quantumGroups)
|
||||
{
|
||||
if (existingGroups.ContainsKey(quantumGroup.id)) { NewHorizons.Utility.Logger.LogWarning($"Duplicate quantumGroup id found: {quantumGroup.id}"); quantumGroup.type = PropModule.QuantumGroupType.FailedValidation; }
|
||||
|
||||
existingGroups[quantumGroup.id] = quantumGroup;
|
||||
if (quantumGroup.type == PropModule.QuantumGroupType.Sockets)
|
||||
{
|
||||
if (quantumGroup.sockets?.Length == 0) { NewHorizons.Utility.Logger.LogError($"quantumGroup {quantumGroup.id} is of type \"sockets\" but has no defined sockets."); quantumGroup.type = PropModule.QuantumGroupType.FailedValidation; }
|
||||
else
|
||||
{
|
||||
foreach (var socket in quantumGroup.sockets)
|
||||
{
|
||||
if (socket.rotation == null) socket.rotation = UnityEngine.Vector3.zero;
|
||||
if (socket.position == null) { NewHorizons.Utility.Logger.LogError($"quantumGroup {quantumGroup.id} has a socket without a position."); quantumGroup.type = PropModule.QuantumGroupType.FailedValidation; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<string, int> existingGroupsPropCounts = new Dictionary<string, int>();
|
||||
foreach (var prop in Props?.details)
|
||||
{
|
||||
if (prop.quantumGroupID == null) continue;
|
||||
if (!existingGroups.ContainsKey(prop.quantumGroupID)) NewHorizons.Utility.Logger.LogWarning($"A prop wants to be a part of quantum group {prop.quantumGroupID}, but this group does not exist.");
|
||||
else existingGroupsPropCounts[prop.quantumGroupID] = existingGroupsPropCounts.GetValueOrDefault(prop.quantumGroupID)+1;
|
||||
}
|
||||
|
||||
foreach (var quantumGroup in Props.quantumGroups)
|
||||
{
|
||||
if (quantumGroup.type == PropModule.QuantumGroupType.Sockets && existingGroupsPropCounts.GetValueOrDefault(quantumGroup.id) >= quantumGroup.sockets?.Length)
|
||||
{
|
||||
NewHorizons.Utility.Logger.LogError($"quantumGroup {quantumGroup.id} is of type \"sockets\" and has more props than sockets.");
|
||||
quantumGroup.type = PropModule.QuantumGroupType.FailedValidation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Moved a bunch of stuff off of shiplog module to star system module because it didnt exist when we made this
|
||||
if (ShipLog != null)
|
||||
{
|
||||
|
||||
17
NewHorizons/External/Modules/AtmosphereModule.cs
vendored
17
NewHorizons/External/Modules/AtmosphereModule.cs
vendored
@ -86,14 +86,15 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public bool useAtmosphereShader;
|
||||
|
||||
// not an actual config thing, rip
|
||||
public class AirInfo
|
||||
{
|
||||
public bool hasOxygen;
|
||||
public bool isRaining;
|
||||
public bool isSnowing;
|
||||
public float scale;
|
||||
}
|
||||
/// <summary>
|
||||
/// Minimum speed that your ship can go in the atmosphere where flames will appear.
|
||||
/// </summary>
|
||||
[DefaultValue(100f)] public float minShockSpeed = 100f;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum speed that your ship can go in the atmosphere where flames will appear at their brightest.
|
||||
/// </summary>
|
||||
[DefaultValue(300f)] public float maxShockSpeed = 300f;
|
||||
|
||||
[JsonObject]
|
||||
public class CloudInfo
|
||||
|
||||
@ -529,17 +529,9 @@ namespace NewHorizons.Handlers
|
||||
|
||||
if (body.Config.Atmosphere != null)
|
||||
{
|
||||
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);
|
||||
AirBuilder.Make(go, sector, body.Config);
|
||||
|
||||
if (!string.IsNullOrEmpty(body.Config.Atmosphere?.clouds?.texturePath))
|
||||
{
|
||||
@ -548,7 +540,7 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
|
||||
if (body.Config.Atmosphere.hasRain || body.Config.Atmosphere.hasSnow)
|
||||
EffectsBuilder.Make(go, sector, airInfo, surfaceSize);
|
||||
EffectsBuilder.Make(go, sector, body.Config, surfaceSize);
|
||||
|
||||
if (body.Config.Atmosphere.fogSize != 0)
|
||||
FogBuilder.Make(go, sector, body.Config.Atmosphere);
|
||||
|
||||
31
NewHorizons/Patches/BramblePatches.cs
Normal file
31
NewHorizons/Patches/BramblePatches.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NewHorizons.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class BramblePatches
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SphericalFogWarpVolume), nameof(SphericalFogWarpVolume.IsProbeOnly))]
|
||||
public static bool SphericalFogWarpVolume_IsProbeOnly(SphericalFogWarpVolume __instance, ref bool __result)
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(FogWarpVolume), nameof(FogWarpVolume.GetFogThickness))]
|
||||
public static bool FogWarpVolume_GetFogThickness(FogWarpVolume __instance, ref float __result)
|
||||
{
|
||||
if (__instance is InnerFogWarpVolume sph) __result = sph._exitRadius;
|
||||
else __result = 50; // 50f is hardcoded as the return value in the base game
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -286,6 +286,18 @@
|
||||
"useAtmosphereShader": {
|
||||
"type": "boolean",
|
||||
"description": "Whether we use an atmospheric shader on the planet. Doesn't affect clouds, fog, rain, snow, oxygen, etc. Purely\nvisual."
|
||||
},
|
||||
"minShockSpeed": {
|
||||
"type": "number",
|
||||
"description": "Minimum speed that your ship can go in the atmosphere where flames will appear.",
|
||||
"format": "float",
|
||||
"default": 100.0
|
||||
},
|
||||
"maxShockSpeed": {
|
||||
"type": "number",
|
||||
"description": "Maximum speed that your ship can go in the atmosphere where flames will appear at their brightest.",
|
||||
"format": "float",
|
||||
"default": 300.0
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user