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
081967670b
@ -10,117 +10,6 @@ using Logger = NewHorizons.Utility.Logger;
|
|||||||
|
|
||||||
namespace NewHorizons.Builder.Body
|
namespace NewHorizons.Builder.Body
|
||||||
{
|
{
|
||||||
[HarmonyPatch]
|
|
||||||
static class Patch
|
|
||||||
{
|
|
||||||
// SkinnedMeshRenderer.SetBlendShapeWeight
|
|
||||||
[HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(PlayerFogWarpDetector), nameof(PlayerFogWarpDetector.LateUpdate))]
|
|
||||||
public static bool LateUpdate(PlayerFogWarpDetector __instance)
|
|
||||||
{
|
|
||||||
// if (PlanetaryFogController.GetActiveFogSphere() == null)
|
|
||||||
//{
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
float num = __instance._targetFogFraction;
|
|
||||||
if (PlayerState.IsInsideShip())
|
|
||||||
{
|
|
||||||
num = Mathf.Max(__instance._shipFogDetector.GetTargetFogFraction(), num);
|
|
||||||
}
|
|
||||||
if (num < __instance._fogFraction)
|
|
||||||
{
|
|
||||||
float num2 = (__instance._closestFogWarp.UseFastFogFade() ? 1f : 0.2f);
|
|
||||||
__instance._fogFraction = Mathf.MoveTowards(__instance._fogFraction, num, Time.deltaTime * num2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
__instance._fogFraction = num;
|
|
||||||
}
|
|
||||||
if (__instance._targetFogColorWarpVolume != __instance._closestFogWarp)
|
|
||||||
{
|
|
||||||
__instance._targetFogColorWarpVolume = __instance._closestFogWarp;
|
|
||||||
__instance._startColorCrossfadeTime = Time.time;
|
|
||||||
__instance._startCrossfadeColor = __instance._fogColor;
|
|
||||||
}
|
|
||||||
if (__instance._targetFogColorWarpVolume != null)
|
|
||||||
{
|
|
||||||
Color fogColor = __instance._targetFogColorWarpVolume.GetFogColor();
|
|
||||||
if (__instance._fogFraction <= 0f)
|
|
||||||
{
|
|
||||||
__instance._fogColor = fogColor;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float t = Mathf.InverseLerp(__instance._startColorCrossfadeTime, __instance._startColorCrossfadeTime + 1f, Time.time);
|
|
||||||
__instance._fogColor = Color.Lerp(__instance._startCrossfadeColor, fogColor, t);
|
|
||||||
}
|
|
||||||
__instance._fogColor = new Color(__instance._fogColor.r, __instance._fogColor.g, __instance._fogColor.b);
|
|
||||||
}
|
|
||||||
if (__instance._playerEffectBubbleController != null)
|
|
||||||
{
|
|
||||||
__instance._playerEffectBubbleController.SetFogFade(__instance._fogFraction, __instance._fogColor);
|
|
||||||
}
|
|
||||||
if (__instance._shipLandingCamEffectBubbleController != null)
|
|
||||||
{
|
|
||||||
__instance._shipLandingCamEffectBubbleController.SetFogFade(__instance._fogFraction, __instance._fogColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// FogWarpBubbleController.SetFogFade
|
|
||||||
[HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(FogWarpEffectBubbleController), nameof(FogWarpEffectBubbleController.SetFogFade))]
|
|
||||||
public static bool FogWarpBubbleController_SetFogFade(FogWarpEffectBubbleController __instance, float fogAlpha, Color fogColor)
|
|
||||||
{
|
|
||||||
if (__instance._effectBubbleRenderer.sharedMaterial != null)
|
|
||||||
{
|
|
||||||
Color value = fogColor;
|
|
||||||
value.a = fogAlpha;
|
|
||||||
__instance._matPropBlock.SetColor(__instance._propID_Color, value);
|
|
||||||
__instance._effectBubbleRenderer.SetPropertyBlock(__instance._matPropBlock);
|
|
||||||
}
|
|
||||||
__instance._visible = __instance._effectBubbleRenderer.sharedMaterial != null && fogAlpha > 0f;
|
|
||||||
if (__instance._targetCamera == null)
|
|
||||||
{
|
|
||||||
__instance._effectBubbleRenderer.enabled = __instance._visible;
|
|
||||||
Logger.Log($"Setting camera effect renderer to {__instance._visible}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logger.Log($"{__instance.gameObject.transform.GetPath()} _visible: {__instance._visible} set alpha to {fogAlpha} and set color ot {fogColor}");
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// note: I would just make this a one line postfix function, but CheckWarpProximity() does extra stuff that we really don't want to run twice
|
|
||||||
// so we have to completely override this function to support scaling ;-;
|
|
||||||
[HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(FogWarpDetector), nameof(FogWarpDetector.FixedUpdate))]
|
|
||||||
public static void FixedUpdate(FogWarpDetector __instance)
|
|
||||||
{
|
|
||||||
__instance._targetFogFraction = 0f;
|
|
||||||
__instance._closestFogWarp = null;
|
|
||||||
float num = float.PositiveInfinity;
|
|
||||||
for (int i = 0; i < __instance._warpVolumes.Count; i++)
|
|
||||||
{
|
|
||||||
if (!__instance._warpVolumes[i].IsProbeOnly() || __instance._name == FogWarpDetector.Name.Probe)
|
|
||||||
{
|
|
||||||
FogWarpVolume fogWarpVolume = __instance._warpVolumes[i];
|
|
||||||
float num2 = Mathf.Abs(fogWarpVolume.CheckWarpProximity(__instance));
|
|
||||||
float b = Mathf.Clamp01(1f - Mathf.Abs(num2) / fogWarpVolume.GetFogThickness());
|
|
||||||
__instance._targetFogFraction = Mathf.Max(__instance._targetFogFraction, b);
|
|
||||||
if (num2 < num)
|
|
||||||
{
|
|
||||||
num = num2;
|
|
||||||
__instance._closestFogWarp = fogWarpVolume;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: in order to fix fog screen effect for scaling nodes, I need to replace all InnerFogWarpVolume and OuterFogWarpVolume instances with NHInner/OuterFogWarpVolume and on those two classes, implement GetFogThickness(){ return 50*scale; }}
|
// TODO: in order to fix fog screen effect for scaling nodes, I need to replace all InnerFogWarpVolume and OuterFogWarpVolume instances with NHInner/OuterFogWarpVolume and on those two classes, implement GetFogThickness(){ return 50*scale; }}
|
||||||
// TODO: StreamingHandler.SetUpStreaming() for all FogWarpEffectBubbleController objects
|
// TODO: StreamingHandler.SetUpStreaming() for all FogWarpEffectBubbleController objects
|
||||||
// TODO: add the "don't see me" effect
|
// TODO: add the "don't see me" effect
|
||||||
@ -194,6 +83,24 @@ namespace NewHorizons.Builder.Body
|
|||||||
repelVolume.transform.parent = sector.transform;
|
repelVolume.transform.parent = sector.transform;
|
||||||
repelVolume.transform.localPosition = Vector3.zero;
|
repelVolume.transform.localPosition = Vector3.zero;
|
||||||
|
|
||||||
|
// remove default vines
|
||||||
|
var geoBatchedGroup = geometry.FindChild("BatchedGroup");
|
||||||
|
var collider = geoBatchedGroup.FindChild("BatchedMeshColliders_1");
|
||||||
|
collider.transform.parent = geometry.transform;
|
||||||
|
GameObject.Destroy(geoBatchedGroup);
|
||||||
|
|
||||||
|
var geoOtherComponentsGroup = geometry.FindChild("OtherComponentsGroup");
|
||||||
|
var dimensionWalls = geoOtherComponentsGroup.FindChild("Terrain_DB_BrambleSphere_Outer_v2");
|
||||||
|
dimensionWalls.transform.parent = geometry.transform;
|
||||||
|
GameObject.Destroy(geoOtherComponentsGroup);
|
||||||
|
|
||||||
|
// fix some cull groups
|
||||||
|
volumes.GetComponent<SectorCollisionGroup>()._sector = sector;
|
||||||
|
volumes.FindChild("SunOverrideVolume").GetComponent<SunOverrideVolume>()._sector = sector;
|
||||||
|
effects.GetComponent<SectorCullGroup>()._sector = sector;
|
||||||
|
atmo.GetComponent<SectorCullGroup>()._sector = sector;
|
||||||
|
atmo.GetComponent<SectorLightsCullGroup>()._sector = sector;
|
||||||
|
|
||||||
// Set up rulesets
|
// Set up rulesets
|
||||||
var thrustRuleset = sector.gameObject.AddComponent<ThrustRuleset>();
|
var thrustRuleset = sector.gameObject.AddComponent<ThrustRuleset>();
|
||||||
thrustRuleset._attachedBody = owRigidBody;
|
thrustRuleset._attachedBody = owRigidBody;
|
||||||
@ -224,6 +131,19 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
PairExit(config.linksTo, outerFogWarpVolume);
|
PairExit(config.linksTo, outerFogWarpVolume);
|
||||||
|
|
||||||
|
// If the config says only certain entrances are allowed, enforce that
|
||||||
|
if (config.allowedEntrances != null)
|
||||||
|
{
|
||||||
|
var entrances = outerFogWarpVolume._exits;
|
||||||
|
var newEntrances = new List<SphericalFogWarpExit>();
|
||||||
|
foreach (var index in config.allowedEntrances)
|
||||||
|
{
|
||||||
|
if(index is < 0 or > 5) continue;
|
||||||
|
newEntrances.Add(entrances[index]);
|
||||||
|
}
|
||||||
|
outerFogWarpVolume._exits = newEntrances.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
// Set the scale
|
// Set the scale
|
||||||
var scale = config.radius / BASE_DIMENSION_RADIUS;
|
var scale = config.radius / BASE_DIMENSION_RADIUS;
|
||||||
geometry.transform.localScale = Vector3.one * scale;
|
geometry.transform.localScale = Vector3.one * scale;
|
||||||
@ -255,10 +175,6 @@ namespace NewHorizons.Builder.Body
|
|||||||
cloak._sectors = new Sector[] { sector };
|
cloak._sectors = new Sector[] { sector };
|
||||||
cloak.GetComponent<Renderer>().enabled = true;
|
cloak.GetComponent<Renderer>().enabled = true;
|
||||||
|
|
||||||
// fix the fog backdrop
|
|
||||||
atmo.GetComponent<SectorCullGroup>()._sector = sector;
|
|
||||||
atmo.GetComponent<SectorLightsCullGroup>()._sector = sector;
|
|
||||||
|
|
||||||
// finalize
|
// finalize
|
||||||
atmo.SetActive(true);
|
atmo.SetActive(true);
|
||||||
volumes.SetActive(true);
|
volumes.SetActive(true);
|
||||||
|
|||||||
@ -215,13 +215,25 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
sector.RegisterFogLight(fogLight);
|
sector.RegisterFogLight(fogLight);
|
||||||
|
|
||||||
|
// If the config says only certain exits are allowed, enforce that
|
||||||
|
if (config.possibleExits != null)
|
||||||
|
{
|
||||||
|
var exits = innerFogWarpVolume._exits;
|
||||||
|
var newExits = new List<SphericalFogWarpExit>();
|
||||||
|
foreach (var index in config.possibleExits)
|
||||||
|
{
|
||||||
|
if(index is < 0 or > 5) continue;
|
||||||
|
newExits.Add(exits[index]);
|
||||||
|
}
|
||||||
|
innerFogWarpVolume._exits = newExits.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
// set up screen fog effect
|
// set up screen fog effect
|
||||||
// (in the base game, any sector that contains a bramble node needs an EffectRuleset with type FogWarp)
|
// (in the base game, any sector that contains a bramble node needs an EffectRuleset with type FogWarp)
|
||||||
// (this isn't jank I swear, this is how it's supposed to work)
|
// (this isn't jank I swear, this is how it's supposed to work)
|
||||||
var sectorHasFogEffectRuleset = sector
|
var sectorHasFogEffectRuleset = sector
|
||||||
.GetComponents<EffectRuleset>()
|
.GetComponents<EffectRuleset>()
|
||||||
.Where(effectRuleset => effectRuleset._type == EffectRuleset.BubbleType.FogWarp)
|
.Any(effectRuleset => effectRuleset._type == EffectRuleset.BubbleType.FogWarp);
|
||||||
.Count() > 0;
|
|
||||||
if (!sectorHasFogEffectRuleset)
|
if (!sectorHasFogEffectRuleset)
|
||||||
{
|
{
|
||||||
var fogEffectRuleset = sector.gameObject.AddComponent<EffectRuleset>();
|
var fogEffectRuleset = sector.gameObject.AddComponent<EffectRuleset>();
|
||||||
@ -244,7 +256,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
// Seed fog works differently, so it doesn't need to be fixed (it's also located on a different child path, so the below FindChild calls wouldn't work)
|
// Seed fog works differently, so it doesn't need to be fixed (it's also located on a different child path, so the below FindChild calls wouldn't work)
|
||||||
if (!config.isSeed)
|
if (!config.isSeed)
|
||||||
{
|
{
|
||||||
var fog = brambleNode.FindChild("Effects").FindChild("InnerWarpFogSphere");
|
var fog = brambleNode.FindChild("Effects/InnerWarpFogSphere");
|
||||||
var fogMaterial = fog.GetComponent<MeshRenderer>().sharedMaterial;
|
var fogMaterial = fog.GetComponent<MeshRenderer>().sharedMaterial;
|
||||||
fog.transform.localScale /= config.scale;
|
fog.transform.localScale /= config.scale;
|
||||||
fogMaterial.SetFloat("_Radius", fogMaterial.GetFloat("_Radius") * config.scale);
|
fogMaterial.SetFloat("_Radius", fogMaterial.GetFloat("_Radius") * config.scale);
|
||||||
@ -255,6 +267,13 @@ namespace NewHorizons.Builder.Props
|
|||||||
if (config.isSeed) SetSeedColors(brambleNode, config.fogTint?.ToColor(), config.lightTint?.ToColor());
|
if (config.isSeed) SetSeedColors(brambleNode, config.fogTint?.ToColor(), config.lightTint?.ToColor());
|
||||||
else SetNodeColors(brambleNode, config.fogTint?.ToColor(), config.lightTint?.ToColor());
|
else SetNodeColors(brambleNode, config.fogTint?.ToColor(), config.lightTint?.ToColor());
|
||||||
|
|
||||||
|
innerFogWarpVolume._useFarFogColor = false;
|
||||||
|
if (config.farFogTint != null)
|
||||||
|
{
|
||||||
|
innerFogWarpVolume._useFarFogColor = true;
|
||||||
|
innerFogWarpVolume._farFogColor = config.farFogTint.ToColor();
|
||||||
|
}
|
||||||
|
|
||||||
// Set up warps
|
// Set up warps
|
||||||
innerFogWarpVolume._sector = sector;
|
innerFogWarpVolume._sector = sector;
|
||||||
innerFogWarpVolume._attachedBody = go.GetComponent<OWRigidbody>(); // I don't think this is necessary, it seems to be set correctly on its own
|
innerFogWarpVolume._attachedBody = go.GetComponent<OWRigidbody>(); // I don't think this is necessary, it seems to be set correctly on its own
|
||||||
@ -292,9 +311,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
var fogRenderer = brambleNode.GetComponent<InnerFogWarpVolume>();
|
var fogRenderer = brambleNode.GetComponent<InnerFogWarpVolume>();
|
||||||
|
|
||||||
fogRenderer._fogColor = fogTint.Value;
|
fogRenderer._fogColor = fogTint.Value;
|
||||||
fogRenderer._useFarFogColor = false;
|
|
||||||
|
|
||||||
var fogBackdrop = brambleNode.FindChild("Terrain_DB_BrambleSphere_Inner_v2")?.FindChild("fogbackdrop_v2");
|
var fogBackdrop = brambleNode.FindChild("Terrain_DB_BrambleSphere_Inner_v2/fogbackdrop_v2");
|
||||||
if (fogBackdrop != null) fogBackdrop.GetComponent<MeshRenderer>().sharedMaterial.color = (Color)fogTint;
|
if (fogBackdrop != null) fogBackdrop.GetComponent<MeshRenderer>().sharedMaterial.color = (Color)fogTint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
foreach (var existingArc in existingGhostArcs)
|
foreach (var existingArc in existingGhostArcs)
|
||||||
{
|
{
|
||||||
var arc = existingArc.InstantiateInactive();
|
var arc = existingArc.InstantiateInactive();
|
||||||
arc.name = "Arc";
|
arc.name = "Arc (Ghost)";
|
||||||
_ghostArcPrefabs.Add(arc);
|
_ghostArcPrefabs.Add(arc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,7 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
public UnityEvent SupernovaStart = new UnityEvent();
|
public UnityEvent SupernovaStart = new UnityEvent();
|
||||||
|
|
||||||
private float maxScale;
|
private float maxScale;
|
||||||
|
private float minScale;
|
||||||
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
|
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
|
||||||
|
|
||||||
private Color _currentColour;
|
private Color _currentColour;
|
||||||
@ -121,10 +122,12 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
if (scaleCurve != null)
|
if (scaleCurve != null)
|
||||||
{
|
{
|
||||||
maxScale = scaleCurve.keys.Select(x => x.value).Max() * size;
|
maxScale = scaleCurve.keys.Select(x => x.value).Max() * size;
|
||||||
|
minScale = scaleCurve.keys.Select(x => x.value).Min() * size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
maxScale = 0;
|
maxScale = 0;
|
||||||
|
minScale = 0;
|
||||||
scaleCurve = new AnimationCurve();
|
scaleCurve = new AnimationCurve();
|
||||||
scaleCurve.AddKey(0, 1);
|
scaleCurve.AddKey(0, 1);
|
||||||
}
|
}
|
||||||
@ -150,7 +153,8 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
{
|
{
|
||||||
// Use the age if theres no resizing happening, else make it get redder the larger it is or wtv
|
// Use the age if theres no resizing happening, else make it get redder the larger it is or wtv
|
||||||
var t = _age / (lifespan * 60f);
|
var t = _age / (lifespan * 60f);
|
||||||
if (maxScale > 0) t = CurrentScale / maxScale;
|
if (maxScale != minScale) t = Mathf.InverseLerp(minScale, maxScale, CurrentScale);
|
||||||
|
|
||||||
if (t < 1f)
|
if (t < 1f)
|
||||||
{
|
{
|
||||||
_currentColour = Color.Lerp(_startColour, _endColour, t);
|
_currentColour = Color.Lerp(_startColour, _endColour, t);
|
||||||
@ -268,9 +272,7 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
{
|
{
|
||||||
lod.material.SetFloat("_InnerRadius", CurrentScale);
|
lod.material.SetFloat("_InnerRadius", CurrentScale);
|
||||||
lod.material.SetFloat("_OuterRadius", CurrentScale * StarBuilder.OuterRadiusRatio);
|
lod.material.SetFloat("_OuterRadius", CurrentScale * StarBuilder.OuterRadiusRatio);
|
||||||
|
lod.material.SetColor("_SkyColor", _currentColour);
|
||||||
// These break once it reaches endColour and I have no idea why
|
|
||||||
//lod.material.SetColor("_SkyColor", _currentColour);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
NewHorizons/External/Configs/PlanetConfig.cs
vendored
1
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -181,6 +181,7 @@ namespace NewHorizons.External.Configs
|
|||||||
if (Base.centerOfSolarSystem) Orbit.isStatic = true;
|
if (Base.centerOfSolarSystem) Orbit.isStatic = true;
|
||||||
if (Atmosphere?.clouds?.lightningGradient != null) Atmosphere.clouds.hasLightning = true;
|
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 (Bramble?.dimension != null && Orbit?.staticPosition == null) throw new Exception($"Dimension {name} must have Orbit.staticPosition defined.");
|
||||||
|
if (Bramble?.dimension != null) canShowOnTitle = false;
|
||||||
if (Orbit?.staticPosition != null) Orbit.isStatic = true;
|
if (Orbit?.staticPosition != null) Orbit.isStatic = true;
|
||||||
|
|
||||||
// For each quantum group, verify the following:
|
// For each quantum group, verify the following:
|
||||||
|
|||||||
15
NewHorizons/External/Modules/BrambleModule.cs
vendored
15
NewHorizons/External/Modules/BrambleModule.cs
vendored
@ -41,6 +41,11 @@ namespace NewHorizons.External.Modules
|
|||||||
/// The internal radius (in meters) of the dimension. The default is 1705.
|
/// The internal radius (in meters) of the dimension. The default is 1705.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(1705f)] public float radius = 1705f;
|
[DefaultValue(1705f)] public float radius = 1705f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An array of integers from 0-5. By default, all entrances are allowed. To force this dimension to warp players in from only one point (like the anglerfish nest dimension in the base game) set this value to [3], [5], or similar. Values of 0-5 only.
|
||||||
|
/// </summary>
|
||||||
|
public int[] allowedEntrances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -86,6 +91,16 @@ namespace NewHorizons.External.Modules
|
|||||||
/// The color of the shafts of light coming from the entrances to the node. Leave blank for the default yellowish color: (131, 124, 105, 255)
|
/// The color of the shafts of light coming from the entrances to the node. Leave blank for the default yellowish color: (131, 124, 105, 255)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MColor lightTint;
|
public MColor lightTint;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The color a dimension's background fog turns when you approach this node (if it's in a dimension). If this node is not in a dimension, this does nothing. Leave blank for the default yellowish white color: (255, 245, 217, 255)
|
||||||
|
/// </summary>
|
||||||
|
public MColor farFogTint;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An array of integers from 0-5. By default, all exits are allowed. To force this node to warp players out from only one hole set this value to [3], [5], or similar. Values of 0-5 only.
|
||||||
|
/// </summary>
|
||||||
|
public int[] possibleExits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,8 +26,6 @@ namespace NewHorizons.Handlers
|
|||||||
public Sprite eoteSprite;
|
public Sprite eoteSprite;
|
||||||
public int subtitleIndex;
|
public int subtitleIndex;
|
||||||
|
|
||||||
public System.Random randomizer;
|
|
||||||
|
|
||||||
public static readonly int PAUSE_TIMER_MAX = 50;
|
public static readonly int PAUSE_TIMER_MAX = 50;
|
||||||
public int pauseTimer = PAUSE_TIMER_MAX;
|
public int pauseTimer = PAUSE_TIMER_MAX;
|
||||||
|
|
||||||
@ -45,8 +43,6 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
randomizer = new System.Random();
|
|
||||||
|
|
||||||
GetComponent<CanvasGroup>().alpha = 1;
|
GetComponent<CanvasGroup>().alpha = 1;
|
||||||
graphic = GetComponent<Graphic>();
|
graphic = GetComponent<Graphic>();
|
||||||
image = GetComponent<UnityEngine.UI.Image>();
|
image = GetComponent<UnityEngine.UI.Image>();
|
||||||
@ -87,7 +83,7 @@ namespace NewHorizons.Handlers
|
|||||||
possibleSubtitles.Add(sprite);
|
possibleSubtitles.Add(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void FixedUpdate()
|
||||||
{
|
{
|
||||||
CheckForEOTE();
|
CheckForEOTE();
|
||||||
|
|
||||||
@ -132,14 +128,7 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
public void ChangeSubtitle()
|
public void ChangeSubtitle()
|
||||||
{
|
{
|
||||||
// to pick a new random subtitle without requiring retries, we generate a random offset less than the length of the possible subtitles array
|
subtitleIndex = (subtitleIndex + 1) % possibleSubtitles.Count;
|
||||||
// we then add that offset to the current index, modulo NUMBER_OF_POSSIBLE_SUBTITLES
|
|
||||||
// since the offset can never be NUMBER_OF_POSSIBLE_SUBTITLES, it will never wrap all the way back around to the initial subtitleIndex
|
|
||||||
|
|
||||||
// note, this makes the code more confusing, but Random.Next(min, max) generates a random number on the range [min, max)
|
|
||||||
// that is, the below code will generate numbers up to and including Count-1, not Count.
|
|
||||||
var newIndexOffset = randomizer.Next(1, possibleSubtitles.Count);
|
|
||||||
subtitleIndex = (subtitleIndex + newIndexOffset) % possibleSubtitles.Count;
|
|
||||||
|
|
||||||
image.sprite = possibleSubtitles[subtitleIndex];
|
image.sprite = possibleSubtitles[subtitleIndex];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -388,6 +388,8 @@ namespace NewHorizons
|
|||||||
|
|
||||||
if (SystemDict.ContainsKey(name))
|
if (SystemDict.ContainsKey(name))
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(SystemDict[name].Config.travelAudio))
|
||||||
|
SystemDict[name].Mod = mod;
|
||||||
SystemDict[name].Config.Merge(starSystemConfig);
|
SystemDict[name].Config.Merge(starSystemConfig);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -10,6 +10,12 @@ namespace NewHorizons.Patches
|
|||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
public class BramblePatches
|
public class BramblePatches
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// this file is not great. the real solution to the issues these patches address should be solved by replacing bramble nodes' InnerFogWarpVolume
|
||||||
|
// components with a custom NHInnerFogWarpVolume component, and implement the below functions as overrides in the NHInnerFogWarpVolume class
|
||||||
|
// that would fix the issue of seeds having inappropriate screen fog
|
||||||
|
//
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(SphericalFogWarpVolume), nameof(SphericalFogWarpVolume.IsProbeOnly))]
|
[HarmonyPatch(typeof(SphericalFogWarpVolume), nameof(SphericalFogWarpVolume.IsProbeOnly))]
|
||||||
public static bool SphericalFogWarpVolume_IsProbeOnly(SphericalFogWarpVolume __instance, ref bool __result)
|
public static bool SphericalFogWarpVolume_IsProbeOnly(SphericalFogWarpVolume __instance, ref bool __result)
|
||||||
|
|||||||
@ -530,6 +530,14 @@
|
|||||||
"description": "The internal radius (in meters) of the dimension. The default is 1705.",
|
"description": "The internal radius (in meters) of the dimension. The default is 1705.",
|
||||||
"format": "float",
|
"format": "float",
|
||||||
"default": 1705.0
|
"default": 1705.0
|
||||||
|
},
|
||||||
|
"allowedEntrances": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "An array of integers from 0-5. By default, all entrances are allowed. To force this dimension to warp players in from only one point (like the anglerfish nest dimension in the base game) set this value to [3], [5], or similar. Values of 0-5 only.",
|
||||||
|
"items": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -571,6 +579,18 @@
|
|||||||
"lightTint": {
|
"lightTint": {
|
||||||
"description": "The color of the shafts of light coming from the entrances to the node. Leave blank for the default yellowish color: (131, 124, 105, 255)",
|
"description": "The color of the shafts of light coming from the entrances to the node. Leave blank for the default yellowish color: (131, 124, 105, 255)",
|
||||||
"$ref": "#/definitions/MColor"
|
"$ref": "#/definitions/MColor"
|
||||||
|
},
|
||||||
|
"farFogTint": {
|
||||||
|
"description": "The color a dimension's background fog turns when you approach this node (if it's in a dimension). If this node is not in a dimension, this does nothing. Leave blank for the default yellowish white color: (255, 245, 217, 255)",
|
||||||
|
"$ref": "#/definitions/MColor"
|
||||||
|
},
|
||||||
|
"possibleExits": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "An array of integers from 0-5. By default, all exits are allowed. To force this node to warp players out from only one hole set this value to [3], [5], or similar. Values of 0-5 only.",
|
||||||
|
"items": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -20,12 +20,7 @@ namespace NewHorizons.Utility
|
|||||||
return _loadedTextures.ContainsKey(path);
|
return _loadedTextures.ContainsKey(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture2D GetTexture(IModBehaviour mod, string filename)
|
public static Texture2D GetTexture(IModBehaviour mod, string filename, bool useMipmaps = true)
|
||||||
{
|
|
||||||
return GetTexture(mod, filename, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Texture2D GetTexture(IModBehaviour mod, string filename, bool useMipmaps)
|
|
||||||
{
|
{
|
||||||
// Copied from OWML but without the print statement lol
|
// Copied from OWML but without the print statement lol
|
||||||
var path = mod.ModHelper.Manifest.ModFolderPath + filename;
|
var path = mod.ModHelper.Manifest.ModFolderPath + filename;
|
||||||
@ -41,6 +36,7 @@ namespace NewHorizons.Utility
|
|||||||
var data = File.ReadAllBytes(path);
|
var data = File.ReadAllBytes(path);
|
||||||
var texture = new Texture2D(2, 2, TextureFormat.RGBA32, useMipmaps);
|
var texture = new Texture2D(2, 2, TextureFormat.RGBA32, useMipmaps);
|
||||||
texture.name = Path.GetFileNameWithoutExtension(path);
|
texture.name = Path.GetFileNameWithoutExtension(path);
|
||||||
|
texture.wrapMode = TextureWrapMode.Clamp; // this is apparently repeat by default
|
||||||
texture.LoadImage(data);
|
texture.LoadImage(data);
|
||||||
_loadedTextures.Add(path, texture);
|
_loadedTextures.Add(path, texture);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user