-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Major features - Heightmap overhaul! - Normal maps (bump maps) - Smoothness (gloss) and metallic maps - Tiling versions of texture/normal/smoothness/metallic maps for finer up-close detail - Blend map that uses the red, green, blue, and alpha channels to control the distribution of 4 tiles respectively, plus a fifth "base" tile that appears where the others are absent. - Stretch has changed to proper unity coordinates, where y is up. ## Minor features - New `CometTail` module replacing the `hasCometTail` field. Allows customizing the colour and scale-over-time of a comet tail. ## Improvements - Patched forget frequency method so it will work for those using it on custom signals - Added `teenager` arc type to translator text. This is a mix between child and adult. It uses the adult mesh but the child texture. Originally used at the window text on Giant's Deep's statue island. - Generated textures are now cached. this should reduce memory usage (resolves #581) - Textures are named by file path and then the effects applied to them, for example `[path] > invert > tint [color]` - Physics details splash in water like the probe and have the probe's buoyancy. ## Bug fixes - Fixed NullReferenceException when spawning vessels with physics - Fixed SpawnDialogue API method always creating a remote trigger - Physics details are now affected by tornadoes (resolves #580) - Stretch now behaves more intuitively (does not divide min/max height by the largest stretch axis) (resolves #551) - Fix spamming logs with "Fact ID Not Found" on system change (resolves #586)
- Loading branch information
Showing
94 changed files
with
1,121 additions
and
526 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,128 @@ | ||
using NewHorizons.Components.SizeControllers; | ||
using NewHorizons.External.Configs; | ||
using NewHorizons.External.Modules; | ||
using NewHorizons.Utility; | ||
using NewHorizons.Utility.Files; | ||
using NewHorizons.Utility.OuterWilds; | ||
using NewHorizons.Utility.OWML; | ||
using UnityEngine; | ||
|
||
namespace NewHorizons.Builder.Body | ||
{ | ||
public static class CometTailBuilder | ||
{ | ||
private static GameObject _tailPrefab; | ||
private static GameObject _dustPrefab; | ||
private static GameObject _gasPrefab; | ||
|
||
internal static void InitPrefab() | ||
{ | ||
if (_tailPrefab == null) _tailPrefab = SearchUtilities.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes").InstantiateInactive().Rename("Prefab_CO_Tail").DontDestroyOnLoad(); | ||
if (_dustPrefab == null) | ||
{ | ||
_dustPrefab = new GameObject("Prefab_CO_Dust").DontDestroyOnLoad(); | ||
|
||
var dust1 = SearchUtilities.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes/Effects_CO_DustTail").Instantiate(); | ||
dust1.transform.parent = _dustPrefab.transform; | ||
dust1.transform.localPosition = Vector3.zero; | ||
dust1.transform.localRotation = Quaternion.Euler(0, 270, 0); | ||
|
||
var dust2 = SearchUtilities.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes/Effects_CO_DustTail (1)").Instantiate(); | ||
dust2.transform.parent = _dustPrefab.transform; | ||
dust2.transform.localPosition = Vector3.zero; | ||
dust2.transform.localRotation = Quaternion.Euler(0, 270, 0); | ||
|
||
var dust3 = SearchUtilities.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes/Effects_CO_DustTail (2)").Instantiate(); | ||
dust3.transform.parent = _dustPrefab.transform; | ||
dust3.transform.localPosition = Vector3.zero; | ||
dust3.transform.localRotation = Quaternion.Euler(0, 270, 0); | ||
|
||
_dustPrefab.SetActive(false); | ||
} | ||
if (_gasPrefab == null) | ||
{ | ||
_gasPrefab = new GameObject("Prefab_CO_Gas").DontDestroyOnLoad(); | ||
|
||
var gas1 = SearchUtilities.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes/Effects_CO_GasTail").Instantiate(); | ||
gas1.transform.parent = _gasPrefab.transform; | ||
gas1.transform.localPosition = Vector3.zero; | ||
gas1.transform.localRotation = Quaternion.Euler(0, 270, 0); | ||
|
||
var gas2 = SearchUtilities.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes/Effects_CO_GasTail (1)").Instantiate(); | ||
gas2.transform.parent = _gasPrefab.transform; | ||
gas2.transform.localPosition = Vector3.zero; | ||
gas2.transform.localRotation = Quaternion.Euler(0, 270, 0); | ||
|
||
var gas3 = SearchUtilities.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes/Effects_CO_GasTail (2)").Instantiate(); | ||
gas3.transform.parent = _gasPrefab.transform; | ||
gas3.transform.localPosition = Vector3.zero; | ||
gas3.transform.localRotation = Quaternion.Euler(0, 270, 0); | ||
|
||
_gasPrefab.SetActive(false); | ||
} | ||
} | ||
|
||
public static void Make(GameObject planetGO, Sector sector, PlanetConfig config) | ||
public static void Make(GameObject planetGO, Sector sector, CometTailModule cometTailModule, PlanetConfig config) | ||
{ | ||
InitPrefab(); | ||
if (config.Orbit.primaryBody == null) | ||
{ | ||
NHLogger.LogError($"Comet {planetGO.name} does not orbit anything. That makes no sense"); | ||
return; | ||
} | ||
|
||
var rootObj = new GameObject("CometRoot"); | ||
rootObj.SetActive(false); | ||
rootObj.transform.parent = sector?.transform ?? planetGO.transform; | ||
rootObj.transform.localPosition = Vector3.zero; | ||
|
||
var controller = rootObj.AddComponent<CometTailController>(); | ||
|
||
controller.size = (cometTailModule.innerRadius ?? config.Base.surfaceSize) / 110; | ||
|
||
if (cometTailModule.rotationOverride != null) controller.SetRotationOverride(cometTailModule.rotationOverride); | ||
|
||
if (string.IsNullOrEmpty(cometTailModule.primaryBody)) cometTailModule.primaryBody = config.Orbit.primaryBody; | ||
|
||
Delay.FireOnNextUpdate(() => | ||
{ | ||
controller.SetPrimaryBody( | ||
AstroObjectLocator.GetAstroObject(cometTailModule.primaryBody).transform, | ||
AstroObjectLocator.GetAstroObject(config.Orbit.primaryBody).GetAttachedOWRigidbody() | ||
); | ||
}); | ||
|
||
controller.SetScaleCurve(cometTailModule.curve); | ||
|
||
var dustTail = Object.Instantiate(_dustPrefab, rootObj.transform).Rename("DustTail"); | ||
dustTail.transform.localPosition = Vector3.zero; | ||
dustTail.transform.localRotation = Quaternion.Euler(90, 90, 0); | ||
dustTail.SetActive(true); | ||
controller.dustTail = dustTail; | ||
|
||
var cometTail = GameObject.Instantiate(_tailPrefab, sector?.transform ?? planetGO.transform); | ||
cometTail.transform.position = planetGO.transform.position; | ||
cometTail.name = "CometTail"; | ||
cometTail.transform.localScale = Vector3.one * config.Base.surfaceSize / 110; | ||
var gasTail = Object.Instantiate(_gasPrefab, rootObj.transform).Rename("GasTail"); | ||
gasTail.transform.localPosition = Vector3.zero; | ||
gasTail.transform.localRotation = Quaternion.Euler(90, 90, 0); | ||
gasTail.SetActive(true); | ||
controller.gasTail = gasTail; | ||
|
||
Vector3 alignment = new Vector3(0, 270, 90); | ||
if (config.Base.cometTailRotation != null) alignment = config.Base.cometTailRotation; | ||
if (cometTailModule.dustTint != null) | ||
{ | ||
foreach (var dust in dustTail.GetComponentsInChildren<MeshRenderer>()) | ||
{ | ||
var untintedDust = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/Effects_CO_DustTail_d.png"); | ||
dust.material.mainTexture = ImageUtilities.TintImage(untintedDust, cometTailModule.dustTint.ToColor()); | ||
} | ||
} | ||
|
||
cometTail.transform.rotation = Quaternion.Euler(alignment); | ||
if (cometTailModule.gasTint != null) | ||
{ | ||
foreach (var gas in gasTail.GetComponentsInChildren<MeshRenderer>()) | ||
{ | ||
var untintedGas = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/Effects_CO_GasTail_d.png"); | ||
gas.material.mainTexture = untintedGas; | ||
gas.material.color = cometTailModule.gasTint.ToColor(); | ||
} | ||
} | ||
|
||
cometTail.SetActive(true); | ||
rootObj.SetActive(true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.